forked from ankostis/rdechecker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.py
More file actions
191 lines (167 loc) · 5.46 KB
/
setup.py
File metadata and controls
191 lines (167 loc) · 5.46 KB
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
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
#! python
#
import io
import os
import re
import sys
from setuptools import setup, find_packages
if sys.version_info < (3, 4):
msg = "Sorry, Python >= 3.4 is required, but found: {}"
sys.exit(msg.format(sys.version_info))
proj_name = 'rdechecker'
mydir = os.path.dirname(__file__)
# Version-trick to have version-info in a single place,
# taken from: http://stackoverflow.com/questions/2058802/how-can-i-get-the-version-defined-in-setup-py-setuptools-in-my-package
##
def read_project_version():
fglobals = {}
with io.open(os.path.join(
mydir, 'rdechecker', '_version.py'), encoding='UTF-8') as fd:
exec(fd.read(), fglobals) # To read __version__
return fglobals['__version__']
def read_text_lines(fname):
with io.open(os.path.join(mydir, fname)) as fd:
return fd.readlines()
def yield_rst_only_markup(lines):
"""
:param file_inp: a `filename` or ``sys.stdin``?
:param file_out: a `filename` or ``sys.stdout`?`
"""
substs = [
# Selected Sphinx-only Roles.
#
(r':abbr:`([^`]+)`', r'\1'),
(r':ref:`([^`]+)`', r'ref: *\1*'),
(r':term:`([^`]+)`', r'**\1**'),
(r':dfn:`([^`]+)`', r'**\1**'),
(r':(samp|guilabel|menuselection|doc|file):`([^`]+)`',
r'``\2``'),
# Sphinx-only roles:
# :foo:`bar` --> foo(``bar``)
# :a:foo:`bar` XXX afoo(``bar``)
#
#(r'(:(\w+))?:(\w+):`([^`]*)`', r'\2\3(``\4``)'),
#(r':(\w+):`([^`]*)`', r'\1(`\2`)'),
# emphasis
# literal
# code
# math
# pep-reference
# rfc-reference
# strong
# subscript, sub
# superscript, sup
# title-reference
# Sphinx-only Directives.
#
(r'\.\. doctest', r'code-block'),
(r'\.\. module', r'code-block'),
(r'\.\. plot::', r'.. '),
(r'\.\. seealso', r'info'),
(r'\.\. glossary', r'rubric'),
(r'\.\. figure::', r'.. '),
(r'\.\. image::', r'.. '),
(r'\.\. dispatcher', r'code-block'),
# Other
#
(r'\|version\|', r'x.x.x'),
(r'\|today\|', r'x.x.x'),
(r'\.\. include:: AUTHORS', r'see: AUTHORS'),
]
regex_subs = [(re.compile(regex, re.IGNORECASE), sub)
for (regex, sub) in substs]
def clean_line(line):
try:
for (regex, sub) in regex_subs:
line = regex.sub(sub, line)
except Exception as ex:
print("ERROR: %s, (line(%s)" % (regex, sub))
raise ex
return line
for line in lines:
yield clean_line(line)
proj_ver = read_project_version()
readme_lines = read_text_lines('README.rst')
description = readme_lines[1]
long_desc = ''.join(yield_rst_only_markup(readme_lines))
download_url = 'https://github.com/JRCSTU/rdechecker/releases/tag/v%s' % proj_ver
setup(
name=proj_name,
version=proj_ver,
description="A CRUD application for hierarchical folder metadata based on a JSON-schema & YAML.",
long_description=long_desc,
download_url=download_url,
keywords="Real-Driving-Emissions monitoring files validator".split(),
url='https://github.com/JRCSTU/rdechecker/',
license='EUPL 1.1+',
author='Kostis Anagnostopoulos',
author_email='ankostis@gmail.com',
classifiers=[
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.5",
"Programming Language :: Python :: Implementation :: CPython",
"Development Status :: 3 - Alpha",
'Natural Language :: English',
"Intended Audience :: Developers",
"Intended Audience :: Science/Research",
"Intended Audience :: Science/Research",
"Intended Audience :: Manufacturing",
'Environment :: Console',
'License :: OSI Approved :: European Union Public Licence 1.1 (EUPL 1.1)',
'Natural Language :: English',
"Operating System :: MacOS :: MacOS X",
"Operating System :: Microsoft :: Windows",
"Operating System :: POSIX",
"Operating System :: Unix",
"Operating System :: OS Independent",
"Topic :: Text Processing :: General",
"Topic :: Scientific/Engineering",
"Topic :: Utilities",
],
setup_requires=[
# PEP426-field actually not used by `pip`, hence
# included also in /requirements/developmnet.pip.
'setuptools',
'setuptools-git>=0.3', # Example given like that in PY docs.
'wheel',
],
# dev_requires=[
# # PEP426-field actually not used by `pip`, hence
# # included in /requirements/developmnet.pip.
# 'sphinx',
# ],
install_requires=[
'rainbow_logging_handler',
'docopt',
'ruamel.yaml',
'strict-rfc3339', # for date-tie schema parsing
'boltons',
'toolz',
],
packages=find_packages(exclude=[
'tests', 'tests.*',
'doc', 'doc.*',
]),
package_data={
'rdechecker': [
'*.yaml',
'*.ipynb',
]
},
include_package_data=True,
zip_safe=True,
test_suite='nose.collector',
tests_require=['nose>=1.0', 'ddt'],
entry_points={
'console_scripts': [
'rdechek = %(p)s.__main__:main' % {'p': proj_name},
],
},
options={
'bdist_wheel': {
'universal': True,
},
},
platforms=['any'],
)