mirror of
https://github.com/TREX-CoE/trexio.git
synced 2025-01-09 12:44:11 +01:00
minor fixed in setup script to be compatible with Docker containers
+ replaced dependency on h5py with numpy
This commit is contained in:
parent
96678fea2e
commit
e72fbb4645
@ -18,11 +18,11 @@ VERSIONFILE = "pytrexio/_version.py"
|
|||||||
try:
|
try:
|
||||||
exec(open(VERSIONFILE).read())
|
exec(open(VERSIONFILE).read())
|
||||||
except:
|
except:
|
||||||
raise IOError(f"Could not open the version file {VERSIONFILE}.")
|
raise IOError("Could not open the version file %s." % (VERSIONFILE, ))
|
||||||
|
|
||||||
version_r = __version__
|
version_r = __version__
|
||||||
if not version_r:
|
if not version_r:
|
||||||
raise RuntimeError(f"Unable to find a version string in {VERSIONFILE}.")
|
raise RuntimeError("Unable to find a version string in %s." % (VERSIONFILE, ))
|
||||||
|
|
||||||
|
|
||||||
# =========================== Start of the HDF5 block =========================== #
|
# =========================== Start of the HDF5 block =========================== #
|
||||||
@ -55,10 +55,16 @@ h5_ldflags = h5_ldflags_withl.split(" ")[0]
|
|||||||
|
|
||||||
# ============================ End of the HDF5 block ============================ #
|
# ============================ End of the HDF5 block ============================ #
|
||||||
|
|
||||||
|
# we need to explicitly provide an include path to the numpy headers in some environments (e.g. in Docker containers)
|
||||||
|
try:
|
||||||
|
from numpy import get_include as np_get_include
|
||||||
|
except ImportError:
|
||||||
|
raise Exception("numpy Python package has not been found")
|
||||||
|
|
||||||
# Define pytrexio extension module based on TREXIO source codes + SWIG-generated wrapper
|
# Define pytrexio extension module based on TREXIO source codes + SWIG-generated wrapper
|
||||||
pytrexio_module = Extension('pytrexio._pytrexio',
|
pytrexio_module = Extension('pytrexio._pytrexio',
|
||||||
sources = [os.path.join(srcpath, code) for code in c_files],
|
sources = [os.path.join(srcpath, code) for code in c_files],
|
||||||
include_dirs = [h5_cflags, srcpath],
|
include_dirs = [h5_cflags, srcpath, np_get_include()],
|
||||||
libraries = ['hdf5', 'hdf5_hl'],
|
libraries = ['hdf5', 'hdf5_hl'],
|
||||||
extra_compile_args = ['-Wno-discarded-qualifiers'],
|
extra_compile_args = ['-Wno-discarded-qualifiers'],
|
||||||
extra_link_args = [h5_ldflags]
|
extra_link_args = [h5_ldflags]
|
||||||
@ -72,6 +78,7 @@ setup(name = 'trexio',
|
|||||||
description = """Python API of the TREXIO library""",
|
description = """Python API of the TREXIO library""",
|
||||||
long_description = long_description,
|
long_description = long_description,
|
||||||
long_description_content_type = "text/markdown",
|
long_description_content_type = "text/markdown",
|
||||||
|
install_requires = ['numpy'],
|
||||||
ext_modules = [pytrexio_module],
|
ext_modules = [pytrexio_module],
|
||||||
py_modules = ['trexio'],
|
py_modules = ['trexio'],
|
||||||
packages = ['pytrexio'],
|
packages = ['pytrexio'],
|
||||||
@ -82,7 +89,6 @@ setup(name = 'trexio',
|
|||||||
"Programming Language :: C",
|
"Programming Language :: C",
|
||||||
"License :: OSI Approved :: BSD License",
|
"License :: OSI Approved :: BSD License",
|
||||||
"Operating System :: POSIX :: Linux"
|
"Operating System :: POSIX :: Linux"
|
||||||
],
|
]
|
||||||
install_requires = ['h5py']
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user