forked from norok2/flyingcircus_numeric
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
183 lines (143 loc) · 5.46 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
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
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Setup instructions.
See: https://packaging.python.org/en/latest/distributing.html
"""
# ======================================================================
# :: Future Imports (for Python 2)
from __future__ import (
division, absolute_import, print_function)
# BUG in setuptools if import unicode_literals
# ======================================================================
# :: Python Standard Library Imports
import os # Miscellaneous operating system interfaces
import re # Regular expression operations
from codecs import open # use a consistent encoding (in Python 2)
# ======================================================================
# :: Choice of the setup tools
from setuptools import setup
from setuptools import find_packages
# ======================================================================
# project specific variables
NAME = 'FlyingCircus_Numeric'
VERSION_FILEPATH = os.path.join(NAME.lower(), '_version.py')
README_FILEPATH = 'README.rst'
# get the working directory for the setup script
CWD = os.path.realpath(os.path.dirname(__file__))
# get the long description from the README file
with open(os.path.join(CWD, README_FILEPATH), encoding='utf-8') as readme_file:
LONG_DESCRIPTION_TEXT = readme_file.read()
# ======================================================================
def fix_version(
version=None,
source_filepath=VERSION_FILEPATH):
"""
Fix version in source code.
Args:
version (str): version to be used for fixing the source code
source_filepath (str): Path to file where __version__ is located
Returns:
version (str): the actual version text used
"""
def dummy_version():
return '0.0.0.0'
if version is None:
try:
from setuptools_scm import get_version
except ImportError:
get_version = dummy_version
version = get_version()
if not os.path.isfile(source_filepath):
version_template = \
'#!/usr/bin/env python3\n' \
'# -*- coding: utf-8 -*-\n' \
'"""Package version file."""\n' \
'# This file is automatically generated by `fix_version()`' \
' in the setup script.\n' \
'__version__ = \'{version}\'\n'.format(version=version)
with open(source_filepath, 'wb') as io_file:
io_file.write(version_template.encode('utf-8'))
else:
with open(source_filepath, 'rb') as io_file:
source = io_file.read().decode('utf-8')
source = re.sub(
r"__version__ = '.*'",
"__version__ = '{}'".format(version),
source, flags=re.UNICODE)
with open(source_filepath, 'wb') as io_file:
io_file.write(source.encode('utf-8'))
return version
# ======================================================================
# :: call the setup tool
setup(
name=NAME.lower(),
description='FlyingCircus with NumPy/SciPy.',
long_description=LONG_DESCRIPTION_TEXT,
version=fix_version(),
url='https://github.com/norok2/' + NAME.lower(),
author='Riccardo Metere',
author_email='[email protected]',
license='GPLv3+',
# See https://pypi.python.org/pypi?%3Aaction=list_classifiers
classifiers=[
'Development Status :: 3 - Alpha',
'Environment :: Console',
'Environment :: Other Environment',
'Intended Audience :: Developers',
'Intended Audience :: Information Technology',
'Intended Audience :: System Administrators',
'Intended Audience :: Science/Research',
'License :: OSI Approved :: '
'GNU General Public License v3 or later (GPLv3+)',
'Natural Language :: English',
'Operating System :: POSIX',
'Operating System :: OS Independent',
'Programming Language :: Python',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.6',
'Topic :: Scientific/Engineering',
'Topic :: Scientific/Engineering :: Mathematics',
'Topic :: Scientific/Engineering :: Physics',
'Topic :: Scientific/Engineering :: Information Analysis',
'Topic :: Scientific/Engineering :: Visualization',
'Topic :: Software Development',
'Topic :: Software Development :: Libraries',
'Topic :: System',
'Topic :: Utilities',
],
keywords=['utils', 'misc', 'iterators', 'metaprogramming', 'science',
'mathematics', 'math', 'physics', 'format',],
packages=find_packages(exclude=['contrib', 'docs', 'tests']),
install_requires=[
'setuptools', # here to ensure proper installation
'setuptools_scm', # here to ensure proper installation
'blessed',
'appdirs',
],
setup_requires=[
'setuptools',
'setuptools_scm',
],
extras_require={
# 'blessed': 'blessed',
},
package_data={
# 'flyingcircus': [
# 'resources/icon.*',
# ],
},
include_package_data=True,
# data_files=[('share/icons', ['artwork/flyingcircus_logo.svg'])],
entry_points={
'console_scripts': [
# '<exec_name>=<module>.<submodule>:<callable>',
],
'gui_scripts': [
# '<exec_name>=<module>.<submodule>:<callable>',
],
},
)
# ======================================================================
# :: create user directory
from flyingcircus import pkg_paths