-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.py
70 lines (61 loc) · 2.25 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
import ast
from pathlib import Path
from setuptools import find_packages, setup
PACKAGE_NAME = 'sparpy'
path = Path(Path(__file__).parent, PACKAGE_NAME, '__init__.py')
with open(path, 'r') as file:
t = compile(file.read(), str(path), 'exec', ast.PyCF_ONLY_AST)
for node in (n for n in t.body if isinstance(n, ast.Assign)):
if len(node.targets) != 1:
continue
name = node.targets[0]
if not isinstance(name, ast.Name) or \
name.id not in ('__version__', '__version_info__', 'VERSION'):
continue
v = node.value
if isinstance(v, ast.Str):
version = v.s
break
if isinstance(v, ast.Tuple):
r = []
for e in v.elts:
if isinstance(e, ast.Str):
r.append(e.s)
elif isinstance(e, ast.Num):
r.append(str(e.n))
version = '.'.join(r)
break
with Path(Path(__file__).parent, 'requirements.txt').open() as f:
requirements = [l.strip()
for l in f.readlines()
if len(l.strip()) and not (l.strip().startswith('-') or l.strip().startswith('#'))]
# Get the long description from the README file
with Path(Path(__file__).parent, 'README.rst').open(encoding='utf-8') as f:
long_description = f.read()
setup(
name='sparpy',
version=version,
description='A Spark entry point for python',
long_description=long_description,
url='https://github.com/alfred82santa/sparpy',
author='Alfred Santacatalina',
classifiers=[
'Development Status :: 4 - Beta',
'Intended Audience :: Developers',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
],
packages=find_packages(exclude=['tests'], include=['sparpy*']),
install_requires=requirements,
extras_require={'base': ['pkginfo']},
zip_safe=False,
entry_points={
'console_scripts': [
'sparpy=sparpy.cli:run_sparpy',
'sparpy-runner=sparpy.cli:run_sparpy_runner',
'sparpy-submit=sparpy.cli:run_sparpy_submit',
'sparpy-download=sparpy.cli:run_sparpy_download',
'isparpy=sparpy.cli:run_isparpy',
]
}
)