-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathsetup.py
77 lines (60 loc) · 1.96 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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
import os
import sys
from setuptools import setup
from setuptools.command.develop import develop
from distutils import cmd
template = ['template', 'static']
share_voila_target = ['share', 'jupyter', 'voila', 'templates', 'ipypopout']
class DevelopCmd(develop):
def run(self):
if '--user' in sys.prefix:
raise NotImplemented('--user not supported')
link_target = os.path.join(sys.prefix, *share_voila_target)
print('linking', os.path.abspath(template[0]), '->', link_target)
os.symlink(os.path.abspath(template[0]), os.path.abspath(link_target))
super(DevelopCmd, self).run()
class CleanDevelop(cmd.Command):
user_options = []
def finalize_options(self) -> None:
pass
def initialize_options(self) -> None:
pass
def run(self):
os.unlink(os.path.join(sys.prefix, *share_voila_target))
def get_data_files(target, src):
files = [(os.path.join(target, os.path.relpath(dirpath, src)),
[os.path.join(dirpath, name) for name in filenames])
for (dirpath, _, filenames) in os.walk(src)]
return files
here = os.path.dirname(__file__)
version_ns = {}
with open(os.path.join(here, 'ipypopout', '_version.py')) as f:
exec(f.read(), {}, version_ns)
setup(
name='ipypopout',
version=version_ns['__version__'],
author='Mario Buikhuizen',
author_email='[email protected]',
url='https://github.com/mariobuikhuizen/ipypopout',
packages=['ipypopout'],
install_requires=[
'ipywidgets>=7.7',
'ipyvuetify>=1.7.0,<2',
],
extras_require={
"test": [
"solara[pytest]",
],
"voila": [
'voila>=0.2.10,<0.5'
],
"solara": [
'solara-server>=1.40.0'
]
},
data_files=get_data_files(os.path.join(*share_voila_target), os.path.join(template[0])),
cmdclass={
'develop': DevelopCmd,
'clean_develop': CleanDevelop
}
)