diff --git a/MANIFEST.in b/MANIFEST.in new file mode 100644 index 0000000..7bbd55e --- /dev/null +++ b/MANIFEST.in @@ -0,0 +1 @@ +include README.md src/pytrexio.py src/pytrexio_wrap.c src/trexio.c src/trexio_hdf5.c src/trexio_text.c diff --git a/Makefile.am b/Makefile.am index de651ee..de44d0e 100644 --- a/Makefile.am +++ b/Makefile.am @@ -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 diff --git a/setup.cfg b/setup.cfg index b9e161b..a6688ac 100644 --- a/setup.cfg +++ b/setup.cfg @@ -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 - diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..e83c70e --- /dev/null +++ b/setup.py @@ -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'] + ) + diff --git a/src/setup.py b/src/setup.py deleted file mode 100644 index 81bd567..0000000 --- a/src/setup.py +++ /dev/null @@ -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'] - )