mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-05-01 18:30:05 +02:00
added regex pattern matching to version in toml file
This commit is contained in:
parent
c3f1d05033
commit
2815913d10
@ -4,7 +4,7 @@ source:
|
||||
{% set version = load_file_regex(load_file = 'VERSION', regex_pattern = '(\d+(?:\.\d+)*(?:[\+\w\.]+))').group(1) %}
|
||||
package:
|
||||
name: sls_detector_software
|
||||
version: {{ version }} #2025.3.19
|
||||
version: {{ version }}
|
||||
|
||||
build:
|
||||
number: 0
|
||||
|
@ -4,7 +4,7 @@ source:
|
||||
{% set version = load_file_regex(load_file = 'VERSION', regex_pattern = '(\d+(?:\.\d+)*(?:[\+\w\.]+))').group(1) %}
|
||||
package:
|
||||
name: slsdet
|
||||
version: {{ version }} #
|
||||
version: {{ version }}
|
||||
|
||||
build:
|
||||
number: 0
|
||||
|
@ -1,10 +1,16 @@
|
||||
[tool.scikit-build.metadata.version]
|
||||
provider = "scikit_build_core.metadata.regex"
|
||||
input = "VERSION"
|
||||
regex = '^(?P<version>\d+(?:\.\d+)*(?:[\.\+\w]+)?)$'
|
||||
result = "{version}"
|
||||
|
||||
[build-system]
|
||||
requires = [ "scikit-build-core>=0.10", "pybind11", "numpy",]
|
||||
build-backend = "scikit_build_core.build"
|
||||
|
||||
[project]
|
||||
name = "slsdet"
|
||||
version = "0.0.0"
|
||||
dynamic = ["version"]
|
||||
|
||||
[tool.cibuildwheel]
|
||||
before-all = "uname -a"
|
||||
|
@ -5,10 +5,13 @@ Script to update VERSION file with semantic versioning if provided as an argumen
|
||||
"""
|
||||
|
||||
import sys
|
||||
import re
|
||||
import toml
|
||||
import os
|
||||
|
||||
from packaging.version import Version, InvalidVersion
|
||||
|
||||
|
||||
SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
|
||||
|
||||
def get_version():
|
||||
|
||||
# Check at least one argument is passed
|
||||
@ -26,19 +29,13 @@ def get_version():
|
||||
|
||||
|
||||
def write_version_to_file(version):
|
||||
with open("VERSION", "w") as version_file:
|
||||
version_file_path = os.path.join(SCRIPT_DIR, "VERSION")
|
||||
with open(version_file_path, "w") as version_file:
|
||||
version_file.write(str(version))
|
||||
print(f"Version {version} written to VERSION file.")
|
||||
|
||||
def update_pyproject_toml_file(version):
|
||||
pyproject = toml.load("pyproject.toml")
|
||||
pyproject["project"]["version"] = str(version)
|
||||
toml.dump(pyproject, open("pyproject.toml", "w")) #write back
|
||||
print(f"Version in pyproject.toml set to {version}")
|
||||
|
||||
# Main script
|
||||
if __name__ == "__main__":
|
||||
|
||||
version = get_version()
|
||||
write_version_to_file(version)
|
||||
update_pyproject_toml_file(version)
|
||||
|
Loading…
x
Reference in New Issue
Block a user