1
0
mirror of https://github.com/TREX-CoE/qmckl.git synced 2024-11-19 20:42:50 +01:00

Read the version string from the _version.py file

This commit is contained in:
q-posev 2022-05-03 15:07:38 +02:00
parent a3b3323783
commit 3b7b96d451
3 changed files with 23 additions and 8 deletions

View File

@ -1 +1,2 @@
from .pyqmckl import * from .pyqmckl import *
from ._version import __version__

View File

@ -0,0 +1 @@
__version__ = "0.2.0"

View File

@ -6,30 +6,44 @@ setup.py file for pyqmckl package
from setuptools import setup, Extension from setuptools import setup, Extension
from os.path import join from os.path import join
# Read the long description
with open("README.md", "r") as fh: with open("README.md", "r") as fh:
long_description = fh.read() long_description = fh.read()
# Read the version string from the file
VERSIONFILE = "pyqmckl/_version.py"
try:
exec(open(VERSIONFILE).read())
except:
raise IOError("Could not open the version file %s." % (VERSIONFILE, ))
version_r = __version__
if not version_r:
raise RuntimeError("Unable to find a version string in %s." % (VERSIONFILE, ))
# Define the name of the Python package
mod_name = 'pyqmckl' mod_name = 'pyqmckl'
# Define pyqmckl extension module based on TREXIO source codes + SWIG-generated wrapper # Define pyqmckl extension module based on SWIG interface file (requires qmckl.h)
pyqmckl_module = Extension(name = f'{mod_name}._{mod_name}', #f'_{mod_name}', pyqmckl_module = Extension(name = mod_name + '._' + mod_name,
#sources = [ join('src', mod_name + '_wrap.c') ], sources = [ join('src', mod_name + '_wrap.c') ],
sources = [ join('src', f'{mod_name}.i') ],
#include_dirs = [numpy_includedir], #include_dirs = [numpy_includedir],
#library_dirs = [], #library_dirs = [],
#runtime_library_dirs = [], #runtime_library_dirs = [],
libraries = ['qmckl'], libraries = ['qmckl'],
extra_compile_args = ['-Wall'], extra_compile_args = ['-Wall'],
#extra_link_args = [h5_ldflags], #extra_link_args = [h5_ldflags],
swig_opts = ['-py3'], #swig_opts = ['-py3' , '-builtin'],
depends = [ join('src', 'qmckl.h') ], depends = [ join('src', 'qmckl.h') ],
language = 'c' language = 'c'
) )
setup(name = mod_name, setup(name = mod_name,
version = '0.2.0', version = version_r,
author = "TREX-CoE", author = "TREX-CoE",
author_email = "posenitskiy@irsamc.ups-tlse.fr", author_email = "posenitskiy@irsamc.ups-tlse.fr",
description = """Python API of the QMCkl library""", description = """Python API of the QMCkl library""",
@ -37,8 +51,7 @@ setup(name = mod_name,
long_description_content_type = "text/markdown", long_description_content_type = "text/markdown",
ext_modules = [pyqmckl_module], ext_modules = [pyqmckl_module],
py_modules = [mod_name], py_modules = [mod_name],
#package_dir = {"" : "src"}, packages = [mod_name],
packages = ['pyqmckl'],
url = 'https://github.com/TREX-CoE/qmckl', url = 'https://github.com/TREX-CoE/qmckl',
license = 'BSD', license = 'BSD',
classifiers=[ classifiers=[