-
Notifications
You must be signed in to change notification settings - Fork 30
/
setup.py
112 lines (100 loc) · 4.49 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
# coding = utf-8
import json
import sys
import shutil
from os import path, remove, environ
from glob import glob
from setuptools import setup
with open('geosoft/pkg_info.json') as fp:
_info = json.load(fp)
def read(fname):
return open(path.join(path.dirname(__file__), fname)).read()
version_tag = "{}{}".format(_info['version'], _info['pre-release'])
if _info['pre-release'] == '':
dev_status_classifier = "Development Status :: 5 - Production/Stable"
else:
dev_status_classifier = "Development Status :: 4 - Beta"
for f in glob("geosoft/*.pyd"):
try:
remove(f)
except PermissionError as e:
raise Exception("An application is using a file we need to change: \n {}".format(str(e)))
dependencies = ['numpy', 'pandas', 'requests']
if 'bdist_wheel' in sys.argv:
# Have to specify python-tag to specify which module
for arg in sys.argv:
if arg.startswith('--python-tag='):
pythontag = arg[13:]
if pythontag == "cp38":
shutil.copyfile('gxapi_cy.cp38-win_amd64.pyd', 'geosoft/gxapi/gxapi_cy.pyd')
shutil.copyfile('gxapi_cy_extend.cp38-win_amd64.pyd', 'geosoft/gxapi/gxapi_cy_extend.pyd')
elif pythontag == "cp39":
shutil.copyfile('gxapi_cy.cp39-win_amd64.pyd', 'geosoft/gxapi/gxapi_cy.pyd')
shutil.copyfile('gxapi_cy_extend.cp39-win_amd64.pyd', 'geosoft/gxapi/gxapi_cy_extend.pyd')
elif pythontag == "cp310":
shutil.copyfile('gxapi_cy.cp310-win_amd64.pyd', 'geosoft/gxapi/gxapi_cy.pyd')
shutil.copyfile('gxapi_cy_extend.cp310-win_amd64.pyd', 'geosoft/gxapi/gxapi_cy_extend.pyd')
elif pythontag == "cp311":
shutil.copyfile('gxapi_cy.cp311-win_amd64.pyd', 'geosoft/gxapi/gxapi_cy.pyd')
shutil.copyfile('gxapi_cy_extend.cp311-win_amd64.pyd', 'geosoft/gxapi/gxapi_cy_extend.pyd')
elif pythontag == "cp312":
shutil.copyfile('gxapi_cy.cp312-win_amd64.pyd', 'geosoft/gxapi/gxapi_cy.pyd')
shutil.copyfile('gxapi_cy_extend.cp312-win_amd64.pyd', 'geosoft/gxapi/gxapi_cy_extend.pyd')
break
else:
# Copy the version we are building for
py_ver_major_minor = sys.version_info[:2]
if py_ver_major_minor == (3, 8):
shutil.copyfile('gxapi_cy.cp38-win_amd64.pyd', 'geosoft/gxapi/gxapi_cy.pyd')
shutil.copyfile('gxapi_cy_extend.cp38-win_amd64.pyd', 'geosoft/gxapi/gxapi_cy_extend.pyd')
elif py_ver_major_minor == (3, 9):
shutil.copyfile('gxapi_cy.cp39-win_amd64.pyd', 'geosoft/gxapi/gxapi_cy.pyd')
shutil.copyfile('gxapi_cy_extend.cp39-win_amd64.pyd', 'geosoft/gxapi/gxapi_cy_extend.pyd')
elif py_ver_major_minor == (3, 10):
shutil.copyfile('gxapi_cy.cp310-win_amd64.pyd', 'geosoft/gxapi/gxapi_cy.pyd')
shutil.copyfile('gxapi_cy_extend.cp310-win_amd64.pyd', 'geosoft/gxapi/gxapi_cy_extend.pyd')
elif py_ver_major_minor == (3, 11):
shutil.copyfile('gxapi_cy.cp311-win_amd64.pyd', 'geosoft/gxapi/gxapi_cy.pyd')
shutil.copyfile('gxapi_cy_extend.cp311-win_amd64.pyd', 'geosoft/gxapi/gxapi_cy_extend.pyd')
elif py_ver_major_minor == (3, 12):
shutil.copyfile('gxapi_cy.cp312-win_amd64.pyd', 'geosoft/gxapi/gxapi_cy.pyd')
shutil.copyfile('gxapi_cy_extend.cp312-win_amd64.pyd', 'geosoft/gxapi/gxapi_cy_extend.pyd')
packages=[
'geosoft',
'geosoft.gxapi',
'geosoft.gxpy',
'geosoft.gxpy._jdcal',
'geosoft.gxpy._xmltodict',
'geosoft.gxpy.user_input'
]
package_data={
'geosoft': ['*.json'],
'geosoft.gxapi': ['gxapi_cy.pyd', 'gxapi_cy_extend.pyd', '*.dll'],
'geosoft.gxpy._jdcal': ['*.txt', '*.rst'],
'geosoft.gxpy._xmltodict': ['LICENSE', '*.md'],
'geosoft.gxpy.user_input': ['*.gx']
}
setup(
name='geosoft',
version=version_tag,
description='Geosoft GX API module for Python',
long_description=read('README.md'),
author='Geosoft Inc.',
author_email='support@geosoft.com',
platforms=["win_amd64"],
url='https://github.com/GeosoftInc/gxpy',
license='BSD',
install_requires=dependencies,
packages=packages,
package_data=package_data,
test_suite="geosoft.gxpy.tests",
classifiers=[
dev_status_classifier,
"Topic :: Scientific/Engineering",
"Intended Audience :: Science/Research",
"License :: OSI Approved :: BSD License",
"Natural Language :: English",
"Operating System :: Microsoft :: Windows",
"Programming Language :: Python :: 3 :: Only",
],
)