-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathsetup.py
More file actions
81 lines (67 loc) · 1.96 KB
/
setup.py
File metadata and controls
81 lines (67 loc) · 1.96 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
from setuptools.command.install import install
from setuptools import setup, find_packages
from setuptools.command.build_py import build_py
import subprocess
import os
import platform
class CustomBuild(build_py):
def run(self):
self.execute(self.target_build, ())
build_py.run(self)
def target_build(self):
if platform.system() == 'Windows':
cwd = os.getcwd()
os.chdir('PyGeopack/__data/geopack/')
subprocess.check_call(['cmd','/c','compile.bat'])
os.chdir(cwd)
#subprocess.check_call(['cmd', '/c', 'testmodule2/__data/geopack/compile.bat'])
else:
subprocess.check_call(['make', '-C', 'PyGeopack/__data/geopack'])
with open("README.md", "r") as fh:
long_description = fh.read()
def getversion():
'''
read the version string from __init__
'''
#get the init file path
thispath = os.path.abspath(os.path.dirname(__file__))+'/'
initfile = thispath + 'PyGeopack/__init__.py'
#read the file in
f = open(initfile,'r')
lines = f.readlines()
f.close()
#search for the version
version = 'unknown'
for l in lines:
if '__version__' in l:
s = l.split('=')
version = s[-1].strip().strip('"').strip("'")
break
return version
version = getversion()
setup(
name="PyGeopack",
version=version,
author="Matthew Knight James",
author_email="mattkjames7@gmail.com",
description="Geopack08 wrapper for Python",
long_description=long_description,
long_description_content_type="text/markdown",
url="https://github.com/mattkjames7/PyGeopack",
packages=find_packages(),
package_data={'testmodule2': ['**/*']},
cmdclass={'build_py': CustomBuild},
classifiers=[
"Programming Language :: Python :: 3",
"Operating System :: POSIX",
],
install_requires=[
'numpy',
'PyFileIO',
'RecarrayTools',
'DateTimeTools>=1.1.0',
'kpindex>=1.0.1',
'pyomnidata>=1.0.1',
],
include_package_data=True,
)