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-10-28 20:14:51 +01:00
|
|
|
try:
|
|
|
|
|
from importlib.machinery import EXTENSION_SUFFIXES
|
|
|
|
|
suffix = EXTENSION_SUFFIXES[0]
|
|
|
|
|
except ImportError:
|
|
|
|
|
suffix = ".so"
|
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-09-17 14:16:55 +02:00
|
|
|
subprocess.call(['ccache', '--version'])
|
|
|
|
|
cc = os.environ.get("CC", "c++")
|
|
|
|
|
os.environ['CC'] = 'ccache {}'.format(cc)
|
|
|
|
|
print("Using 'ccache {}' as compiler".format(cc))
|
2019-08-09 13:02:04 +02:00
|
|
|
except OSError as e:
|
2019-09-17 14:16:55 +02:00
|
|
|
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:
|
2019-09-17 14:16:55 +02:00
|
|
|
if not 'build_ext' in sys.argv:
|
|
|
|
|
raise TypeError("Missing option 'build_ext'.")
|
2019-06-27 14:08:22 +02:00
|
|
|
|
|
|
|
|
ext_modules = [
|
|
|
|
|
Extension(
|
2019-08-12 08:36:00 +02:00
|
|
|
'libopmcommon_python',
|
2019-06-27 14:08:22 +02:00
|
|
|
[
|
2019-10-11 16:29:09 +02:00
|
|
|
'cxx/unit_system.cpp',
|
2019-06-27 14:08:22 +02:00
|
|
|
'cxx/connection.cpp',
|
2019-10-30 22:34:37 +01:00
|
|
|
'cxx/converters.cpp',
|
2019-06-27 14:08:22 +02:00
|
|
|
'cxx/deck.cpp',
|
|
|
|
|
'cxx/deck_keyword.cpp',
|
2019-10-30 22:38:23 +01:00
|
|
|
'cxx/eclipse_io.cpp',
|
2019-12-19 10:54:42 +01:00
|
|
|
'cxx/field_props.cpp',
|
2019-06-27 14:08:22 +02:00
|
|
|
'cxx/eclipse_config.cpp',
|
|
|
|
|
'cxx/eclipse_grid.cpp',
|
|
|
|
|
'cxx/eclipse_state.cpp',
|
|
|
|
|
'cxx/group.cpp',
|
2019-09-16 18:33:50 +02:00
|
|
|
'cxx/log.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-12-27 10:08:46 +01:00
|
|
|
'cxx/summary_state.cpp',
|
2019-06-27 14:08:22 +02:00
|
|
|
'cxx/table_manager.cpp',
|
|
|
|
|
'cxx/well.cpp',
|
2019-09-13 09:40:13 +02:00
|
|
|
'cxx/export.cpp'
|
2019-06-27 14:08:22 +02:00
|
|
|
],
|
2019-10-15 08:47:47 -05:00
|
|
|
libraries=['opmcommon', 'boost_filesystem', 'boost_regex'],
|
2019-06-27 14:08:22 +02:00
|
|
|
language='c++',
|
|
|
|
|
undef_macros=["NDEBUG"],
|
|
|
|
|
include_dirs=["pybind11/include"]
|
2019-10-26 17:33:43 +02:00
|
|
|
)
|
2019-06-27 14:08:22 +02:00
|
|
|
]
|
|
|
|
|
|
|
|
|
|
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-09-19 14:14:55 +02:00
|
|
|
'opm.io.deck',
|
|
|
|
|
'opm.io.ecl_state',
|
2019-08-23 11:44:41 +02:00
|
|
|
'opm.io.parser',
|
|
|
|
|
'opm.io.schedule',
|
2019-10-26 17:33:43 +02:00
|
|
|
'opm.io.ecl',
|
2019-08-19 15:42:24 +02:00
|
|
|
'opm.tools'
|
2019-06-27 14:08:22 +02:00
|
|
|
],
|
|
|
|
|
ext_modules=ext_modules,
|
2020-02-06 10:18:07 +01:00
|
|
|
package_data={'opm': ['libopmcommon_python{}'.format(suffix)]},
|
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'],
|
|
|
|
|
)
|