mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-13 13:27:14 +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
|
||||
|
||||
- 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
|
||||
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:
|
||||
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:
|
||||
number: 0
|
||||
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:
|
||||
name: slsdet
|
||||
version: {{ environ.get('VERSION') }} #2025.3.19
|
||||
|
||||
source:
|
||||
path: ../..
|
||||
version: {{ version }} #
|
||||
|
||||
build:
|
||||
number: 0
|
||||
@ -18,7 +19,6 @@ requirements:
|
||||
- {{ stdlib("c") }}
|
||||
- {{ compiler('cxx') }}
|
||||
|
||||
|
||||
host:
|
||||
- cmake
|
||||
- ninja
|
||||
|
@ -4,7 +4,7 @@ build-backend = "scikit_build_core.build"
|
||||
|
||||
[project]
|
||||
name = "slsdet"
|
||||
version = "2025.3.19"
|
||||
version = "0.0.0"
|
||||
|
||||
[tool.cibuildwheel]
|
||||
before-all = "uname -a"
|
||||
|
@ -6,10 +6,7 @@ Script to update VERSION file with semantic versioning if provided as an argumen
|
||||
|
||||
import sys
|
||||
import re
|
||||
import os
|
||||
import toml
|
||||
import yaml
|
||||
from jinja2 import Template, Undefined
|
||||
|
||||
def get_version():
|
||||
|
||||
@ -26,31 +23,20 @@ def get_version():
|
||||
|
||||
return version
|
||||
|
||||
|
||||
def write_version_to_file(version):
|
||||
with open("VERSION", "w") as version_file:
|
||||
version_file.write(version)
|
||||
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
|
||||
if __name__ == "__main__":
|
||||
|
||||
version = get_version()
|
||||
write_version_to_file(version)
|
||||
define_environment_variable(version)
|
||||
update_pyproject_toml_file(version)
|
||||
|
Reference in New Issue
Block a user