-
Notifications
You must be signed in to change notification settings - Fork 8
/
setup.py
executable file
·64 lines (50 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
62
63
64
"""
Python API for shell scripts
"""
import ast
import os
from setuptools import setup, find_packages
PROJECT_ROOT = os.path.dirname(__file__)
class VersionFinder(ast.NodeVisitor):
def __init__(self):
self.version = None
def visit_Assign(self, node):
try:
if node.targets[0].id == '__version__':
self.version = node.value.s
except:
pass
def read_version():
"""Read version from shellfuncs/__init__.py without loading any files"""
finder = VersionFinder()
path = os.path.join(PROJECT_ROOT, 'shellfuncs', '__init__.py')
with open(path, 'r') as fp:
file_data = fp.read().encode('utf-8')
finder.visit(ast.parse(file_data))
return finder.version
tests_require = ['pytest']
if __name__ == '__main__':
setup(name='shellfuncs',
version=read_version(),
license='MIT',
description='Python API for shell scripts',
url='https://github.com/timofurrer/shellfuncs',
author='Timo Furrer',
author_email='tuxtimo@gmail.com',
include_package_data=True,
packages=find_packages(exclude=['*tests*']),
install_requires=[],
tests_require=tests_require,
classifiers=[
'Development Status :: 5 - Production/Stable',
'Environment :: Console',
'Operating System :: MacOS :: MacOS X',
'Operating System :: POSIX',
'Operating System :: POSIX :: Linux',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: Implementation',
'Programming Language :: Python :: Implementation :: CPython',
]
)