Skip to content

Commit e4a1b94

Browse files
committed
Do not build the js assets if the static directory is populated.
In making the conda-forge package, we realized when building a wheel from the sdist package did not work. NodeJS compilation really only works in the context of this repo. This change makes it so that static assets are not rebuilt in the setup.py commands if they already exist.
1 parent ec47e33 commit e4a1b94

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)