diff --git a/.gitignore b/.gitignore index d3e5862f91cbcc6aed0fbda53363fca53c28d345..1d72e76ad66a35b73a9041df2777d107e486199c 100644 --- a/.gitignore +++ b/.gitignore @@ -44,3 +44,4 @@ nohup.out *.egg-info/ /wheelhouse .ipynb_checkpoints +/Applications/Python/_version.py diff --git a/pyproject.toml b/pyproject.toml index 5dc4a1ce709360a65a5112869c60e45553ec715b..ed2eeb7f2849347cf18f3519c2bf23bdeea6eccb 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -5,6 +5,7 @@ requires = [ "scikit-build>=0.15.0 ; platform_system != 'Windows'", "cmake>=3.22", "ninja ; platform_system != 'Windows'", + "setuptools_scm[toml]>=7.0", ] build-backend = "setuptools.build_meta" @@ -30,3 +31,10 @@ skip = ["cp36-*", "cp37-*", "cp38-*x86_64"] [tool.cibuildwheel.windows] skip = ["cp36-*", "cp37-*"] + +[tool.setuptools_scm] +write_to = "Applications/Python/_version.py" +write_to_template = "__version__ = '{version}'" +# Switching to guess-next-dev (default) would increment the version number +# This would be in line with PEP 440, switch OGS versioning too? +version_scheme = "no-guess-dev" diff --git a/scripts/ci/jobs/build-wheels.yml b/scripts/ci/jobs/build-wheels.yml index da6d0fd1e74c003eb21593a2485dbf5e5f392a1d..d12d5814eba184f7acd592a0d76b1bc1d9d3c492 100644 --- a/scripts/ci/jobs/build-wheels.yml +++ b/scripts/ci/jobs/build-wheels.yml @@ -1,9 +1,6 @@ stages: - - preparation - build - - check - release - - package workflow: rules: @@ -21,11 +18,9 @@ workflow: include: - local: "scripts/ci/extends/*.yml" - - local: "/scripts/ci/jobs/meta.yml" .wheels_template: &wheels_template stage: build - needs: [meta] script: - pipx run cibuildwheel artifacts: diff --git a/setup.py b/setup.py index 177b162c83044cd175d3252435063e330c22709a..62a104f21add982082872193be68da3d0227705a 100644 --- a/setup.py +++ b/setup.py @@ -3,38 +3,8 @@ from setuptools import find_packages import os import platform -import re -import subprocess import sys - -def get_version(): - git_version = "" - if "OGS_VERSION" in os.environ: - git_version = os.environ["OGS_VERSION"] - else: - git_describe_cmd = ["git describe --tags"] - if platform.system() == "Windows": - git_describe_cmd = ["git", "describe", "--tags"] - git_version = subprocess.run( - git_describe_cmd, - capture_output=True, - text=True, - shell=True, - ).stdout.strip() - - if re.match("\d+\.\d+\.\d+-\d+-g\w+", git_version): - # Make it PEP 440 compliant - # e.g. 6.4.2-1140-g85bbc8b4e1 -> 6.4.2.dev1140 - m = re.match(".+?(?=-g[\w]*$)", git_version) # strip out commit hash - if m: - return m.group(0).replace("-", ".dev") # insert dev - print("ERROR: Could not get ogs version!") - exit(1) - - return git_version - - sys.path.append(os.path.join("Applications", "Python")) from ogs._internal.provide_ogs_cli_tools_via_wheel import binaries_list @@ -53,7 +23,6 @@ long_description = (this_directory / "README.md").read_text() setup( name="ogs", - version=get_version(), description="OpenGeoSys Python Module", long_description=long_description, long_description_content_type="text/markdown",