forked from jupyter-server/jupyter-resource-usage
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
54 lines (43 loc) · 1.67 KB
/
setup.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
from pathlib import Path
import setuptools
# The directory containing this file
HERE = Path(__file__).parent.resolve()
# The name of the project
NAME = "jupyter-resource-usage"
PACKAGE_NAME = NAME.replace("-", "_")
LABEXT_NAME = "@jupyter-server/resource-usage"
NBEXT_NAME = "jupyter_resource_usage"
lab_path = HERE / PACKAGE_NAME / "labextension"
nb_path = HERE / PACKAGE_NAME / "static"
src_path = HERE / "packages" / "labextension"
# Representative files that should exist after a successful build
ensured_targets = [str(lab_path / "package.json"), str(lab_path / "static/style.js")]
data_files_spec = [
("share/jupyter/nbextensions/%s" % NBEXT_NAME, nb_path, "**"),
("share/jupyter/labextensions/%s" % LABEXT_NAME, lab_path, "**"),
("share/jupyter/labextensions/%s" % LABEXT_NAME, HERE, "install.json"),
(
"etc/jupyter/jupyter_server_config.d",
"jupyter-config/jupyter_server_config.d",
"jupyter_resource_usage.json",
),
(
"etc/jupyter/jupyter_notebook_config.d",
"jupyter-config/jupyter_notebook_config.d",
"jupyter_resource_usage.json",
),
(
"etc/jupyter/nbconfig/notebook.d",
"jupyter-config/nbconfig/notebook.d",
"jupyter_resource_usage.json",
),
]
try:
from jupyter_packaging import wrap_installers, npm_builder, get_data_files
builder = npm_builder(build_cmd="build:prod", npm="jlpm", force=True)
cmdclass = wrap_installers(post_develop=builder, ensured_targets=ensured_targets)
setup_args = dict(cmdclass=cmdclass, data_files=get_data_files(data_files_spec))
except ImportError:
setup_args = dict()
if __name__ == "__main__":
setuptools.setup(**setup_args)