forked from fatiando/fatiando
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.py
More file actions
118 lines (114 loc) · 4.29 KB
/
setup.py
File metadata and controls
118 lines (114 loc) · 4.29 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
"""
Build extention modules, package and install Fatiando.
Uses the numpy's extension of distutils to build the f2py extension modules
"""
import subprocess
import os
from os.path import join
from distutils.core import setup
from distutils.extension import Extension
try:
from Cython.Distutils import build_ext
import numpy
ext_modules = [
Extension("fatiando.gravmag._cprism",
[join('fatiando', 'gravmag', '_cprism.pyx')],
libraries=['m'],
extra_compile_args=['-O3'],
include_dirs=[numpy.get_include()]),
Extension("fatiando.gravmag._ctesseroid",
[join('fatiando', 'gravmag', '_ctesseroid.pyx')],
libraries=['m'],
extra_compile_args=['-O3'],
include_dirs=[numpy.get_include()]),
Extension("fatiando.seismic._cttime2d",
[join('fatiando', 'seismic', '_cttime2d.pyx')],
libraries=['m'],
extra_compile_args=['-O3'],
include_dirs=[numpy.get_include()]),
Extension("fatiando.seismic._cwavefd",
[join('fatiando', 'seismic', '_cwavefd.pyx')],
libraries=['m'],
extra_compile_args=['-O3'],
include_dirs=[numpy.get_include()])]
CYTHON = True
except ImportError:
print ("Couldn't find Cython to build C extension.\n" +
"Don't panic! Will use Python alternatives instead.")
CYTHON = False
NAME = 'fatiando'
FULLNAME = 'Fatiando a Terra'
DESCRIPTION = "Geophysical modeling and inversion"
VERSION = '0.1'
with open("README.rst") as f:
LONG_DESCRIPTION = ''.join(f.readlines())
PACKAGES = ['fatiando',
'fatiando.gravmag',
'fatiando.seismic',
'fatiando.geothermal',
'fatiando.vis',
'fatiando.gui',
'fatiando.inversion']
AUTHOR = "Leonardo Uieda"
AUTHOR_EMAIL = 'leouieda@gmail.com'
LICENSE = "BSD License"
URL = "http://www.fatiando.org"
PLATFORMS = "Any"
#SCRIPTS = ['scripts/harvester']
SCRIPTS = []
CLASSIFIERS = ["Intended Audience :: End Users/Desktop",
"Intended Audience :: Science/Research",
"Intended Audience :: Developers",
"Intended Audience :: Education",
"Topic :: Scientific/Engineering",
"Topic :: Software Development :: Libraries",
"Environment :: Console",
"Programming Language :: Python :: 2.7",
"Programming Language :: Cython",
"License :: OSI Approved :: BSD License",
"Development Status :: 3 - Alpha",
"Natural Language :: English"]
def setrevison():
# Check if the script is building/packaging or if this is a src dist
if os.path.exists('.hg'):
with open(join('fatiando','changeset.txt'), 'w') as versionfile:
proc = subprocess.Popen('hg tip', shell=True,
stdout=subprocess.PIPE)
csline, bline = [l.strip() for l in proc.stdout.readlines()[0:2]]
changeset = csline.split(':')[-1].strip()
branch = bline.split(':')[-1].strip()
if branch == 'tip':
branch = 'default'
versionfile.write("%s" % (changeset))
if __name__ == '__main__':
setrevison()
if CYTHON:
setup(name=NAME,
fullname=FULLNAME,
description=DESCRIPTION,
long_description=LONG_DESCRIPTION,
version=VERSION,
author=AUTHOR,
author_email=AUTHOR_EMAIL,
license=LICENSE,
url=URL,
platforms=PLATFORMS,
scripts=SCRIPTS,
packages=PACKAGES,
ext_modules=ext_modules,
cmdclass = {'build_ext': build_ext},
classifiers=CLASSIFIERS)
else:
setup(name=NAME,
fullname=FULLNAME,
description=DESCRIPTION,
long_description=LONG_DESCRIPTION,
version=VERSION,
author=AUTHOR,
author_email=AUTHOR_EMAIL,
license=LICENSE,
url=URL,
platforms=PLATFORMS,
scripts=SCRIPTS,
packages=PACKAGES,
classifiers=CLASSIFIERS)