|
1 | 1 | import os
|
2 |
| -from glob import glob |
3 | 2 |
|
4 | 3 | import setuptools
|
5 | 4 | from jupyter_packaging import combine_commands
|
6 | 5 | from jupyter_packaging import create_cmdclass
|
7 | 6 | from jupyter_packaging import ensure_targets
|
8 |
| -from jupyter_packaging import get_version |
9 | 7 | from jupyter_packaging import install_npm
|
| 8 | +from jupyter_packaging import skip_if_exists |
10 | 9 |
|
11 | 10 | # The directory containing this file
|
12 | 11 | HERE = os.path.abspath(os.path.dirname(__file__))
|
|
20 | 19 | nb_path = os.path.join(HERE, PACKAGE_NAME, "static")
|
21 | 20 |
|
22 | 21 | # Representative files that should exist after a successful build
|
23 |
| -jstargets = [ |
24 |
| - os.path.join(src_path, "lib", "index.js"), |
25 |
| - os.path.join(lab_path, "package.json"), |
26 |
| -] |
| 22 | +jstargets = [os.path.join(lab_path, "package.json")] |
27 | 23 |
|
28 | 24 | package_data_spec = {PACKAGE_NAME: ["*"]}
|
29 | 25 |
|
|
55 | 51 | "jsdeps", package_data_spec=package_data_spec, data_files_spec=data_files_spec
|
56 | 52 | )
|
57 | 53 |
|
58 |
| -cmdclass["jsdeps"] = combine_commands( |
| 54 | +js_command = combine_commands( |
59 | 55 | install_npm(src_path, build_cmd="build:prod", npm=["jlpm"]),
|
60 | 56 | ensure_targets(jstargets),
|
61 | 57 | )
|
62 | 58 |
|
| 59 | +is_repo = os.path.exists(os.path.join(HERE, ".git")) |
| 60 | +if is_repo: |
| 61 | + cmdclass["jsdeps"] = js_command |
| 62 | +else: |
| 63 | + cmdclass["jsdeps"] = skip_if_exists(jstargets, js_command) |
| 64 | + |
63 | 65 | with open("README.md", "r") as fh:
|
64 | 66 | long_description = fh.read()
|
65 | 67 |
|
|
0 commit comments