mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-14 22:07:12 +02:00
managed to load VERSION file in yaml file - simplifies things
This commit is contained in:
2
.github/workflows/conda_python.yaml
vendored
2
.github/workflows/conda_python.yaml
vendored
@ -33,7 +33,7 @@ jobs:
|
|||||||
run: conda config --set anaconda_upload no
|
run: conda config --set anaconda_upload no
|
||||||
|
|
||||||
- name: Build
|
- name: Build
|
||||||
run: ./conda-recipes/build_conda.sh build_output python-client
|
run: conda build ./conda-recipes/python-client --build-folder build_output
|
||||||
|
|
||||||
- name: Upload all Conda packages
|
- name: Upload all Conda packages
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
|
@ -1,23 +0,0 @@
|
|||||||
|
|
||||||
SCRIPTDIR=$(cd "$(dirname "$0")" && pwd)
|
|
||||||
VERSION=$(cat $SCRIPTDIR/../VERSION)
|
|
||||||
export VERSION
|
|
||||||
|
|
||||||
if [ -z "$1" ]
|
|
||||||
then
|
|
||||||
output_dir=$CONDA_PREFIX/conda-bld
|
|
||||||
else
|
|
||||||
output_dir=$1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -z "$2" ]
|
|
||||||
then
|
|
||||||
recipe=$SCRIPTDIR
|
|
||||||
else
|
|
||||||
recipe=$SCRIPTDIR/$2
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "building conda package version: $VERSION using recipe $recipe and writing output to $output_dir"
|
|
||||||
|
|
||||||
|
|
||||||
conda build $recipe --output-folder $output_dir
|
|
@ -1,11 +1,11 @@
|
|||||||
#{% set version = load_file('VERSION').strip %}
|
|
||||||
package:
|
|
||||||
name: sls_detector_software
|
|
||||||
version: {{ environ.get('VERSION') }} #2025.3.19
|
|
||||||
|
|
||||||
source:
|
source:
|
||||||
path: ../..
|
path: ../..
|
||||||
|
|
||||||
|
{% set version = load_file_regex(load_file = 'VERSION', regex_pattern = '(\d+\.\d+\.\d+)').group(1) %}
|
||||||
|
package:
|
||||||
|
name: sls_detector_software
|
||||||
|
version: {{ version }} #2025.3.19
|
||||||
|
|
||||||
build:
|
build:
|
||||||
number: 0
|
number: 0
|
||||||
binary_relocation: True
|
binary_relocation: True
|
||||||
|
@ -1,10 +1,11 @@
|
|||||||
|
source:
|
||||||
|
path: ../..
|
||||||
|
|
||||||
|
{% set version = load_file_regex(load_file = 'VERSION', regex_pattern = '(\d+\.\d+\.\d+)').group(1) %}
|
||||||
|
|
||||||
package:
|
package:
|
||||||
name: slsdet
|
name: slsdet
|
||||||
version: {{ environ.get('VERSION') }} #2025.3.19
|
version: {{ version }} #
|
||||||
|
|
||||||
source:
|
|
||||||
path: ../..
|
|
||||||
|
|
||||||
build:
|
build:
|
||||||
number: 0
|
number: 0
|
||||||
@ -18,7 +19,6 @@ requirements:
|
|||||||
- {{ stdlib("c") }}
|
- {{ stdlib("c") }}
|
||||||
- {{ compiler('cxx') }}
|
- {{ compiler('cxx') }}
|
||||||
|
|
||||||
|
|
||||||
host:
|
host:
|
||||||
- cmake
|
- cmake
|
||||||
- ninja
|
- ninja
|
||||||
|
@ -4,7 +4,7 @@ build-backend = "scikit_build_core.build"
|
|||||||
|
|
||||||
[project]
|
[project]
|
||||||
name = "slsdet"
|
name = "slsdet"
|
||||||
version = "2025.3.19"
|
version = "0.0.0"
|
||||||
|
|
||||||
[tool.cibuildwheel]
|
[tool.cibuildwheel]
|
||||||
before-all = "uname -a"
|
before-all = "uname -a"
|
||||||
|
@ -6,10 +6,7 @@ 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 toml
|
||||||
import yaml
|
|
||||||
from jinja2 import Template, Undefined
|
|
||||||
|
|
||||||
def get_version():
|
def get_version():
|
||||||
|
|
||||||
@ -26,31 +23,20 @@ def get_version():
|
|||||||
|
|
||||||
return version
|
return version
|
||||||
|
|
||||||
|
|
||||||
def write_version_to_file(version):
|
def write_version_to_file(version):
|
||||||
with open("VERSION", "w") as version_file:
|
with open("VERSION", "w") as version_file:
|
||||||
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):
|
def update_pyproject_toml_file(version):
|
||||||
pyproject = toml.load("pyproject.toml")
|
pyproject = toml.load("pyproject.toml")
|
||||||
pyproject["project"]["version"] = version
|
pyproject["project"]["version"] = version
|
||||||
toml.dump(pyproject, open("pyproject.toml", "w")) #write back
|
toml.dump(pyproject, open("pyproject.toml", "w")) #write back
|
||||||
print(f"Version in pyproject.toml set to {version}")
|
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)
|
update_pyproject_toml_file(version)
|
||||||
|
Reference in New Issue
Block a user