Repository navigation
Expand file tree
/
Copy pathsetup.py
More file actions
86 lines (77 loc) · 2.46 KB
/
Copy pathsetup.py
File metadata and controls
86 lines (77 loc) · 2.46 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
"""This is a WIP updated setup file.
TODO:
- Bring in manifest
- Build fortran
- Implement py2exe
"""
import setuptools
# from setuptools import setup
from glob import glob
import os
import re
from numpy.distutils.core import Extension, setup
# from do3se.version import app_version, app_name
with open("README.md", "r") as fh:
long_description = fh.read()
root = os.environ.get('BUILD_ROOT', None) # This is a hack to fix missing objects.mk issue
if not root:
raise Exception('Env var BUILD_ROOT not set')
app_name = 'do3se'
app_description = 'Deposition of Ozone and Stomatal Exchange'
app_version = '3.7.1'
fortran_src_dir = 'src/F'
ext_files = [os.path.join(fortran_src_dir, x) for x in
re.findall(r'\w+\.f90',
re.sub(r'(\w+)\.o', r'\1.f90',
open(os.path.join(root, fortran_src_dir, 'objects.mk'), 'r').read()))]
all_ext_files = ['src/do3se/_model.pyf'] + ext_files
ext_name = '_model'
def buildpyf(filelist, target):
from numpy.f2py import f2py2e
f2py2e.callcrackfortran(filelist,
{
'signsfile': target + '.pyf',
'module': target,
'coutput': None,
'f2py_wrapper_output': None,
'debug': False,
'verbose': False,
'include_paths': list(),
'do-lower': True
}
)
return [target + '.pyf'] + filelist
ext = Extension('do3se._model', buildpyf(ext_files, ext_name))
setup(
name=app_name,
version=app_version,
author='Sam Bland | Alan Briolat',
author_email='sam.bland@sei.org',
description="DO3SE model python API",
setup_requires=['numpy==1.24.4', 'future', 'pandas'],
install_requires=[
'numpy==1.24.4',
'future',
'pandas',
],
extras_require={
'cli': ['pytest', 'numpy', 'pandas', 'click'],
'grid': ['xarray', 'netCDF4', 'pandas', 'numpy'],
'test': ['pytest', 'numpy', 'pandas', 'click'],
},
packages=setuptools.find_packages(where="src"),
package_dir={'': 'src'},
classifiers=[
"Programming Language :: Python :: 3.7",
"Operating System :: OS Independent",
],
ext_modules=[
# Extension('do3se._model', all_ext_files, ['config_fc', '--fcompiler=gnu95',
# '--f90flags="-fimplicit-none"', '--noopt'])
ext,
],
data_files=[
('Microsoft.VC90.CRT',
glob('resources/Microsoft.VC90.CRT/*')),
],
)