2019-06-27 14:08:22 +02:00
|
|
|
from setuptools import setup, find_packages
|
|
|
|
|
|
|
|
|
|
from setuptools import Extension
|
|
|
|
|
from setuptools.command.build_ext import build_ext
|
|
|
|
|
import sys
|
|
|
|
|
import setuptools
|
|
|
|
|
|
|
|
|
|
import glob
|
|
|
|
|
import os
|
2019-08-09 13:02:04 +02:00
|
|
|
import subprocess
|
2019-08-15 15:10:10 +02:00
|
|
|
import argparse
|
|
|
|
|
|
2019-08-16 10:35:28 +02:00
|
|
|
|
|
|
|
|
parser = argparse.ArgumentParser()
|
|
|
|
|
parser.add_argument("build")
|
|
|
|
|
parser.add_argument("build_ext")
|
|
|
|
|
parser.add_argument("--build-lib")
|
|
|
|
|
parser.add_argument("--prefix")
|
|
|
|
|
parser.add_argument("--library-dirs")
|
|
|
|
|
parser.add_argument("--include-dirs")
|
|
|
|
|
parser.add_argument("--dry-run", action='store_true')
|
|
|
|
|
args = parser.parse_args()
|
|
|
|
|
|
|
|
|
|
#Circumnventing setuptools' PYTHONPATH check.
|
|
|
|
|
#This is necessary during install
|
|
|
|
|
if args.prefix:
|
|
|
|
|
python_version = 'python' + str(sys.version_info.major) + '.' + str(sys.version_info.minor)
|
|
|
|
|
pkg_path_root = os.path.join(args.prefix, 'lib', python_version, 'site-packages')
|
2019-09-06 14:21:51 +02:00
|
|
|
if 'PYTHONPATH' in os.environ:
|
|
|
|
|
os.environ['PYTHONPATH'] += ':' + pkg_path_root
|
|
|
|
|
else:
|
|
|
|
|
os.environ['PYTHONPATH'] = pkg_path_root
|
2019-08-16 10:35:28 +02:00
|
|
|
|
2019-08-15 15:10:10 +02:00
|
|
|
setupdir = os.path.dirname(__file__)
|
|
|
|
|
if setupdir != '':
|
|
|
|
|
os.chdir( setupdir )
|
2019-08-09 13:02:04 +02:00
|
|
|
|
|
|
|
|
try:
|
2019-08-09 14:57:49 +02:00
|
|
|
subprocess.call(["c++", "--version"])
|
2019-08-09 13:02:04 +02:00
|
|
|
subprocess.call(['ccache', '--version'])
|
2019-08-09 14:57:49 +02:00
|
|
|
os.environ['CC'] = 'ccache c++'
|
2019-08-09 13:02:04 +02:00
|
|
|
except OSError as e:
|
|
|
|
|
print('\nNOTE: please install ccache for faster compilation of python bindings.\n')
|
2019-06-27 14:08:22 +02:00
|
|
|
|
|
|
|
|
if 'build' in sys.argv:
|
|
|
|
|
if not 'build_ext' in sys.argv:
|
|
|
|
|
raise TypeError("Missing option 'build_ext'.")
|
|
|
|
|
|
|
|
|
|
ext_modules = [
|
|
|
|
|
Extension(
|
2019-08-12 08:36:00 +02:00
|
|
|
'libopmcommon_python',
|
2019-06-27 14:08:22 +02:00
|
|
|
[
|
|
|
|
|
'cxx/connection.cpp',
|
|
|
|
|
'cxx/deck.cpp',
|
|
|
|
|
'cxx/deck_keyword.cpp',
|
|
|
|
|
'cxx/eclipse_3d_properties.cpp',
|
|
|
|
|
'cxx/eclipse_config.cpp',
|
|
|
|
|
'cxx/eclipse_grid.cpp',
|
|
|
|
|
'cxx/eclipse_state.cpp',
|
|
|
|
|
'cxx/group.cpp',
|
|
|
|
|
'cxx/group_tree.cpp',
|
2019-09-04 14:42:52 +02:00
|
|
|
'cxx/parsecontext.cpp',
|
2019-06-27 14:08:22 +02:00
|
|
|
'cxx/parser.cpp',
|
|
|
|
|
'cxx/schedule.cpp',
|
2019-08-15 11:19:18 +02:00
|
|
|
'cxx/common_state.cpp',
|
2019-06-27 14:08:22 +02:00
|
|
|
'cxx/table_manager.cpp',
|
|
|
|
|
'cxx/well.cpp',
|
2019-08-15 11:19:18 +02:00
|
|
|
'cxx/common.cpp'
|
2019-06-27 14:08:22 +02:00
|
|
|
],
|
|
|
|
|
libraries=['opmcommon', 'boost_filesystem', 'boost_regex', 'ecl'],
|
|
|
|
|
language='c++',
|
|
|
|
|
undef_macros=["NDEBUG"],
|
|
|
|
|
include_dirs=["pybind11/include"]
|
|
|
|
|
),
|
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
setup(
|
2019-08-12 08:36:00 +02:00
|
|
|
name='Opm',
|
2019-06-27 14:08:22 +02:00
|
|
|
package_dir = {'': 'python'},
|
|
|
|
|
packages=[
|
2019-08-12 08:36:00 +02:00
|
|
|
'opm',
|
2019-08-23 10:25:54 +02:00
|
|
|
'opm.io',
|
2019-08-23 11:44:41 +02:00
|
|
|
'opm.io.parser',
|
|
|
|
|
'opm.io.schedule',
|
|
|
|
|
'opm.io.config',
|
2019-08-19 15:42:24 +02:00
|
|
|
'opm.tools'
|
2019-06-27 14:08:22 +02:00
|
|
|
],
|
|
|
|
|
ext_modules=ext_modules,
|
2019-08-15 15:10:10 +02:00
|
|
|
package_data={
|
2019-08-16 10:37:48 +02:00
|
|
|
'': ['cxx/libopmcommon_python.so']
|
2019-08-15 15:10:10 +02:00
|
|
|
},
|
|
|
|
|
include_package_data=True,
|
2019-06-27 14:08:22 +02:00
|
|
|
license='Open Source',
|
|
|
|
|
zip_safe=False,
|
2019-08-12 08:36:00 +02:00
|
|
|
tests_suite='tests',
|
2019-06-27 14:08:22 +02:00
|
|
|
setup_requires=["pytest-runner", 'setuptools_scm'],
|
|
|
|
|
)
|