1
0
mirror of https://github.com/TREX-CoE/trexio.git synced 2024-11-03 20:54:07 +01:00

move from distutils to setuptools

sdist and install arguments of setup.py work!
This commit is contained in:
q-posev 2021-07-28 15:57:42 +02:00
parent f3dbfc7be2
commit ea0ea0ac38
5 changed files with 65 additions and 55 deletions

1
MANIFEST.in Normal file
View File

@ -0,0 +1 @@
include README.md src/pytrexio.py src/pytrexio_wrap.c src/trexio.c src/trexio_hdf5.c src/trexio_text.c

View File

@ -184,26 +184,29 @@ cppcheck.out: $(trexio_h)
-I../include *.c *.h 2>../$@
python: src/_pytrexio*.so
python: _pytrexio*.so
python-test: src/test.py src/_pytrexio*.so
cd src/ && python3 test.py
$(RM) -r -- src/__pycache__
python-test: test.py _pytrexio*.so
python3 test.py
$(RM) -r -- __pycache__
python-build: pyproject.toml setup.cfg
python-sdist: setup.py
python3 setup.py sdist
python-build: pyproject.toml setup.py setup.cfg MANIFEST.in
python3 -m build
python-release: pyproject.toml setup.cfg
python-release: pyproject.toml setup.py setup.cfg MANIFEST.in
python3 -m twine upload --repository testpypi dist/*
# Advanced compilation using Python-native distutils
#
# swig -python -threads pytrexio.i ----> Add thread support for all the interface
#
src/_pytrexio*.so: $(ORG_FILES) $(trexio_h) src/pytrexio.i
_pytrexio*.so: $(ORG_FILES) $(trexio_h) src/pytrexio.i
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
python3 setup.py build_ext --inplace --swig-opts="-modern"
$(RM) -- src/trexio.h
@ -220,7 +223,7 @@ src/_pytrexio*.so: $(ORG_FILES) $(trexio_h) src/pytrexio.i
# $(RM) -- src/trexio.h
#
CLEANFILES += src/pytrexio_wrap.c src/pytrexio.py src/_pytrexio*.so
CLEANFILES += src/pytrexio_wrap.c src/pytrexio.py _pytrexio*.so
.PHONY: cppcheck python python-build python-test

View File

@ -1,23 +1,9 @@
[metadata]
name = pytrexio666
version = 0.1
author = TREX-CoE
description = Python API of the TREXIO library
long_description = file: README.md
long_description_content_type = text/markdown
url = https://github.com/TREX-CoE/trexio
description-file = README.md
project_urls =
Bug Tracker = https://github.com/TREX-CoE/trexio/issues
classifiers =
Programming Language :: Python :: 3
License :: OSI Approved :: BSD License
[options]
package_dir =
= src
packages = find:
python_requires = >=3.6
[options.packages.find]
where = src

49
setup.py Normal file
View File

@ -0,0 +1,49 @@
#!/usr/bin/env python
"""
setup.py file for pytrexio
"""
#from distutils.core import setup, Extension
from setuptools import setup, Extension, find_packages
import os
rootpath = os.path.dirname(os.path.abspath(__file__))
srcpath = os.path.join(rootpath, 'src')
c_files = ['trexio.c', 'trexio_hdf5.c', 'trexio_text.c', 'pytrexio_wrap.c']
with open("README.md", "r") as fh:
long_description = fh.read()
pytrexio_module = Extension('_pytrexio',
sources = [os.path.join(srcpath, code) for code in c_files],
include_dirs = ['/usr/include/hdf5/serial', 'srcpath'],
libraries = ['hdf5', 'hdf5_hl'],
extra_compile_args = ['-Wno-discarded-qualifiers'],
extra_link_args = ['-L/usr/lib/x86_64-linux-gnu/hdf5/serial']
)
setup(name = 'pytrexio',
version = '0.1',
author = "Evgeny Posenitskiy",
author_email = "posenitskiy@irsamc.ups-tlse.fr",
description = """Python API of the TREXIO library""",
long_description = long_description,
long_description_content_type="text/markdown",
ext_modules = [pytrexio_module],
py_modules = ["pytrexio"],
url = 'https://github.com/TREX-CoE/trexio',
license = 'BSD',
packages = find_packages(),
classifiers=[
"Programming Language :: Python :: 3",
"Programming Language :: C"
"License :: OSI Approved :: BSD",
"Operating System :: POSIX :: Linux",
],
install_requires = ['h5py']
)

View File

@ -1,29 +0,0 @@
#!/usr/bin/env python
"""
setup.py file for pytrexio
"""
from distutils.core import setup, Extension
pytrexio_module = Extension('_pytrexio',
sources = ['trexio.c', 'trexio_hdf5.c', 'trexio_text.c', 'pytrexio_wrap.c'],
include_dirs = ['/usr/include/hdf5/serial'],
#runtime_library_dirs=['/usr/lib/x86_64-linux-gnu/hdf5/serial'],
libraries = ['hdf5', 'hdf5_hl'],
extra_compile_args = ['-Wno-discarded-qualifiers'],
extra_link_args = ['-L/usr/lib/x86_64-linux-gnu/hdf5/serial']
)
setup(name = 'pytrexio',
version = '0.1',
author = "TREX-CoE",
description = """Python API of the TREXIO library""",
ext_modules = [pytrexio_module],
py_modules = ["pytrexio"],
url = 'https://github.com/TREX-CoE/trexio',
license = 'BSD',
packages = ['distutils', 'distutils.command'],
install_requires = ['h5py']
)