forked from LiberTEM/LiberTEM
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.py
139 lines (120 loc) · 3.68 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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
import re
import os
import codecs
import distutils
import subprocess
from setuptools import setup
class BuildClientCommand(distutils.cmd.Command):
description = 'build the js client'
user_options = []
def initialize_options(self):
pass
def finalize_options(self):
pass
def run(self):
cwd = os.path.dirname(__file__)
cwd_client = os.path.join(cwd, 'client')
self.announce(
"building js client",
level=distutils.log.INFO
)
for command in [['npm', 'install'],
['npm', 'run-script', 'build']]:
subprocess.check_call(command, cwd=cwd_client)
self.run_command('copy_client')
class CopyClientCommand(distutils.cmd.Command):
description = 'copy the js client'
user_options = []
def initialize_options(self):
pass
def finalize_options(self):
pass
def run(self):
cwd = os.path.dirname(__file__)
cwd_client = os.path.join(cwd, 'client')
client = os.path.join(cwd, 'src', 'libertem', 'web', 'client')
cmd = ["rm", "-rf", client]
self.announce(
"preparing output directory: %s" % cmd,
level=distutils.log.INFO
)
subprocess.check_call(cmd)
cmd = ["mkdir", client]
self.announce(
"creating output directory: %s" % cmd,
level=distutils.log.INFO
)
subprocess.check_call(cmd)
build = os.path.join(cwd_client, "build")
cmd = "cp -r %s/* %s" % (build, client)
self.announce(
"copying client: %s" % cmd,
level=distutils.log.INFO
)
subprocess.check_call(cmd, shell=True)
def read(*parts):
# intentionally *not* adding an encoding option to open, See:
# https://github.com/pypa/virtualenv/issues/201#issuecomment-3145690
here = os.path.abspath(os.path.dirname(__file__))
return codecs.open(os.path.join(here, *parts), 'r').read()
def find_version(*file_paths):
"""
"stolen" from pip's setup.py
"""
version_file = read(*file_paths)
version_match = re.search(r"^__version__ = ['\"]([^'\"]*)['\"]",
version_file, re.M)
if version_match:
return version_match.group(1)
raise RuntimeError("Unable to find version string.")
setup(
name="libertem",
version=find_version("src", "libertem", "__init__.py"),
url="https://libertem.github.io/LiberTEM/",
author_email="[email protected]",
author="Alexander Clausen",
license='GPL v3',
include_package_data=True,
python_requires='>=3.6',
install_requires=[
"numpy",
"distributed",
"click",
"tornado",
"matplotlib",
"pillow",
"h5py",
"psutil",
],
extras_require={
'hdfs': 'hfds3',
},
package_dir={"": "src"},
packages=[
"libertem",
"libertem.common",
"libertem.io",
"libertem.io.dataset",
"libertem.executor",
"libertem.job",
"libertem.web",
],
entry_points={
'console_scripts': [
'libertem-ingest=libertem.io.ingest.cli:main',
'libertem-server=libertem.web.cli:main',
]
},
cmdclass={
'build_client': BuildClientCommand,
'copy_client': CopyClientCommand,
},
classifiers=[
'Programming Language :: Python :: 3.6',
'License :: OSI Approved :: GNU General Public License v3 (GPLv3)',
'License :: OSI Approved :: MIT License',
'Operating System :: POSIX :: Linux',
'Operating System :: MacOS :: MacOS X',
'Operating System :: Microsoft :: Windows',
],
)