This repository was archived by the owner on Jul 21, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathsetup.py
93 lines (74 loc) · 2.51 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
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"Python DSL to leverage translation of dictionaries and SQLAlchemy into Protobuf objects"
import ast
import os
from setuptools import setup, find_packages
local_file = lambda *f: open(os.path.join(os.path.dirname(__file__), *f)).read()
class VersionFinder(ast.NodeVisitor):
VARIABLE_NAME = 'version'
def __init__(self):
self.version = None
def visit_Assign(self, node):
try:
if node.targets[0].id == self.VARIABLE_NAME:
self.version = node.value.s
except:
pass
def read_version():
finder = VersionFinder()
finder.visit(ast.parse(local_file('mercator', 'version.py')))
return finder.version
def read_requirements():
return local_file('requirements.txt').splitlines()
def read_test_requirements():
return local_file('test_requirements.txt').splitlines()
def read_readme():
"""Read README content.
If the README.rst file does not exist yet
(this is the case when not releasing)
only the short description is returned.
"""
try:
return local_file('README.rst')
except IOError:
return __doc__
setup(
author='NewStore Inc.',
author_email='[email protected]',
description=read_version(),
include_package_data=True,
install_requires=read_requirements(),
long_description=read_readme(),
long_description_content_type='text/x-rst',
name='mercator',
url='https://mercator.readthedocs.io/en/latest/',
download_url='https://github.com/NewStore/mercator/releases',
packages=find_packages(exclude=['*tests*']),
test_require=read_test_requirements(),
test_suite='nose.collector',
version=read_version(),
package_data={
'mercator': [
'*.cfg',
'*.py',
'*.rst',
'*.txt',
],
},
classifiers=[
'Development Status :: 5 - Production/Stable',
'Environment :: Console',
'License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)',
'Operating System :: MacOS :: MacOS X',
'Operating System :: POSIX',
'Operating System :: POSIX :: Linux',
'Programming Language :: Python',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: Implementation',
'Programming Language :: Python :: Implementation :: CPython',
],
zip_safe=False,
)