mirror of
https://github.com/TREX-CoE/trexio.git
synced 2025-01-03 10:06:01 +01:00
better python build
This commit is contained in:
parent
60c28c1f3b
commit
b8c188343e
30
Makefile.am
30
Makefile.am
@ -184,29 +184,41 @@ cppcheck.out: $(trexio_h)
|
|||||||
-I../include *.c *.h 2>../$@
|
-I../include *.c *.h 2>../$@
|
||||||
|
|
||||||
|
|
||||||
|
setup_py = $(srcdir)/setup.py
|
||||||
|
setup_cfg = $(srcdir)/setup.cfg
|
||||||
|
pytrexio_py = $(srcdir)/src/pytrexio.py
|
||||||
|
pytrexio_c = $(srcdir)/src/pytrexio_wrap.c
|
||||||
|
pytrexio_i = $(srcdir)/src/pytrexio.i
|
||||||
|
TESTS_PY = $(srcdir)/tests/test_py.py
|
||||||
|
|
||||||
|
#python-prepare:
|
||||||
|
# cp include/trexio.h src/*.c src/*.h python/src/
|
||||||
|
|
||||||
python: _pytrexio*.so
|
python: _pytrexio*.so
|
||||||
|
|
||||||
python-test: test.py _pytrexio*.so
|
python-test: $(TESTS_PY) $(pytrexio_py)
|
||||||
python3 test.py
|
cp $(pytrexio_py) .
|
||||||
$(RM) -r -- __pycache__
|
python3 $(TESTS_PY)
|
||||||
|
$(RM) -r -- __pycache__ pytrexio.py
|
||||||
|
|
||||||
python-sdist: setup.py
|
python-sdist: $(setup_py) $(pytrexio_py)
|
||||||
python3 setup.py sdist
|
python3 setup.py sdist
|
||||||
|
|
||||||
|
python-build: $(setup_py) $(pytrexio_py) pyproject.toml
|
||||||
python-build: pyproject.toml setup.py setup.cfg MANIFEST.in
|
|
||||||
python3 -m build
|
python3 -m build
|
||||||
|
|
||||||
python-release: pyproject.toml setup.py setup.cfg MANIFEST.in
|
python-release: $(setup_py) $(pytrexio_py) pyproject.toml
|
||||||
python3 -m twine upload --repository testpypi dist/*
|
python3 -m twine upload --repository testpypi dist/*
|
||||||
|
|
||||||
# Advanced compilation using Python-native distutils
|
# Advanced compilation using Python-native distutils
|
||||||
#
|
#
|
||||||
# swig -python -threads pytrexio.i ----> Add thread support for all the interface
|
# swig -python -threads pytrexio.i ----> Add thread support for all the interface
|
||||||
#
|
#
|
||||||
_pytrexio*.so: $(ORG_FILES) $(trexio_h) src/pytrexio.i
|
$(pytrexio_c): $(ORG_FILES) $(trexio_h) $(pytrexio_i)
|
||||||
cp $(trexio_h) src/
|
cp $(trexio_h) src/
|
||||||
cd src/ && swig -python -py3 -o pytrexio_wrap.c pytrexio.i
|
cd src/ && swig -python -py3 -o pytrexio_wrap.c pytrexio.i
|
||||||
|
|
||||||
|
_pytrexio*.so: $(pytrexio_c) $(setup_py)
|
||||||
python3 setup.py build_ext --inplace --swig-opts="-modern"
|
python3 setup.py build_ext --inplace --swig-opts="-modern"
|
||||||
$(RM) -- src/trexio.h
|
$(RM) -- src/trexio.h
|
||||||
|
|
||||||
@ -225,7 +237,7 @@ _pytrexio*.so: $(ORG_FILES) $(trexio_h) src/pytrexio.i
|
|||||||
|
|
||||||
CLEANFILES += src/pytrexio_wrap.c src/pytrexio.py _pytrexio*.so
|
CLEANFILES += src/pytrexio_wrap.c src/pytrexio.py _pytrexio*.so
|
||||||
|
|
||||||
.PHONY: cppcheck python python-build python-test
|
.PHONY: cppcheck python python-build python-test python-release
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
8
setup.py
8
setup.py
@ -11,6 +11,7 @@ import os
|
|||||||
rootpath = os.path.dirname(os.path.abspath(__file__))
|
rootpath = os.path.dirname(os.path.abspath(__file__))
|
||||||
srcpath = os.path.join(rootpath, 'src')
|
srcpath = os.path.join(rootpath, 'src')
|
||||||
c_files = ['trexio.c', 'trexio_hdf5.c', 'trexio_text.c', 'pytrexio_wrap.c']
|
c_files = ['trexio.c', 'trexio_hdf5.c', 'trexio_text.c', 'pytrexio_wrap.c']
|
||||||
|
h_files = ['trexio.h', 'trexio_hdf5.h', 'trexio_text.h', 'trexio_s.h', 'trexio_private.h']
|
||||||
|
|
||||||
|
|
||||||
with open("README.md", "r") as fh:
|
with open("README.md", "r") as fh:
|
||||||
@ -19,7 +20,7 @@ with open("README.md", "r") as fh:
|
|||||||
|
|
||||||
pytrexio_module = Extension('_pytrexio',
|
pytrexio_module = Extension('_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 = ['/usr/include/hdf5/serial', 'srcpath'],
|
include_dirs = ['/usr/include/hdf5/serial', srcpath],
|
||||||
libraries = ['hdf5', 'hdf5_hl'],
|
libraries = ['hdf5', 'hdf5_hl'],
|
||||||
extra_compile_args = ['-Wno-discarded-qualifiers'],
|
extra_compile_args = ['-Wno-discarded-qualifiers'],
|
||||||
extra_link_args = ['-L/usr/lib/x86_64-linux-gnu/hdf5/serial']
|
extra_link_args = ['-L/usr/lib/x86_64-linux-gnu/hdf5/serial']
|
||||||
@ -28,13 +29,14 @@ pytrexio_module = Extension('_pytrexio',
|
|||||||
|
|
||||||
setup(name = 'pytrexio',
|
setup(name = 'pytrexio',
|
||||||
version = '0.1',
|
version = '0.1',
|
||||||
author = "Evgeny Posenitskiy",
|
author = "TREX-CoE",
|
||||||
author_email = "posenitskiy@irsamc.ups-tlse.fr",
|
author_email = "posenitskiy@irsamc.ups-tlse.fr",
|
||||||
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",
|
||||||
ext_modules = [pytrexio_module],
|
ext_modules = [pytrexio_module],
|
||||||
py_modules = ["pytrexio"],
|
py_modules = ["pytrexio"],
|
||||||
|
scripts = ["tests/test_py.py"],
|
||||||
url = 'https://github.com/TREX-CoE/trexio',
|
url = 'https://github.com/TREX-CoE/trexio',
|
||||||
license = 'BSD',
|
license = 'BSD',
|
||||||
packages = find_packages(),
|
packages = find_packages(),
|
||||||
|
Loading…
Reference in New Issue
Block a user