-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.py
61 lines (51 loc) · 1.81 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
55
56
57
58
59
60
61
from pathlib import Path
import os
from setuptools import setup
from setuptools.command.develop import develop
class DevelopCmd(develop):
prefix_targets = [
("nbconvert/templates", "sepal-ui-base"),
("voila/templates", "sepal-ui-base"),
]
def run(self):
target_dir = Path().home() / ".local/share/jupyter"
for prefix_target, name in self.prefix_targets:
source = os.path.join("share", "jupyter", prefix_target, name)
target = os.path.join(target_dir, prefix_target, name)
target_subdir = os.path.dirname(target)
if not os.path.exists(target_subdir):
os.makedirs(target_subdir)
rel_source = os.path.relpath(
os.path.abspath(source), os.path.abspath(target_subdir)
)
try:
os.remove(target)
except: # noqa: E722
pass
print(rel_source, "->", target)
os.symlink(rel_source, target)
super(DevelopCmd, self).run()
# WARNING: all files generates during setup.py will not
# end up in the source distribution
data_files = []
# Add all the templates
for dirpath, dirnames, filenames in os.walk("share/jupyter/"):
if filenames:
data_files.append(
(dirpath, [os.path.join(dirpath, filename) for filename in filenames])
)
setup(
name="voila-sepal-ui",
description="A sepal-ui template for Voila",
data_files=data_files,
install_requires=["voila>=0.4.1,<0.5"],
version="0.5.2",
include_package_data=True,
author="Daniel Guerrero Machado",
author_email="[email protected]",
url="https://github.com/dfguerrerom/voila-sepal-ui",
keywords=["ipython", "jupyter", "widgets", "voila", "sepal-ui"],
cmdclass={
"develop": DevelopCmd,
},
)