-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathsetup.py
134 lines (114 loc) · 4.44 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
"""
~~~ PySAR ~~~
Python-based toolbox for post-processing
synthetic aperture radar (SAR) data
PySAR is a general-purpose set of tools for common post-processing
tasks involving the use of SAR data. Interferometric SAR (InSAR)
and Polarimetric SAR (PolSAR) tools are included along with tools that
are useful for processing 1D data sets, such as GPS and seismic data.
Copyright (C) 2013 Brent M. Minchew
--------------------------------------------------------------------
GNU Licensed
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
--------------------------------------------------------------------
"""
import sys,os
import shutil
if sys.version[:3] != '2.7':
sys.path[1] = '/'.join([sys.prefix,'lib','python%s' % sys.version[:3],'site-packages'])
if sys.version_info[0] < 3:
import __builtin__ as builtins
else:
import builtins
# Version info
MAJOR = 0
MINOR = 1
MICRO = 0
ISRELEASED = True
VERSION = '%d.%d.%d' % (MAJOR, MINOR, MICRO)
requirements = ['numpy', 'scipy']
scripts = ['pysar/image/sarlooks.py', 'pysar/image/sarfilter.py',
'pysar/math/sarmath.py', 'pysar/polsar/sardecomp_fd.py',
'pysar/polsar/sardecomp_haa.py', 'pysar/insar/sarphase_detrend.py',
'pysar/insar/sarcorrelation.py']
cythoncodes = ['pysar/signal/filtermod.pyx']
def write_version_py(filename='pysar/version.py'):
cnt = '"""' + __doc__
cnt += ' ** This file was generated by the root setup.py\n' + '"""'
cnt += """
\nversion = '%(version)s'
"""
FULLVERSION = VERSION
a = open(filename, 'w')
try:
a.write(cnt % {'version': VERSION,
'full_version' : FULLVERSION,
'isrelease': str(ISRELEASED)})
finally:
a.close()
def configuration(parent_package='',top_path=None):
from numpy.distutils.misc_util import Configuration
config = Configuration(None, parent_package, top_path)
config.set_options(ignore_setup_xxx_py=True,
assume_default_configuration=True,
delegate_options_to_subpackages=True,
quiet=True)
config.add_subpackage('pysar')
for x in scripts:
config.add_scripts(x)
config.get_version('pysar/version.py')
return config
def setup_package():
from numpy.distutils.core import setup
if os.path.exists('./build'):
from distutils.dir_util import remove_tree
remove_tree('./build')
'''
# Perform 2to3 if needed
local_path = os.path.dirname(os.path.abspath(sys.argv[0]))
src_path = local_path
if sys.version_info[0] == 3:
src_path = os.path.join(local_path, 'build', 'py3k')
sys.path.insert(0, os.path.join(local_path, 'tools'))
import py3tool
print("Converting to Python3 via 2to3...")
py3tool.sync_2to3('numpy', os.path.join(src_path, 'numpy'))
site_cfg = os.path.join(local_path, 'site.cfg')
if os.path.isfile(site_cfg):
shutil.copy(site_cfg, src_path)
old_path = os.getcwd()
os.chdir(src_path)
sys.path.insert(0, src_path)
'''
write_version_py()
try:
setup(name='pysar',
author='Brent Minchew',
author_email='[email protected]',
description='\n'.join(__doc__.split('\n')[:1]),
license = 'GNU',
classifiers=[
'Development Status :: 4 - Beta',
'License :: OSI Approved :: GNU General Public License v3 (GPLv3)',
'Programming Language :: Fortran',
'Programming Language :: Python',
'Operating System :: OS Independent',
'Intended Audience :: Science/Research',
'Topic :: Scientific/Engineering'],
configuration=configuration)
finally:
print('')
#del sys.path[0] ### part of Python3 upgrade
#os.chdir(old_path)
if __name__ == '__main__':
setup_package()
os.remove('pysar/version.pyc')