diff --git a/Makefile.am b/Makefile.am index 2bda741..bc6fa1e 100644 --- a/Makefile.am +++ b/Makefile.am @@ -186,8 +186,8 @@ cppcheck.out: $(trexio_h) setup_py = $(srcdir)/python/setup.py setup_cfg = $(srcdir)/python/setup.cfg -pytrexio_py = $(srcdir)/python/trexio/pytrexio.py -trexio_api_py = $(srcdir)/python/trexio/trexio_api.py +pytrexio_py = $(srcdir)/python/pytrexio/pytrexio.py +trexio_py = $(srcdir)/python/trexio.py TEST_PY = $(srcdir)/python/test/test_api.py pytrexio_c = $(srcdir)/src/pytrexio_wrap.c pytrexio_i = $(srcdir)/src/pytrexio.i @@ -219,7 +219,7 @@ check-numpy: CLEANFILES += $(pytrexio_c) \ $(pytrexio_py) \ - $(trexio_api_py) \ + $(trexio_py) \ python/src/*.c \ python/src/*.h diff --git a/python/trexio/__init__.py b/python/pytrexio/__init__.py similarity index 100% rename from python/trexio/__init__.py rename to python/pytrexio/__init__.py diff --git a/python/setup.py b/python/setup.py index a837fe1..6967a1c 100644 --- a/python/setup.py +++ b/python/setup.py @@ -15,7 +15,7 @@ with open("README.md", "r") as fh: long_description = fh.read() -pytrexio_module = Extension('trexio._pytrexio', +pytrexio_module = Extension('pytrexio._pytrexio', sources = [os.path.join(srcpath, code) for code in c_files], include_dirs = ['/usr/include/hdf5/serial', srcpath], libraries = ['hdf5', 'hdf5_hl'], @@ -32,7 +32,8 @@ setup(name = 'trexio', long_description = long_description, long_description_content_type = "text/markdown", ext_modules = [pytrexio_module], - packages = ['trexio'], + py_modules = ['trexio'], + packages = ['pytrexio'], url = 'https://github.com/TREX-CoE/trexio', license = 'BSD', classifiers=[ diff --git a/src/templates_front/build.sh b/src/templates_front/build.sh index aa0d114..5853c27 100644 --- a/src/templates_front/build.sh +++ b/src/templates_front/build.sh @@ -10,7 +10,7 @@ echo "" >> trexio.h cat prefix_s_front.h > trexio_s.h cat prefix_fortran.f90 > trexio_f.f90 -cat prefix_python.py > trexio_api.py +cat prefix_python.py > trexio.py # c front end cat populated/pop_*.c >> trexio.c @@ -23,7 +23,7 @@ cat helper_fortran.f90 >> trexio_f.f90 cat populated/pop_*.fh_90 >> trexio_f.f90 # python front end -cat populated/pop_*.py >> trexio_api.py +cat populated/pop_*.py >> trexio.py # suffixes cat suffix_s_front.h >> trexio_s.h diff --git a/src/templates_front/templator_front.org b/src/templates_front/templator_front.org index 89fc466..5bf2d43 100644 --- a/src/templates_front/templator_front.org +++ b/src/templates_front/templator_front.org @@ -21,7 +21,7 @@ ** Python #+begin_src python :tangle prefix_python.py try: - from trexio.pytrexio import * + from pytrexio.pytrexio import * except ImportError: raise Exception("Could not import pytrexio module from trexio package") diff --git a/tools/prepare_python.sh b/tools/prepare_python.sh index 7224e2b..8b21506 100755 --- a/tools/prepare_python.sh +++ b/tools/prepare_python.sh @@ -13,7 +13,7 @@ readonly SRC=${TREXIO_ROOT}/src readonly INCLUDIR=${TREXIO_ROOT}/include readonly TOOLS=${TREXIO_ROOT}/tools readonly PYDIR=${TREXIO_ROOT}/python -readonly PYTREXIODIR=${PYDIR}/trexio +readonly PYTREXIODIR=${PYDIR}/pytrexio # We want the script to crash on the 1st error: set -e @@ -24,7 +24,7 @@ mkdir -p ${PYTREXIODIR} # Copy all the source code and header files in the corresponding python directory mv ${SRC}/pytrexio.py ${PYTREXIODIR} -mv ${SRC}/trexio_api.py ${PYTREXIODIR} +mv ${SRC}/trexio.py ${PYDIR} cp ${SRC}/*.c ${PYDIR}/src cp ${SRC}/*.h ${PYDIR}/src cp ${INCLUDIR}/trexio.h ${PYDIR}/src