forked from jupyter-lsp/jupyterlab-lsp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.py
48 lines (39 loc) · 1.23 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
import json
import re
from pathlib import Path
import setuptools
LABEXTENSIONS_DIR = Path("jupyterlab_lsp/labextensions")
LABEXTENSIONS_INSTALL_DIR = Path("share") / "jupyter" / "labextensions"
LAB_PACKAGE_PATH = (
LABEXTENSIONS_DIR / "@jupyter-lsp" / "jupyterlab-lsp" / "package.json"
)
def get_data_files():
extension_files = [
(
str(LABEXTENSIONS_INSTALL_DIR / file.relative_to(LABEXTENSIONS_DIR).parent),
[str(file.as_posix())],
)
for file in LABEXTENSIONS_DIR.rglob("*.*")
]
extension_files.append(
(
str(LABEXTENSIONS_INSTALL_DIR / "@jupyter-lsp" / "jupyterlab-lsp"),
["jupyterlab_lsp/install.json"],
)
)
return extension_files
_version = json.loads(LAB_PACKAGE_PATH.read_text(encoding="utf-8"))["version"]
_release = re.findall(
r"""__release__ = "([^"]*)"$""",
(Path(__file__).parent / "jupyterlab_lsp" / "_version.py").read_text(
encoding="utf-8"
),
flags=re.MULTILINE,
)[0]
setuptools.setup(
version=f"{_version}{_release}",
data_files=get_data_files(),
# explicit name as a workaround for GitHub dependency analyzer
# not discovering Python packages otherwise
name="jupyterlab-lsp",
)