diff --git a/pyproject.toml b/pyproject.toml index 4bf24d6..0225ee8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -3,7 +3,7 @@ requires = ['hatchling'] build-backend = 'hatchling.build' [project] -name = 'pycrysfml08' +name = 'pycrysfml' version = '0.1.0' description = 'Testing packaging PyCrysFML08 from https://code.ill.fr/scientific-software/PyCrysFML08' authors = [ @@ -43,5 +43,5 @@ test = [ Homepage = 'https://github.com/easyscience/TEST_PyCrysFML' [tool.hatch.build.targets.wheel] -packages = ['pycrysfml08_dist/pycrysfml08'] +packages = ['dist/pyCFML/pycrysfml'] # NEED FIX: Replace based on scripts.toml? artifacts = ['*.py', '*.so', '*.so.*', '*.dylib', '*.pyd', '*.dll', '*.txt'] diff --git a/scripts.py b/scripts.py index c027e96..31ad6b3 100644 --- a/scripts.py +++ b/scripts.py @@ -532,7 +532,8 @@ def build_cfml_modules_obj(): lines.append(cmd) msg = _echo_msg(f"Building fortran objects for {project_name} modules") lines.append(msg) - compile_lines = _compile_objs_script_lines('src-cfml-modules', src_path) + compile_lines = _compile_objs_script_lines('src-cfml-modules', + src_path) lines.extend(compile_lines) msg = _echo_msg(f"Exiting build dir '{build_dir}'") lines.append(msg) @@ -864,13 +865,11 @@ def build_pycfml_shared_obj_or_dynamic_lib(): _write_lines_to_file(lines, script_name) append_to_main_script(lines) - - def create_pycfml_dist_dir(): dist_dir = CONFIG['pycfml']['dir']['dist'] lib_dist_dir = CONFIG['pycfml']['dir']['dist-lib'] include_dist_dir = CONFIG['pycfml']['dir']['dist-include'] - package_dist_dir = CONFIG['pycfml']['dir']['dist-package'] + package_dist_dir = CONFIG['pycfml']['dir']['dist-package'].replace('{PACKAGE_NAME}', PYPROJECT['project']['name']) wheel_dist_dir = CONFIG['pycfml']['dir']['dist-wheel'] lines = [] msg = _echo_msg(f"Deleting dist dir '{dist_dir}'") @@ -1128,9 +1127,9 @@ def create_pycfml_python_wheel(): def rename_pycfml_python_wheel(): project_name = CONFIG['pycfml']['log-name'] - pycfml_package_name = CONFIG['pycfml']['package-name'] + dist_package_name = PYPROJECT['project']['name'] dist_package_version = PYPROJECT['project']['version'] - initial_wheel_name = f'{pycfml_package_name}-{dist_package_version}-py3-none-any.whl' + initial_wheel_name = f'{dist_package_name}-{dist_package_version}-py3-none-any.whl' wheel_dir = CONFIG['pycfml']['dir']['dist-wheel'] wheel_relpath = os.path.join(wheel_dir, initial_wheel_name) wheel_abspath = os.path.join(_project_path(), wheel_relpath) @@ -1148,7 +1147,7 @@ def rename_pycfml_python_wheel(): def install_pycfml_from_wheel(): project_name = CONFIG['pycfml']['log-name'] - package_name = CONFIG['pycfml']['package-name'] + package_name = PYPROJECT['project']['name'] wheel_dir = CONFIG['pycfml']['dir']['dist-wheel'] wheel_path = os.path.join(_project_path(), wheel_dir) lines = [] diff --git a/scripts.toml b/scripts.toml index 1ddf785..1a43955 100644 --- a/scripts.toml +++ b/scripts.toml @@ -7,22 +7,22 @@ log-name = 'CFML' static-lib-name = 'CrysFML08' # without 'lib' prefix on unix-based platforms [cfml.dir] -repo = 'repo/crysfml' -repo-src = 'repo/crysfml/Src' -repo-tests = 'repo/crysfml/Testing' -repo-database = 'repo/crysfml/Src/Databases/magnetic_data.txt' -build = 'build/crysfml' -build-obj = 'build/crysfml/obj' -dist = 'dist/crysfml' # Fortran CrysFML2008 -dist-include = 'dist/crysfml/include' # for .mod/.smod files -dist-lib = 'dist/crysfml/lib' # for static library +repo = 'repo/CFML' +repo-src = 'repo/CFML/Src' +repo-tests = 'repo/CFML/Testing' +repo-database = 'repo/CFML/Src/Databases/magnetic_data.txt' +build = 'build/CFML' +build-obj = 'build/CFML/obj' +dist = 'dist/CFML' # Fortran CrysFML2008 +dist-include = 'dist/CFML/include' # for .mod/.smod files +dist-lib = 'dist/CFML/lib' # for static library [cfml.git] url = 'https://code.ill.fr/scientific-software/crysfml2008.git' branch = 'powder_mod_fix' [cfml.scripts] -pyapigen = 'repo/crysfml/Scripts/PythonAPI/apigen.py' +pyapigen = 'repo/CFML/Scripts/PythonAPI/apigen.py' ############################################# # Python API for CrysFML Fortran 2008 Library @@ -32,18 +32,17 @@ pyapigen = 'repo/crysfml/Scripts/PythonAPI/apigen.py' log-name = 'pyCFML' src-name = 'crysfml08lib' dynamic-lib-name = 'crysfml08lib' # NEED FIX: currently not in use in scripts.py -package-name = 'pycrysfml08' [pycfml.dir] -build-src = 'build/pycrysfml/src' # content will be generated by apigen.py -build-src-fortran = 'build/pycrysfml/src/Fortran' -build-src-python = 'build/pycrysfml/src/Python_API' -build-obj = 'build/pycrysfml/obj' -dist = 'dist/pycrysfml' # Python API to Fortran CrysFML2008 -dist-include = 'dist/pycrysfml/include' # for .mod/.smod files -dist-lib = 'dist/pycrysfml/lib' # for static object or dynamic library -dist-package = 'dist/pycrysfml/pycrysfml08' # for Python package -dist-wheel = 'dist/pycrysfml/wheel' # for Python wheel +build-src = 'build/pyCFML/src' # content will be generated by apigen.py +build-src-fortran = 'build/pyCFML/src/Fortran' +build-src-python = 'build/pyCFML/src/Python_API' +build-obj = 'build/pyCFML/obj' +dist = 'dist/pyCFML' # Python API to Fortran CrysFML2008 +dist-include = 'dist/pyCFML/include' # for .mod/.smod files +dist-lib = 'dist/pyCFML/lib' # for static object or dynamic library +dist-package = 'dist/pyCFML/{PACKAGE_NAME}' # for Python package +dist-wheel = 'dist/pyCFML/wheel' # for Python wheel ######################################################## # Generic build template commands and related parameters