-
Notifications
You must be signed in to change notification settings - Fork 24
/
Copy pathpostBuild
executable file
·75 lines (60 loc) · 2.04 KB
/
postBuild
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#!/usr/bin/env python3
""" perform a development install of code_snippet
On Binder, this will run _after_ the environment has been fully created from
the environment.yml in this directory.
This script should also run locally on Linux/MacOS/Windows:
python3 binder/postBuild
"""
import subprocess
import sys
from pathlib import Path
ROOT = Path.cwd()
print("Current Working dir:", ROOT)
def _(*args, **kwargs):
""" Run a command, echoing the args
fails hard if something goes wrong
"""
print("\n\t", " ".join(args), "\n")
return_code = subprocess.call(args, **kwargs)
if return_code != 0:
print("\nERROR", return_code, " ".join(args))
sys.exit(return_code)
# verify the environment is self-consistent before even starting
# _(sys.executable, "-m", "pip", "check")
# install the labextension
_(sys.executable, "-m", "pip", "install", "-e", ".")
# verify the environment the extension didn't break anything
# _(sys.executable, "-m", "pip", "check")
# list the extensions
# _("jupyter", "server", "extension", "list")
# initially list installed extensions to determine if there are any surprises
# _("jupyter", "labextension", "list")
print("JupyterLab with code_snippet is ready to run with:\n")
print("\tjupyter lab\n")
# remove unnecessary directories when using the binder
_('rm', '-rf', './lib')
_('rm', '-rf', './src')
_('rm', '-rf', './style')
_('rm', '-rf', './_temp_extension')
_('rm', '-rf', './Design')
_('rm', '-rf', './binder')
_('rm', '-rf', './docs')
_('rm', '-rf', './code_snippet')
_('rm', '-rf', './code_snippet.egg-info')
_('rm', '-rf', './schema')
_('rm', '-rf', './node_modules')
_('rm', '-rf', './coverage')
_('rm', '-rf', './test')
_('rm', '-rf', './testutils')
_('rm', './install.json')
_('rm', './package.json')
_('rm', './PROGRESS.md')
_('rm', './setup.py')
_('rm', './pyproject.toml')
_('rm', './tsconfig.json')
_('rm', './tsconfig.test.json')
_('rm', './babel.config.js')
_('rm', './jest.config.js')
_('rm', './tsconfig.tsbuildinfo')
_('rm', './yarn.lock')
_('rm', './MANIFEST.in')