Skip to content

Commit 3530952

Browse files
committed
Update setup.py to be comatible with JL3.0
1 parent 4ff97a5 commit 3530952

File tree

1 file changed

+40
-2
lines changed

1 file changed

+40
-2
lines changed

setup.py

Lines changed: 40 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,26 @@
1515
with open("README.md", "rb") as f:
1616
long_descr = f.read().decode("utf-8")
1717

18+
HERE = Path(__file__).parent.resolve()
1819

19-
setup(
20+
# The name of the project
21+
name = "jupyterlab_gitplus"
22+
23+
24+
lab_path = (HERE / name.replace("-", "_") / "labextension")
25+
labext_name = "@reviewnb/jupyterlab_gitplus"
26+
27+
data_files_spec = [
28+
("share/jupyter/labextensions/%s" % labext_name, str(lab_path), "**"),
29+
("share/jupyter/labextensions/%s" % labext_name, str(HERE), "install.json"),
30+
("etc/jupyter/jupyter_server_config.d",
31+
"jupyter-config/server-config", "jupyterlab_gitplus.json"),
32+
# For backward compatibility with notebook server
33+
("etc/jupyter/jupyter_notebook_config.d",
34+
"jupyter-config/nb-config", "jupyterlab_gitplus.json"),
35+
]
36+
37+
setup_args = dict(
2038
name = "jupyterlab_gitplus",
2139
packages = ["jupyterlab_gitplus"],
2240
python_requires='>=3',
@@ -28,10 +46,30 @@
2846
author_email = "[email protected]",
2947
url = "https://github.com/ReviewNB/jupyterlab-gitplus",
3048
keywords=['github', 'jupyter', 'notebook', 'pull request', 'version control', 'git'],
49+
include_package_data=True,
50+
platforms="Linux, Mac OS X, Windows",
3151
install_requires=[
3252
'jupyterlab',
3353
'gitpython',
3454
'requests',
3555
'urllib3'
3656
]
37-
)
57+
)
58+
59+
60+
try:
61+
from jupyter_packaging import (
62+
wrap_installers,
63+
npm_builder,
64+
get_data_files
65+
)
66+
post_develop = npm_builder(
67+
build_cmd="install:extension", source_dir="src", build_dir=lab_path
68+
)
69+
setup_args['cmdclass'] = wrap_installers(post_develop=post_develop)
70+
setup_args['data_files'] = get_data_files(data_files_spec)
71+
except ImportError as e:
72+
pass
73+
74+
if __name__ == "__main__":
75+
setup(**setup_args)

0 commit comments

Comments
 (0)