This repository has been archived by the owner on Dec 29, 2017. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 111
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #95 from KesterTong/jinja
Modify build system and closure dependencies
- Loading branch information
Showing
10 changed files
with
172 additions
and
95 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import subprocess | ||
import sys | ||
|
||
from install_lib import COLAB_ROOT_PATH | ||
from install_lib import pjoin | ||
|
||
RESOURCES_DIR = pjoin(COLAB_ROOT_PATH, 'colaboratory', 'resources') | ||
|
||
CLOSURE_DIR = pjoin(RESOURCES_DIR, 'closure-library') | ||
|
||
CALC_DEPS_FILE = pjoin(CLOSURE_DIR, 'closure', 'bin', 'calcdeps.py') | ||
|
||
GOOG_ROOT = CLOSURE_DIR | ||
COLAB_ROOT = pjoin(RESOURCES_DIR, 'colab') | ||
|
||
OUTPUT_FILE = pjoin(COLAB_ROOT, 'js', 'colab.dep') | ||
|
||
subprocess.call([ | ||
'python', | ||
CALC_DEPS_FILE, | ||
'--dep', | ||
GOOG_ROOT, | ||
'--path', | ||
COLAB_ROOT, | ||
'--output_mode', | ||
'deps', | ||
'--output_file', | ||
OUTPUT_FILE]) | ||
|
||
subprocess.call([ | ||
'sed', | ||
'-i', '', | ||
's/\.\.\/\.\.\/\.\./\.\./g', | ||
OUTPUT_FILE]) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
// This file was autogenerated by calcdeps.py | ||
goog.addDependency("../colab/js/api_wrapper.js", ['colab.drive.ApiWrapper'], ['colab.app', 'colab.client_id', 'colab.error.GapiError', 'colab.params', 'colab.scope', 'goog.Promise', 'goog.events', 'goog.ui.Dialog']); | ||
goog.addDependency("../colab/js/app.js", ['colab.app'], ['colab.notification', 'colab.params', 'goog.Promise']); | ||
goog.addDependency("../colab/js/bottompane.js", ['colab.BottomPane'], ['colab.Global', 'goog.array', 'goog.dom', 'goog.dom.TagName', 'goog.dom.ViewportSizeMonitor', 'goog.dom.classes', 'goog.events', 'goog.events.EventType', 'goog.fx.Dragger', 'goog.object', 'goog.style', 'goog.ui.Button', 'goog.ui.Component']); | ||
goog.addDependency("../colab/js/client_id.js", ['colab.client_id', 'colab.scope'], []); | ||
goog.addDependency("../colab/js/colabdeps.js", [], ['goog.Promise', 'goog.format.JsonPrettyPrinter', 'goog.fx.DragListGroup', 'goog.ui.Component', 'goog.ui.ToolbarButton']); | ||
goog.addDependency("../colab/js/colabtools.js", [], []); | ||
goog.addDependency("../colab/js/comments.js", ['colab.Comment', 'colab.CommentsWidget', 'colab.NewComment'], ['goog.date', 'goog.date.DateTime', 'goog.date.relative', 'goog.dom', 'goog.dom.forms', 'goog.style']); | ||
goog.addDependency("../colab/js/deps.js", [], []); | ||
goog.addDependency("../colab/js/dialog.js", ['colab.dialog'], ['goog.ui.Dialog']); | ||
goog.addDependency("../colab/js/drive.js", ['colab.drive'], ['colab.drive.ApiWrapper', 'colab.error.GapiError', 'colab.nbformat', 'goog.array', 'goog.Uri']); | ||
goog.addDependency("../colab/js/drive_externs.js", [], []); | ||
goog.addDependency("../colab/js/drivehandler.js", [], ['colab.params']); | ||
goog.addDependency("../colab/js/error.js", ['colab.Error', 'colab.ErrorEvent', 'colab.error.GapiError', 'colab.error.GapiRealtimeError'], ['goog.debug.Error', 'goog.events.Event']); | ||
goog.addDependency("../colab/js/externs.js", [], []); | ||
goog.addDependency("../colab/js/filepicker.js", ['colab.filepicker'], ['colab.app']); | ||
goog.addDependency("../colab/js/global.js", ['colab.Global'], []); | ||
goog.addDependency("../colab/js/header.js", ['colab.header'], ['colab.Global', 'colab.app', 'colab.cell.CellType', 'colab.dialog', 'colab.filepicker', 'colab.model.Notebook', 'colab.nbformat', 'colab.notification', 'colab.params', 'colab.share', 'goog.array', 'goog.dom', 'goog.dom.TagName', 'goog.dom.classes', 'goog.events', 'goog.style', 'goog.ui.Component', 'goog.ui.Menu', 'goog.ui.MenuBarRenderer', 'goog.ui.MenuItem', 'goog.ui.Option', 'goog.ui.SelectionModel', 'goog.ui.Separator', 'goog.ui.Toolbar', 'goog.ui.ToolbarButton', 'goog.ui.ToolbarMenuButton', 'goog.ui.ToolbarRenderer', 'goog.ui.ToolbarSelect', 'goog.ui.ToolbarSeparator', 'goog.ui.ToolbarToggleButton', 'goog.ui.menuBar', 'goog.ui.menuBarDecorator']); | ||
goog.addDependency("../colab/js/install.js", ['colab.install'], ['colab.client_id', 'colab.scope']); | ||
goog.addDependency("../colab/js/interactive_widgets.js", [], []); | ||
goog.addDependency("../colab/js/main.js", ['colab'], ['colab.Global', 'colab.Notebook', 'colab.PNaClKernel', 'colab.Preferences', 'colab.app', 'colab.dialog', 'colab.drive', 'colab.drive.ApiWrapper', 'colab.model.Notebook', 'colab.notification', 'colab.params', 'colab.presence', 'colab.services', 'colab.sharing.SharingState', 'goog.array', 'goog.dom', 'goog.events', 'goog.net.cookies', 'goog.style', 'goog.ui.Dialog', 'goog.ui.ScrollFloater']); | ||
goog.addDependency("../colab/js/nbformat.js", ['colab.nbformat'], ['goog.format.JsonPrettyPrinter']); | ||
goog.addDependency("../colab/js/notebook.js", ['colab.CellDragger', 'colab.KeyboardShortcut', 'colab.Notebook'], ['colab.BottomPane', 'colab.CommentsWidget', 'colab.Global', 'colab.Undo', 'colab.cell.AddCell', 'colab.cell.AddCellEventType', 'colab.cell.Cell', 'colab.cell.CellType', 'colab.cell.factory', 'colab.dialog', 'colab.filepicker', 'colab.header', 'colab.notification', 'goog.array', 'goog.dom', 'goog.dom.classlist', 'goog.events', 'goog.events.KeyCodes', 'goog.events.KeyHandler', 'goog.fx.DragListDirection', 'goog.fx.DragListGroup', 'goog.fx.Dragger', 'goog.fx.Transition', 'goog.fx.dom.FadeInAndShow', 'goog.fx.dom.FadeOutAndHide', 'goog.style', 'goog.ui.Component', 'goog.ui.Dialog']); | ||
goog.addDependency("../colab/js/notification.js", ['colab.Notification', 'colab.notification'], ['goog.dom', 'goog.dom.classes', 'goog.style']); | ||
goog.addDependency("../colab/js/params.js", ['colab.params'], []); | ||
goog.addDependency("../colab/js/picker_externs.js", [], []); | ||
goog.addDependency("../colab/js/pnacl_kernel.js", ['colab.PNaClKernel'], ['colab.app']); | ||
goog.addDependency("../colab/js/presence.js", ['colab.presence'], ['colab.Global', 'goog.array', 'goog.dom']); | ||
goog.addDependency("../colab/js/services.js", ['colab.services'], ['colab.Global', 'goog.events', 'goog.ui.Dialog']); | ||
goog.addDependency("../colab/js/shadow.js", ['colab.Shadow'], ['goog.dom']); | ||
goog.addDependency("../colab/js/share.js", ['colab.share'], ['colab.drive']); | ||
goog.addDependency("../colab/js/svgbutton.js", ['colab.SvgButton'], ['goog.dom', 'goog.events', 'goog.events.EventType', 'goog.ui.ToolbarButton']); | ||
goog.addDependency("../colab/js/undo.js", ['colab.Undo'], []); | ||
goog.addDependency("../colab/js/v1_closure.js", ['test'], ['goog.crypt.base64']); | ||
goog.addDependency("../colab/js/welcome.js", ['colab.welcome'], ['colab.filepicker', 'colab.install', 'colab.params', 'goog.dom', 'goog.dom.classes', 'goog.dom.forms', 'goog.style']); | ||
goog.addDependency("../colab/js/cell/addcell.js", ['colab.cell.AddCell', 'colab.cell.AddCellEventType'], ['colab.Shadow', 'goog.dom', 'goog.events', 'goog.style', 'goog.ui.Component']); | ||
goog.addDependency("../colab/js/cell/cell.js", ['colab.cell.Cell', 'colab.cell.CellType'], ['colab.Global', 'colab.Shadow', 'colab.SvgButton', 'colab.cell.AddCell', 'colab.presence', 'goog.array', 'goog.dom', 'goog.dom.TagName', 'goog.dom.classlist', 'goog.events', 'goog.events.EventType', 'goog.style', 'goog.ui.Component', 'goog.ui.Container', 'goog.ui.MenuItem', 'goog.ui.Toolbar', 'goog.ui.ToolbarButton', 'goog.ui.ToolbarMenuButton']); | ||
goog.addDependency("../colab/js/cell/cellfactory.js", ['colab.cell.factory'], ['colab.cell.CellType', 'colab.cell.CodeCell', 'colab.cell.TextCell']); | ||
goog.addDependency("../colab/js/cell/codecell.js", ['colab.cell.CodeCell'], ['colab.Global', 'colab.cell.Cell', 'colab.cell.Editor', 'colab.cell.FormView', 'colab.cell.OutputArea', 'colab.notification', 'colab.services', 'goog.array', 'goog.date.DateTime', 'goog.dom', 'goog.dom.TagName', 'goog.dom.classlist', 'goog.events', 'goog.object', 'goog.style', 'goog.ui.Component', 'goog.ui.MenuItem', 'goog.ui.Prompt', 'goog.ui.ToolbarButton', 'goog.ui.ToolbarSelect']); | ||
goog.addDependency("../colab/js/cell/combowidget.js", ['colab.cell.ComboBoxFormWidget', 'colab.cell.ComboBoxParams'], ['goog.array', 'goog.dom', 'goog.dom.TagName', 'goog.string', 'goog.ui.ComboBox', 'goog.ui.Component', 'goog.ui.MenuItem']); | ||
goog.addDependency("../colab/js/cell/editor.js", ['colab.cell.Editor'], ['colab.Global', 'colab.notification', 'colab.sharing', 'colab.tooltip.Tooltip', 'goog.dom', 'goog.dom.classlist', 'goog.events.BrowserEvent', 'goog.events.EventType', 'goog.style', 'goog.ui.Component']); | ||
goog.addDependency("../colab/js/cell/formview.js", ['colab.cell.FormView', 'colab.cell.FormsParams'], ['colab.cell.ComboBoxFormWidget', 'colab.cell.SliderFormWidget', 'colab.cell.TextFieldFormWidget', 'colab.cell.TitleFormWidget', 'goog.array', 'goog.dom', 'goog.dom.TagName', 'goog.dom.classes', 'goog.style', 'goog.ui.Component']); | ||
goog.addDependency("../colab/js/cell/formview_test.js", ['colab.testing.FormViewTest'], ['colab.cell.FormView', 'goog.testing.jsunit']); | ||
goog.addDependency("../colab/js/cell/outputarea.js", ['colab.cell.OutputArea'], ['colab.Global', 'colab.params', 'goog.date.DateTime', 'goog.dom', 'goog.events', 'goog.events.EventType', 'goog.string', 'goog.style', 'goog.ui.Zippy', 'goog.ui.Component']); | ||
goog.addDependency("../colab/js/cell/outputframe.js", [], []); | ||
goog.addDependency("../colab/js/cell/sliderwidget.js", ['colab.cell.SliderFormWidget', 'colab.cell.SliderParams'], ['goog.dom', 'goog.dom.TagName', 'goog.string', 'goog.ui.Component', 'goog.ui.Slider']); | ||
goog.addDependency("../colab/js/cell/textcell.js", ['colab.cell.TextCell'], ['colab.cell.Cell', 'colab.cell.Editor', 'goog.dom', 'goog.dom.classlist', 'goog.events.EventType']); | ||
goog.addDependency("../colab/js/cell/textfieldwidget.js", ['colab.cell.TextFieldFormWidget'], ['goog.dom', 'goog.dom.TagName', 'goog.events.EventType', 'goog.ui.Component']); | ||
goog.addDependency("../colab/js/cell/titlewidget.js", ['colab.cell.TitleFormWidget', 'colab.cell.TitleParams'], ['goog.array', 'goog.dom', 'goog.dom.TagName', 'goog.style', 'goog.ui.Button', 'goog.ui.Component']); | ||
goog.addDependency("../colab/js/cell/tooltip.js", ['colab.tooltip.Tooltip'], ['goog.dom', 'goog.ui.Tooltip']); | ||
goog.addDependency("../colab/js/model/notebook.js", ['colab.model.Notebook'], ['colab.ErrorEvent', 'colab.app', 'colab.drive', 'colab.drive.ApiWrapper', 'colab.drive.Permissions', 'colab.error.GapiError', 'colab.error.GapiRealtimeError', 'colab.nbformat', 'colab.notification', 'goog.dom', 'goog.events.Event', 'goog.events.EventTarget']); | ||
goog.addDependency("../colab/js/model/permissions.js", ['colab.drive.Permissions'], []); | ||
goog.addDependency("../colab/js/model/preferences.js", ['colab.Preferences'], ['goog.net.cookies']); | ||
goog.addDependency("../colab/js/model/sharingstate.js", ['colab.sharing', 'colab.sharing.SharingState'], ['colab.drive', 'colab.drive.ApiWrapper', 'goog.array', 'goog.events.EventTarget']); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
goog.provide('colab.welcome'); | ||
|
||
goog.require('colab.filepicker'); | ||
goog.require('colab.install'); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import errno | ||
import os | ||
import shutil | ||
|
||
COLAB_ROOT_PATH = os.path.dirname(os.path.realpath(__file__)) | ||
|
||
pjoin = os.path.join | ||
|
||
def MakeDirectoryIfNotExist(path): | ||
try: | ||
os.makedirs(path) | ||
except OSError as exception: | ||
if exception.errno != errno.EEXIST: | ||
raise | ||
|
||
def RemoveDirectoryIfExist(path): | ||
try: | ||
shutil.rmtree(path) | ||
except OSError as exception: | ||
if exception.errno != errno.ENOENT: | ||
raise | ||
|
||
def RemoveFileIfExist(path): | ||
try: | ||
os.remove(path) | ||
except OSError as exception: | ||
if exception.errno != errno.ENOENT: | ||
raise | ||
|
||
def RemoveFileOrDirectoryIfExist(path): | ||
try: | ||
RemoveDirectoryIfExist(path) | ||
except OSError as exception: | ||
if exception.errno == errno.ENOTDIR: | ||
RemoveFileIfExist(path) | ||
else: | ||
raise | ||
|
||
|
||
def CopyTreeRecursively(src, dest): | ||
"""Roughly equivalent to cp -r src/* dest""" | ||
MakeDirectoryIfNotExist(dest) | ||
for entry in os.listdir(src): | ||
s = pjoin(src, entry) | ||
d = pjoin(dest, entry) | ||
if os.path.isdir(s): | ||
CopyTreeRecursively(s, d) | ||
else: | ||
shutil.copy(s, d) |