Skip to content

Commit ee15d88

Browse files
committed
Update repo-detection
1 parent cb8eefe commit ee15d88

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

jupyterlab_widgets/setup.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
from jupyter_packaging import (
77
create_cmdclass, install_npm, ensure_targets,
88
combine_commands, ensure_python, get_version,
9+
skip_if_exists
910
)
1011
import setuptools
1112

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

57-
cmdclass["jsdeps"] = combine_commands(*jsbuild)
58+
is_repo = os.path.exists(os.path.join(HERE, os.pardir, ".git"))
59+
if is_repo:
60+
cmdclass["jsdeps"] = js_command
61+
else:
62+
cmdclass["jsdeps"] = skip_if_exists(jstargets, js_command)
5863

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

0 commit comments

Comments
 (0)