Skip to content

Commit 019256d

Browse files
authored
Merge pull request #2991 from jasongrout/packaging
Do not rebuild jupyterlab_widgets assets if static directory exists
2 parents 6c1a3f2 + e4a1b94 commit 019256d

File tree

2 files changed

+11
-7
lines changed

2 files changed

+11
-7
lines changed

jupyterlab_widgets/MANIFEST.in

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ include ts*.json
88
graft jupyterlab_widgets/static
99

1010
# Javascript files
11-
graft src
12-
graft style
11+
prune src
12+
prune style
1313
prune **/node_modules
1414
prune lib
1515

jupyterlab_widgets/setup.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424

2525
# Representative files that should exist after a successful build
2626
jstargets = [
27-
os.path.join(HERE, "lib", "index.js"),
2827
os.path.join(HERE, name, "static", "package.json"),
2928
]
3029

@@ -46,10 +45,15 @@
4645
data_files_spec=data_files_spec
4746
)
4847

49-
cmdclass["jsdeps"] = combine_commands(
50-
install_npm(HERE, build_cmd="build", npm=["jlpm"]),
51-
ensure_targets(jstargets),
52-
)
48+
# if the static assets already exist, do not invoke npm so we can make a wheel
49+
# from the sdist package, since the npm build really only works from this
50+
# repo.
51+
jsbuild = []
52+
if all(os.path.exists(f) for f in jstargets):
53+
jsbuild.append(install_npm(HERE, build_cmd="build", npm=["jlpm"]))
54+
jsbuild.append(ensure_targets(jstargets))
55+
56+
cmdclass["jsdeps"] = combine_commands(*jsbuild)
5357

5458
with open("README.md", "r") as fh:
5559
long_description = fh.read()

0 commit comments

Comments
 (0)