forked from jupyrdf/ipyelk
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.py
More file actions
46 lines (36 loc) · 1.2 KB
/
setup.py
File metadata and controls
46 lines (36 loc) · 1.2 KB
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
# Copyright (c) 2021 Dane Freeman.
# Distributed under the terms of the Modified BSD License.
import re
from pathlib import Path
import setuptools
HERE = Path(__file__).parent
EXT = HERE / "py_src" / "ipyelk" / "labextension"
EXT_NAME = "@jupyrdf/jupyter-elk"
EXT_FILES = {}
SHARE = f"share/jupyter/labextensions/{EXT_NAME}"
for ext_path in [EXT] + [d for d in EXT.rglob("*") if d.is_dir()]:
if ext_path == EXT:
target = str(SHARE)
else:
target = f"{SHARE}/{ext_path.relative_to(EXT)}"
EXT_FILES[target] = [
str(p.relative_to(HERE).as_posix())
for p in ext_path.glob("*")
if not p.is_dir()
]
ALL_FILES = sum(EXT_FILES.values(), [])
assert (
len([p for p in ALL_FILES if "remoteEntry" in str(p)]) == 1
), "expected _exactly one_ remoteEntry.*.js"
EXT_FILES[str(SHARE)] += ["install.json"]
if __name__ == "__main__":
setuptools.setup(
version=re.findall(
r'''__version__ = "([^"]+)"''',
(HERE / "py_src/ipyelk/_version.py").read_text(encoding="utf-8"),
)[0],
data_files=[
("", ["third-party/epl-v10.html", "COPYRIGHT.md"]),
*[(k, v) for k, v in EXT_FILES.items()],
],
)