From 6a5e038c80227bdec2c2c4ba9f7e06f10947b47e Mon Sep 17 00:00:00 2001 From: Kingsley Collie Date: Mon, 3 Feb 2025 15:40:40 +0000 Subject: [PATCH 1/2] Use importlib.metadata to get package version --- idlbridge/__init__.py | 8 +++++++- setup.py | 6 ++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/idlbridge/__init__.py b/idlbridge/__init__.py index de451ef..3bda4e2 100644 --- a/idlbridge/__init__.py +++ b/idlbridge/__init__.py @@ -26,9 +26,15 @@ import ctypes as _ctypes from . import _core +try: + from importlib.metadata import version +except ImportError: + # try-except can be removed if requires-python set to >= 3.8 + from importlib_metadata import version + __author__ = 'Dr. Alex Meakins' __responsible_officer__ = 'Dr. Alex Meakins' -__version__ = "1.1.0" +__version__ = version("idlbridge") # By default the core (IDL) library is opened by Python with RTLD_LOCAL # preventing subsequently loaded IDL DLM libraries from seeing the IDL_* diff --git a/setup.py b/setup.py index eb1fbad..c33bcd3 100644 --- a/setup.py +++ b/setup.py @@ -83,6 +83,7 @@ name="idlbridge", version=__version__, description="An IDL wrapper for Python", + requires_python=">=3.4", author='Dr. Alex Meakins', author_email='alex.meakins@ukaea.uk', license="LGPLv3", @@ -96,8 +97,9 @@ "Operating System :: POSIX :: Linux", "Topic :: Scientific/Engineering" ], -# setup_requires=["cython>=0.19"], -# install_requires=["cython>=0.19"], + install_requires=[ + "importlib_metadata>=0.1 ; python_version < \"3.8\"", + ], packages=["idlbridge"], ext_modules=cythonize(extensions, force=force, compiler_directives=directives) ) From 0571c62145936cb6af7e8fa0a74e05f92573eba6 Mon Sep 17 00:00:00 2001 From: Kingsley Collie Date: Mon, 3 Feb 2025 15:41:36 +0000 Subject: [PATCH 2/2] Remove VERSION file --- MANIFEST.in | 2 +- idlbridge/VERSION | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) delete mode 100644 idlbridge/VERSION diff --git a/MANIFEST.in b/MANIFEST.in index 33f21da..603ab84 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,3 +1,3 @@ include README.md MANIFEST.in setup.py .gitignore -recursive-include idlbridge *.py *.pyx *.pxd *.pxi *.pro VERSION +recursive-include idlbridge *.py *.pyx *.pxd *.pxi *.pro recursive-include dev * diff --git a/idlbridge/VERSION b/idlbridge/VERSION deleted file mode 100644 index 1cc5f65..0000000 --- a/idlbridge/VERSION +++ /dev/null @@ -1 +0,0 @@ -1.1.0 \ No newline at end of file