Skip to content

Commit

Permalink
Catch errors for jupyter-packaging (#83)
Browse files Browse the repository at this point in the history
* try except in setup

* added print statement

* updated print
  • Loading branch information
jakeatgalileo authored Apr 19, 2021
1 parent c91e8cd commit 47d3ac3
Showing 1 changed file with 30 additions and 25 deletions.
55 changes: 30 additions & 25 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,6 @@
import json
from pathlib import Path

from jupyter_packaging import (
create_cmdclass,
install_npm,
ensure_targets,
combine_commands,
skip_if_exists
)
import setuptools

HERE = Path(__file__).parent.resolve()
Expand All @@ -35,27 +28,39 @@

labext_name = "luxwidget"

data_files_spec = [
try:
from jupyter_packaging import (
create_cmdclass,
install_npm,
ensure_targets,
combine_commands,
skip_if_exists
)
data_files_spec = [
("share/jupyter/labextensions/%s" % labext_name, str(lab_path), "**"),
("share/jupyter/labextensions/%s" % labext_name, str(HERE), "install.json"),
("share/jupyter/nbextensions/%s" % name, str(nb_path), '**'),
]

cmdclass = create_cmdclass("jsdeps",
package_data_spec=package_data_spec,
data_files_spec=data_files_spec
)

js_command = combine_commands(
install_npm(HERE, build_cmd="build:prod", npm=["jlpm"]),
ensure_targets(jstargets),
)

is_repo = (HERE / ".git").exists()
if is_repo:
cmdclass["jsdeps"] = js_command
else:
cmdclass["jsdeps"] = skip_if_exists(jstargets, js_command)
]

cmdclass = create_cmdclass("jsdeps",
package_data_spec=package_data_spec,
data_files_spec=data_files_spec
)

js_command = combine_commands(
install_npm(HERE, build_cmd="build:prod", npm=["jlpm"]),
ensure_targets(jstargets),
)

is_repo = (HERE / ".git").exists()
if is_repo:
cmdclass["jsdeps"] = js_command
else:
cmdclass["jsdeps"] = skip_if_exists(jstargets, js_command)

except ImportError:
print("jupyter-packaging is not installed. Please install via 'pip install jupyter-packaging'.")
cmdclass = {}

long_description = (HERE / "README.md").read_text()

Expand Down

0 comments on commit 47d3ac3

Please sign in to comment.