mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-13 21:37:13 +02:00
version number automated for python build
This commit is contained in:
8
conda-recipes/build_conda.sh
Executable file
8
conda-recipes/build_conda.sh
Executable file
@ -0,0 +1,8 @@
|
|||||||
|
|
||||||
|
SCRIPTDIR=$(cd "$(dirname "$0")" && pwd)
|
||||||
|
VERSION=$(cat $SCRIPTDIR/../VERSION)
|
||||||
|
export VERSION
|
||||||
|
|
||||||
|
echo "building conda package version: $VERSION"
|
||||||
|
|
||||||
|
conda build .
|
@ -1,8 +1,8 @@
|
|||||||
|
#{% set version = load_file('VERSION').strip %}
|
||||||
package:
|
package:
|
||||||
name: sls_detector_software
|
name: sls_detector_software
|
||||||
version: 2025.3.19
|
version: {{ environ.get('VERSION') }} #2025.3.19
|
||||||
|
|
||||||
|
|
||||||
source:
|
source:
|
||||||
path: ../..
|
path: ../..
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
package:
|
package:
|
||||||
name: slsdet
|
name: slsdet
|
||||||
version: 2025.3.19 #TODO! how to not duplicate this?
|
version: 0.0.0
|
||||||
|
|
||||||
source:
|
source:
|
||||||
path: ../..
|
path: ../..
|
||||||
|
|
||||||
|
@ -1,27 +1,27 @@
|
|||||||
[build-system]
|
[build-system]
|
||||||
requires = ["scikit-build-core>=0.10", "pybind11", "numpy"]
|
requires = [ "scikit-build-core>=0.10", "pybind11", "numpy",]
|
||||||
build-backend = "scikit_build_core.build"
|
build-backend = "scikit_build_core.build"
|
||||||
|
|
||||||
[project]
|
[project]
|
||||||
name = "slsdet"
|
name = "slsdet"
|
||||||
version = "2025.3.19"
|
version = "2025.3.19"
|
||||||
|
|
||||||
|
|
||||||
[tool.cibuildwheel]
|
[tool.cibuildwheel]
|
||||||
before-all = "uname -a"
|
before-all = "uname -a"
|
||||||
|
|
||||||
[tool.scikit-build]
|
[tool.scikit-build.build]
|
||||||
build.verbose = true
|
verbose = true
|
||||||
cmake.build-type = "Release"
|
|
||||||
install.components = ["python"]
|
|
||||||
|
|
||||||
|
[tool.scikit-build.cmake]
|
||||||
|
build-type = "Release"
|
||||||
|
|
||||||
|
[tool.scikit-build.install]
|
||||||
|
components = [ "python",]
|
||||||
|
|
||||||
[tool.scikit-build.cmake.define]
|
[tool.scikit-build.cmake.define]
|
||||||
#Only build the control software and python ext
|
|
||||||
SLS_USE_RECEIVER = "OFF"
|
SLS_USE_RECEIVER = "OFF"
|
||||||
SLS_USE_RECEIVER_BINARIES = "OFF"
|
SLS_USE_RECEIVER_BINARIES = "OFF"
|
||||||
SLS_USE_TEXTCLIENT = "OFF"
|
SLS_USE_TEXTCLIENT = "OFF"
|
||||||
SLS_BUILD_SHARED_LIBRARIES = "OFF"
|
SLS_BUILD_SHARED_LIBRARIES = "OFF"
|
||||||
|
|
||||||
SLS_USE_PYTHON = "ON"
|
SLS_USE_PYTHON = "ON"
|
||||||
SLS_INSTALL_PYTHONEXT = "ON"
|
SLS_INSTALL_PYTHONEXT = "ON"
|
||||||
|
@ -6,6 +6,10 @@ Script to update VERSION file with semantic versioning if provided as an argumen
|
|||||||
|
|
||||||
import sys
|
import sys
|
||||||
import re
|
import re
|
||||||
|
import os
|
||||||
|
import toml
|
||||||
|
import yaml
|
||||||
|
from jinja2 import Template, Undefined
|
||||||
|
|
||||||
def get_version():
|
def get_version():
|
||||||
|
|
||||||
@ -28,9 +32,25 @@ def write_version_to_file(version):
|
|||||||
version_file.write(version)
|
version_file.write(version)
|
||||||
print(f"Version {version} written to VERSION file.")
|
print(f"Version {version} written to VERSION file.")
|
||||||
|
|
||||||
|
def define_environment_variable(version):
|
||||||
|
os.environ["VERSION"] = version
|
||||||
|
|
||||||
|
def update_pyproject_toml_file(version):
|
||||||
|
pyproject = toml.load("pyproject.toml")
|
||||||
|
pyproject["project"]["version"] = version
|
||||||
|
toml.dump(pyproject, open("pyproject.toml", "w")) #write back
|
||||||
|
print(f"Version in pyproject.toml set to {version}")
|
||||||
|
|
||||||
|
class NullUndefined(Undefined):
|
||||||
|
def __getattr__(self, key):
|
||||||
|
return ''
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Main script
|
# Main script
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
||||||
version = get_version()
|
version = get_version()
|
||||||
write_version_to_file(version)
|
write_version_to_file(version)
|
||||||
|
define_environment_variable(version)
|
||||||
|
update_pyproject_toml_file(version)
|
||||||
|
Reference in New Issue
Block a user