notebook/setup.py

56 lines
1.5 KiB
Python
Raw Normal View History

# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.
from pathlib import Path
2020-12-04 21:15:41 +08:00
import setuptools
HERE = Path(__file__).parent.resolve()
2020-12-04 21:15:41 +08:00
# The name of the project
NAME = "retrolab"
2020-12-10 05:56:09 +08:00
labext_name = "@retrolab/lab-extension"
lab_extension_dest = HERE / NAME / "labextension"
main_bundle_dest = HERE / NAME / "static"
2020-12-07 23:37:15 +08:00
# Representative files that should exist after a successful build
ensured_targets = [
str(lab_extension_dest / "static" / "style.js"),
str(main_bundle_dest / "bundle.js"),
2020-12-07 23:37:15 +08:00
]
data_files_spec = [
("share/jupyter/labextensions/%s" % labext_name, str(lab_extension_dest), "**"),
("share/jupyter/labextensions/%s" % labext_name, str(HERE), "install.json"),
2021-10-31 05:32:36 +08:00
('share/jupyter/lab/schemas', f'{NAME}/schemas', '@retrolab/**'),
2020-12-07 23:37:15 +08:00
(
"etc/jupyter/jupyter_server_config.d",
"jupyter-config/jupyter_server_config.d",
"retrolab.json",
2020-12-07 23:37:15 +08:00
),
(
"etc/jupyter/jupyter_notebook_config.d",
"jupyter-config/jupyter_notebook_config.d",
"retrolab.json",
),
2020-12-07 23:37:15 +08:00
]
try:
from jupyter_packaging import wrap_installers, npm_builder, get_data_files
# In develop mode, just run yarn
builder = npm_builder(build_cmd='build', npm='jlpm', force=True)
cmdclass = wrap_installers(post_develop=builder, ensured_targets=ensured_targets)
2020-12-04 21:15:41 +08:00
setup_args = dict(
cmdclass=cmdclass,
data_files=get_data_files(data_files_spec)
)
except ImportError:
setup_args = dict()
2020-12-04 21:15:41 +08:00
if __name__ == "__main__":
setuptools.setup(**setup_args)