forked from idies/pyJHTDB
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
executable file
·110 lines (93 loc) · 3.4 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
#! /usr/bin/env python
###############################################################################
#
# Copyright 2014 Johns Hopkins University
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Contact: turbulence@pha.jhu.edu
# Website: http://turbulence.pha.jhu.edu/
#
###############################################################################
########################################################################
#
# some global settings
#
TURBLIB_VERSION = '20140606'
#
########################################################################
########################################################################
#
# define version for pyJHTDB
# TODO: the version should come from checking
# when the sources were last modified.
#
import datetime
now = datetime.datetime.now()
date_name = '{0:0>4}{1:0>2}{2:0>2}'.format(now.year, now.month, now.day)
#
########################################################################
########################################################################
#
# get the turbulence library
#
import os
if not os.path.isdir('turblib-' + TURBLIB_VERSION):
import urllib
urllib.urlretrieve('http://turbulence.pha.jhu.edu/download/turblib-'
+ TURBLIB_VERSION
+ '.tar.gz',
'turblib-'
+ TURBLIB_VERSION
+ '.tar.gz')
import tarfile
turblib = tarfile.open('turblib-' + TURBLIB_VERSION + '.tar.gz')
turblib.extractall()
turblib.close()
#
########################################################################
########################################################################
#
# check what's available on the system
#
import distutils.spawn
h5cc_executable = distutils.spawn.find_executable('h5cc')
h5cc_present = not (h5cc_executable == None)
#
########################################################################
libraries = []
macros = []
if h5cc_present:
libraries.append('hdf5')
macros.append(('CUTOUT_SUPPORT', '1'))
from setuptools import setup, Extension
libJHTDB = Extension(
'libJHTDB',
sources = ['C/local_tools.c',
'turblib-' + TURBLIB_VERSION + '/turblib.c',
'turblib-' + TURBLIB_VERSION + '/soapC.c',
'turblib-' + TURBLIB_VERSION + '/soapClient.c',
'turblib-' + TURBLIB_VERSION + '/stdsoap2.c'],
include_dirs = ['turblib-' + TURBLIB_VERSION],
define_macros = macros,
libraries = libraries)
setup(
name = 'pyJHTDB',
version = date_name,
packages = ['pyJHTDB'],
package_data = {'pyJHTDB': ['data/channel_xgrid.npy',
'data/channel_ygrid.npy',
'data/channel_zgrid.npy']},
install_requires = 'numpy>=1.8',
ext_modules = [libJHTDB]
)