forked from SteveDoyle2/pyNastran
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.py
242 lines (208 loc) · 7.58 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
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
#!/usr/bin/env python
import os
import sys
from setuptools import setup, find_packages
PY2 = False
if sys.version_info < (3, 0):
PY2 = True
if sys.version_info < (2, 7, 7): # 2.7.13 used
imajor, minor1, minor2 = sys.version_info[:3]
# makes sure we don't get the following bug:
# Issue #19099: The struct module now supports Unicode format strings.
sys.exit('Upgrade your Python to >= 2.7.7; version=(%s.%s.%s)' % (imajor, minor1, minor2))
import pyNastran
packages = find_packages()+['gui/icons/*.*']
#print "packages = ",packages
#sys.exit()
py2_gui_scripts = []
py2_packages = []
py3_gui_scripts = []
py3_packages = []
is_dev = (
'TRAVIS' in os.environ or
'APPVEYOR' in os.environ or
'READTHEDOCS' in os.environ
)
is_travis = 'TRAVIS' in os.environ
is_rtd = 'READTHEDOCS' in os.environ
if sys.version_info <= (3,) or not is_dev:
try:
import vtk
vtk_version = '.'.join(vtk.VTK_VERSION.split('.'))
if vtk_version < '5.10.1':
print("vtk.VTK_VERSION = %r < '5.10.1'" % vtk.VTK_VERSION)
py2_packages.append('vtk >= 5.10.1')
except ImportError:
py2_packages.append('vtk >= 5.10.1') # 6.3.0 used
py2_packages += [
##'dill'
]
py3_packages += [
#'pillow >= 2.7.0',
##'dill'
]
py_packages = []
if is_rtd:
py_packages.append('numpy')
else:
try:
#import numpy as np
#ver = np.lib.NumpyVersion(np.__version__)
#if ver < '1.11.0':
#print("np.__version__ = %r < '1.11.0'" % np.__version__)
#py_packages.append('numpy >= 1.11.0')
py_packages.append('numpy >= 1.11.0') # ,<1.13.0
except ImportError:
py_packages.append('numpy >= 1.11.0') # ,<1.13.0
try:
import scipy
ver = scipy.version.short_version
if ver < '0.18.1':
print("scipy.version.short_version = %r < '0.18.1'" % scipy.version.short_version)
py_packages.append('scipy >= 0.17.0')
except ImportError:
py_packages.append('scipy >= 0.18.1') # 0.18.1 used
try:
import six
sver = [int(val) for val in six.__version__.split('-')[0].split('.')]
if sver < [1, 10, 0]:
print("six.__version__ = %r < '1.10.0'" % six.__version__)
py_packages.append('six >= 1.10.0')
except ImportError:
py_packages.append('six >= 1.10.0') # 1.10.0 used
try:
import matplotlib
sver = [int(val) for val in matplotlib.__version__.split('-')[0].split('.')]
if sver < [1, 5, 1]:
print("matplotlib.__version__ = %r < '1.5.1'" % matplotlib.__version__)
py_packages.append('matplotlib >= 1.5.1')
except ImportError:
py_packages.append('matplotlib >= 1.5.1') # 2.0.2 used
try:
import docopt
sver = [int(val) for val in docopt.__version__.split('-')[0].split('.')]
if sver != [0, 6, 2]:
#if docopt.__version__ != '0.6.2':
print("docopt.__version__ = %r != '0.6.2'" % docopt.__version__)
py_packages.append('docopt == 0.6.2')
except ImportError:
py_packages.append('docopt == 0.6.2') # 0.6.2 used
try:
import qtpy
sver = [int(val) for val in qtpy.__version__.split('-')[0].split('.')]
if sver < [1, 3, 1]:
print("qtpy.__version__ = %r < '1.3.1'" % qtpy.__version__)
py_packages.append('qtpy >= 1.3.1')
except ImportError:
py_packages.append('qtpy >= 1.3.1') # 1.3.1 used
try:
import typing
except ImportError:
py_packages.append('typing >= 3.6.1') # 3.6.1 used
if PY2:
try:
import pathlib2
except ImportError:
py_packages.append('pathlib2 >= 2.2.0') # 2.2.0 used
try:
import scandir
sver = [int(val) for val in scandir.__version__.split('-')[0].split('.')]
if sver < [1, 4, 0]:
print("scandir.__version__ = %r < '1.4.0'" % scandir.__version__)
py_packages.append('scandir >= 1.4.0')
except ImportError:
py_packages.append('scandir >= 1.4.0') # 1.4.0 used
try:
import imageio
if imageio.__version__ < '2.2.0':
#print("imageio.version = %r < '2.2.0'" % imageio.__version__)
py_packages.append('imageio >= 2.2.0')
except ImportError:
py_packages.append('imageio >= 2.2.0')
#py_packages = [
# 'numpy >= 1.9.2',
# 'scipy >= 0.16.0, scipy < 0.18.0',
#]
is_windows = 'nt' in os.name
if is_travis and not is_windows:
py_packages.append('python-coveralls')
#py_packages.append('codecov')
#py_packages.append('coverage')
install_requires = py_packages + [
# -*- Extra requirements: -*-
#'docopt == 0.6.2',
##'matplotlib >= 1.3.0',
#'six >= 1.9.0',
##'cython',
] + py2_packages + py3_packages,
# set up all icons
icon_path = os.path.join('pyNastran', 'gui', 'icons')
icon_files = os.listdir(icon_path)
icon_files2 = []
for icon_file in icon_files:
if icon_file.endswith('.png'):
icon_files2.append(os.path.join(icon_path, icon_file))
exclude_words = [
'pyNastran.dev.bdf_vectorized', 'pyNastran.dev.bdf_vectorized.cards',
'pyNastran.f06.dev',
'pyNastran.op2.dev', 'pyNastran.op2.dev.original',
'pyNastran.converters.dev', 'pyNastran.xdb',]
packages = find_packages(exclude=['ez_setup', 'examples', 'tests'] + exclude_words)
for exclude_word in exclude_words:
packages = [package for package in packages if exclude_word not in package]
#print(packages, len(packages)) # 83
setup(
name='pyNastran',
version=pyNastran.__version__,
description=pyNastran.__desc__,
long_description="""\
""",
classifiers=[
'Natural Language :: English',
'Intended Audience :: Science/Research',
'License :: OSI Approved :: BSD License (BSD-3)',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
], # Get strings from http://pypi.python.org/pypi?%3Aaction=list_classifiers
keywords='',
author=pyNastran.__author__,
author_email=pyNastran.__email__,
url=pyNastran.__website__,
license=pyNastran.__license__,
packages=packages,
include_package_data=True,
zip_safe=False,
install_requires=install_requires,
#{'': ['license.txt']}
#package_data={'': ['*.png']},
#data_files=[(icon_path, icon_files2)],
package_data={
# https://pythonhosted.org/setuptools/setuptools.html#including-data-files
# If any package contains *.png files, include them:
'': ['*.png'],
#'mypkg': ['data/*.dat'],
},
entry_points={
'console_scripts': [
'run_nastran_double_precision = pyNastran.bdf.test.run_nastran_double_precision:cmd_line',
'test_bdf = pyNastran.bdf.test.test_bdf:main',
'test_op2 = pyNastran.op2.test.test_op2:main',
'test_op4 = pyNastran.op4.test.test_op4:main',
'test_abaqus = pyNastran.converters.abaqus.test_abaqus:main',
'test_pynastrangui = pyNastran.gui.test.test_gui:main',
#'test_f06 = pyNastran.f06.test.test_f06:main',
'format_converter = pyNastran.converters.type_converter:main',
'pyNastranGUI = pyNastran.gui.gui:cmd_line',
'bdf = pyNastran.bdf.mesh_utils.utils:cmd_line',
'f06 = pyNastran.f06.utils:cmd_line',
#'pyNastranv = pyNastran.dev.bdf_vectorized.solver.solver:main',
#'test_bdfv = pyNastran.dev.bdf_vectorized.test.test_bdf_vectorized2:main',
#'nastran_to_code_aster = pyNastran.converters.dev.code_aster.nastran_to_code_aster:main',
]
},
test_suite='pyNastran.all_tests',
)