|
1 | 1 | #!/usr/bin/env python3
|
2 |
| -""" perform a development install of gluepyter |
3 |
| -
|
| 2 | +""" perform a development install of jupytercad |
4 | 3 | On Binder, this will run _after_ the environment has been fully created from
|
5 | 4 | the environment.yml in this directory.
|
6 |
| -
|
7 | 5 | This script should also run locally on Linux/MacOS/Windows:
|
8 |
| -
|
9 | 6 | python3 binder/postBuild
|
10 | 7 | """
|
11 | 8 | import subprocess
|
12 | 9 | import sys
|
13 | 10 | from pathlib import Path
|
14 |
| - |
| 11 | +import shutil |
15 | 12 |
|
16 | 13 | ROOT = Path.cwd()
|
17 | 14 |
|
| 15 | +shutil.copy(ROOT / "binder" / "jupyter_config.json", ROOT) |
18 | 16 |
|
19 | 17 | def _(*args, **kwargs):
|
20 | 18 | """Run a command, echoing the args
|
21 |
| -
|
22 | 19 | fails hard if something goes wrong
|
23 | 20 | """
|
24 |
| - print("\n\t", " ".join(args), "\n") |
| 21 | + print("\n\t", " ".join(args), "\n", flush=True) |
25 | 22 | return_code = subprocess.call(args, **kwargs)
|
26 | 23 | if return_code != 0:
|
27 |
| - print("\nERROR", return_code, " ".join(args)) |
| 24 | + print("\nERROR", return_code, " ".join(args), flush=True) |
28 | 25 | sys.exit(return_code)
|
29 | 26 |
|
30 | 27 |
|
| 28 | +# remove incompatible binder baseline packages |
| 29 | +_("mamba", "uninstall", "jupyter-resource-usage") |
| 30 | + |
31 | 31 | # verify the environment is self-consistent before even starting
|
32 | 32 | _(sys.executable, "-m", "pip", "check")
|
33 | 33 |
|
34 | 34 | # install the labextension
|
35 |
| -_(sys.executable, "-m", "pip", "install", "-e", ".") |
36 |
| -_(sys.executable, "-m", "jupyter", "labextension", "develop", "--overwrite", ".") |
37 |
| -_( |
38 |
| - sys.executable, |
39 |
| - "-m", |
40 |
| - "jupyter", |
41 |
| - "serverextension", |
42 |
| - "enable", |
43 |
| - "gluepyter", |
44 |
| -) |
45 |
| -_( |
46 |
| - sys.executable, |
47 |
| - "-m", |
48 |
| - "jupyter", |
49 |
| - "server", |
50 |
| - "extension", |
51 |
| - "enable", |
52 |
| - "gluepyter", |
53 |
| -) |
54 |
| - |
55 |
| -# verify the environment the extension didn't break anything |
56 |
| -_(sys.executable, "-m", "pip", "check") |
| 35 | +_(sys.executable, "-m", "pip", "install", ".") |
57 | 36 |
|
58 | 37 | # list the extensions
|
59 | 38 | _("jupyter", "server", "extension", "list")
|
|
0 commit comments