diff --git a/.github/workflows/test_python_turso.yml b/.github/workflows/test_python_turso.yml index 761e9445..fac88012 100644 --- a/.github/workflows/test_python_turso.yml +++ b/.github/workflows/test_python_turso.yml @@ -44,6 +44,5 @@ jobs: python -c 'import analysator as pt;pt.plot.__dict__' python -c 'import analysator as pt;pt.calculations.__dict__' python -c 'import analysator as pt;pt.vlsvfile.__dict__' - python -c 'import analysator as pt;pt.miscellaneous.__dict__' + python -c 'import analysator as pt;pt.miscellaneous.__dict__;import analysator.miscellaneous._commithash as chash; print(chash.commithash)' - diff --git a/hatch_build.py b/hatch_build.py new file mode 100644 index 00000000..288a4c2f --- /dev/null +++ b/hatch_build.py @@ -0,0 +1,12 @@ +import sys, subprocess +from hatchling.builders.hooks.plugin.interface import BuildHookInterface +from packaging.version import Version + +class CustomBuildHook(BuildHookInterface): + def initialize(self,*param,**kwargs): + with open("./analysator/miscellaneous/_commithash.py","w") as file: + commithash=subprocess.run(["git","rev-parse","HEAD"],capture_output=True).stdout.decode('utf-8') + commithash=commithash.strip("\n") + file.write(f"commithash='{commithash}'"+"\n") + file.close() + diff --git a/pyproject.toml b/pyproject.toml index 85b2ff89..738c17ea 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,5 +1,5 @@ [build-system] -requires = ["hatchling"] +requires = ["hatchling","pip"] build-backend = "hatchling.build" @@ -52,6 +52,8 @@ vlsvrs_build = [ Homepage = "https://github.com/fmihpc/analysator" Issues = "https://github.com/fmihpc/analysator/issues" +[tool.hatch.build.hooks.custom] + [tool.hatch.build.targets.wheel] packages = ["./analysator","./pytools"]