Skip to content

Commit 12b7d7e

Browse files
cleanup and squash all changes
1 parent 98af002 commit 12b7d7e

10 files changed

Lines changed: 133 additions & 143 deletions

File tree

.github/workflows/actions_build/action.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ runs:
4545
fi
4646
- name: Cache modules
4747
id: cache_opengate_core_dependencies
48-
uses: actions/cache@v4
48+
uses: actions/cache@v5
4949
with:
5050
path: ~/software
5151
key: ${{ runner.os }}-${{ steps.get-os-version.outputs.release }}_geant4_${{ env.GEANT4_VERSION }}_itk_${{ env.ITK_VERSION }}_build
@@ -66,6 +66,7 @@ runs:
6666
env:
6767
MATRIX_OS: ${{ inputs.os }}
6868
MATRIX_PYTHON_VERSION: ${{ inputs.python-version }}
69+
MATRIX_CACHE: ${{ steps.cache_opengate_core_dependencies.outputs.cache-hit }}
6970
shell: bash -l {0}
7071
run: |
7172
export > $GITHUB_WORKSPACE/env_dump.txt
@@ -85,6 +86,7 @@ runs:
8586
env:
8687
MATRIX_CACHE: ${{ steps.cache_opengate_core_dependencies.outputs.cache-hit }}
8788
MATRIX_PYTHON_VERSION: ${{ inputs.python-version }}
89+
MATRIX_OS: ${{ inputs.os }}
8890
shell: bash -l {0}
8991
run: |
9092
export > $GITHUB_WORKSPACE\\env_dump.txt

.github/workflows/actions_build/ci_build_wheel_macos.sh

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ python --version
2525
export PATH="/usr/local/miniconda/envs/opengate_core/bin/:$PATH"
2626
pip install wget colored
2727
pip install wheel delocate
28+
pip install cibuildwheel==3.4.0
2829
if [[ ${MATRIX_OS} == "macos-15-intel" ]]; then
2930
conda install conda-forge::qt6-main conda-forge::qt6-3d
3031
else
@@ -75,20 +76,22 @@ else
7576
cp -r /opt/homebrew/share/qt/plugins/platforms/* opengate_core/plugins/
7677
cp -r /opt/homebrew/share/qt/plugins/imageformats/* opengate_core/plugins/
7778
fi
78-
python3 setup.py sdist bdist_wheel
79-
ls dist
79+
export CIBW_BUILD_PLATFORM="build[uv]"
80+
export CIBW_PLATFORM="macos"
81+
export CIBW_SKIP="*t*"
82+
export MACOSX_DEPLOYMENT_TARGET=15.0
83+
export CIBW_BEFORE_BUILD="python -m pip install colored"
84+
8085
if [[ ${MATRIX_OS} == "macos-15-intel" ]]; then
8186
export DYLD_LIBRARY_PATH=$HOME/software/geant4/bin/BuildProducts/lib:/Users/runner/miniconda3/envs/opengate_core/lib/qt6/plugins/platforms:/opt/X11/lib/:$DYLD_LIBRARY_PATH:/Users/runner/miniconda3/envs/opengate_core/lib
87+
export CIBW_ARCHS_MACOS="x86_64"
8288
else
8389
export DYLD_LIBRARY_PATH=$HOME/software/geant4/bin/BuildProducts/lib:/opt/homebrew/share/qt/plugins/platforms/:/opt/X11/lib/:$DYLD_LIBRARY_PATH:/opt/homebrew/lib
90+
export CIBW_ARCHS_MACOS="arm64"
8491
python -c "import os,delocate; print(os.path.join(os.path.dirname(delocate.__file__), 'tools.py'));quit()" | xargs -I{} sed -i."" "s/first, /input.pop('i386',None); first, /g" {}
8592
fi
86-
delocate-listdeps --all dist/*.whl
87-
delocate-wheel -w fixed_wheels -v dist/*.whl
88-
rm -rf dist
89-
ls fixed_wheels
90-
delocate-listdeps --all fixed_wheels/*.whl
91-
mv fixed_wheels dist
93+
94+
python -m cibuildwheel --output-dir dist
9295
cd dist
9396
if [[ ${MATRIX_OS} == "macos-15-intel" ]]; then
9497
find . -name '*whl' -exec bash -c ' mv $0 ${0/macosx_15_0/macosx_10_9}' {} \;

.github/workflows/actions_build/ci_build_wheel_ubuntu.sh

Lines changed: 36 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,42 @@
22
set -e
33

44
source $GITHUB_WORKSPACE/env_dump.txt
5-
if [ ${MATRIX_PYTHON_VERSION} == "3.10" ]; then
6-
export PYTHONFOLDER="cp310-cp310"
7-
elif [ ${MATRIX_PYTHON_VERSION} == "3.11" ]; then
8-
export PYTHONFOLDER="cp311-cp311"
9-
elif [ ${MATRIX_PYTHON_VERSION} == "3.12" ]; then
10-
export PYTHONFOLDER="cp312-cp312"
11-
elif [ ${MATRIX_PYTHON_VERSION} == "3.13" ]; then
12-
export PYTHONFOLDER="cp313-cp313"
13-
elif [ ${MATRIX_PYTHON_VERSION} == "3.14" ]; then
14-
export PYTHONFOLDER="cp314-cp314"
15-
fi
16-
mkdir -p $HOME/software
5+
6+
# install cibuildwheel
7+
pip install cibuildwheel==3.4.0
8+
pip install wget colored setuptools
9+
10+
# Setup the environment for the build
1711
if [ ${MATRIX_OS} == "ubuntu-24.04-arm" ]; then
1812
export ARMDOCKER="_arm64"
13+
export CIBW_ARCHS="aarch64"
14+
export CIBW_MANYLINUX_AARCH64_IMAGE=tbaudier/opengate_core:${GEANT4_VERSION}$ARMDOCKER
15+
else
16+
export CIBW_ARCHS="x86_64"
17+
export CIBW_MANYLINUX_X86_64_IMAGE=tbaudier/opengate_core:${GEANT4_VERSION}
1918
fi
20-
docker run --rm -e "PYTHONFOLDER=${PYTHONFOLDER}" -v $GITHUB_WORKSPACE:/home tbaudier/opengate_core:${GEANT4_VERSION}$ARMDOCKER /home/.github/workflows/createWheelLinux.sh
21-
ls wheelhouse
22-
rm -rf dist
23-
mv wheelhouse dist
24-
sudo chown -R runner:docker dist
19+
export CIBW_PLATFORM="linux"
20+
export CIBW_SKIP="*-musllinux_* *t*"
21+
export CIBW_BEFORE_BUILD='
22+
python -m pip install colored &&
23+
mkdir -p opengate_core/plugins &&
24+
export QT_PLUGIN_DIR=$(qtpaths6 --plugin-dir) &&
25+
cp -r -n $QT_PLUGIN_DIR/platforms/* opengate_core/plugins/ &&
26+
cp -r -n $QT_PLUGIN_DIR/imageformats opengate_core/plugins/ &&
27+
source /software/geant4/bin/geant4make.sh &&
28+
. /opt/rh/gcc-toolset-14/enable
29+
'
30+
31+
# expose external libraries to build environment
32+
export CIBW_ENVIRONMENT='
33+
CMAKE_PREFIX_PATH=/software/geant4/bin:/software/itk/bin/
34+
Geant4_DIR=/software/geant4/lib/cmake/Geant4
35+
ITK_DIR=/software/itk/lib/cmake/ITK
36+
LD_LIBRARY_PATH=/software/geant4/lib:/software/itk/lib
37+
'
38+
39+
# Run the build in custom docker
40+
cd core
41+
python -m cibuildwheel --output-dir dist
42+
mkdir -p $GITHUB_WORKSPACE/dist
43+
mv dist/*.whl $GITHUB_WORKSPACE/dist/

.github/workflows/actions_build/ci_build_wheel_windows.sh

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -54,17 +54,15 @@ cd $GITHUB_WORKSPACE
5454
source $HOME/software/geant4/bin/geant4make.sh
5555
export CMAKE_PREFIX_PATH=$HOME/software/geant4/bin:$HOME/software/itk/bin/:${CMAKE_PREFIX_PATH}
5656
cd core
57-
if [[ ${MATRIX_PYTHON_VERSION} == "3.10" ]]; then
58-
export CIBW_BUILD="cp310-win_amd64"
59-
elif [[ ${MATRIX_PYTHON_VERSION} == "3.11" ]]; then
60-
export CIBW_BUILD="cp311-win_amd64"
61-
elif [[ ${MATRIX_PYTHON_VERSION} == "3.12" ]]; then
62-
export CIBW_BUILD="cp312-win_amd64"
63-
elif [[ ${MATRIX_PYTHON_VERSION} == "3.13" ]]; then
64-
export CIBW_BUILD="cp313-win_amd64"
65-
elif [[ ${MATRIX_PYTHON_VERSION} == "3.14" ]]; then
66-
export CIBW_BUILD="cp314-win_amd64"
57+
echo ${MATRIX_OS}
58+
if [[ ${MATRIX_OS} == "windows-11-arm" ]]; then
59+
export CIBW_ARCHS="ARM64"
60+
else
61+
export CIBW_ARCHS="AMD64"
6762
fi
63+
export CIBW_BUILD_PLATFORM="build[uv]"
64+
export CIBW_SKIP="*t*"
65+
export CIBW_PLATFORM="windows"
6866
find $HOME/software/geant4/bin/ -iname "*.dll"
6967
ls $HOME/software/geant4/bin/BuildProducts/Release/bin
7068
ls $HOME/software/geant4/bin/BuildProducts/Release/lib/

.github/workflows/createWheelLinux.sh

Lines changed: 0 additions & 24 deletions
This file was deleted.

.github/workflows/delocateWindows.py

Lines changed: 65 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -98,73 +98,74 @@ def mangle_filename(old_filename, new_filename, mapping):
9898
wheel_name = args.WHEEL_FILE
9999
print(wheel_name)
100100
print(os.path.join(wheel_name, "opengate_core-*-win_amd64.whl"))
101-
wheel_name = glob.glob(os.path.join(wheel_name, "opengate_core-*-win_amd64.whl"))[0]
102-
print(wheel_name)
103-
repaired_wheel = os.path.join(
104-
os.path.abspath(args.WHEEL_DIR), os.path.basename(wheel_name)
105-
)
101+
wheel_names = glob.glob(os.path.join(wheel_name, "opengate_core-*-win_amd64.whl"))
102+
for wheel_name in wheel_names:
103+
print(wheel_name)
104+
repaired_wheel = os.path.join(
105+
os.path.abspath(args.WHEEL_DIR), os.path.basename(wheel_name)
106+
)
107+
108+
old_wheel_dir = tempfile.mkdtemp()
109+
new_wheel_dir = tempfile.mkdtemp()
110+
package_name = os.path.basename(wheel_name).split("-")[0]
111+
bundle_name = package_name + ".libs"
112+
bundle_path = os.path.join(new_wheel_dir, bundle_name)
113+
os.makedirs(bundle_path)
114+
115+
with zipfile.ZipFile(wheel_name, "r") as wheel:
116+
wheel.extractall(old_wheel_dir)
117+
wheel.extractall(new_wheel_dir)
118+
pyd_rel_paths = [
119+
os.path.normpath(path) for path in wheel.namelist() if path.endswith(".pyd")
120+
]
121+
122+
dll_dependencies = {}
123+
for rel_path in pyd_rel_paths:
124+
abs_path = os.path.join(old_wheel_dir, rel_path)
125+
print(rel_path)
126+
dll_dependencies.update(find_dll_dependencies(abs_path, args.DLL_DIR))
127+
128+
for dll, dependencies in dll_dependencies.items():
129+
mapping = {}
130+
131+
print(dll)
132+
print(dependencies)
106133

107-
old_wheel_dir = tempfile.mkdtemp()
108-
new_wheel_dir = tempfile.mkdtemp()
109-
package_name = os.path.basename(wheel_name).split("-")[0]
110-
bundle_name = package_name + ".libs"
111-
bundle_path = os.path.join(new_wheel_dir, bundle_name)
112-
os.makedirs(bundle_path)
113-
114-
with zipfile.ZipFile(wheel_name, "r") as wheel:
115-
wheel.extractall(old_wheel_dir)
116-
wheel.extractall(new_wheel_dir)
117-
pyd_rel_paths = [
118-
os.path.normpath(path) for path in wheel.namelist() if path.endswith(".pyd")
119-
]
120-
121-
dll_dependencies = {}
122-
for rel_path in pyd_rel_paths:
123-
abs_path = os.path.join(old_wheel_dir, rel_path)
124-
print(rel_path)
125-
dll_dependencies.update(find_dll_dependencies(abs_path, args.DLL_DIR))
126-
127-
for dll, dependencies in dll_dependencies.items():
128-
mapping = {}
129-
130-
print(dll)
131-
print(dependencies)
132-
133-
if dll.endswith(".pyd"):
134-
rel_path = next(path for path in pyd_rel_paths if path.endswith(dll))
135-
136-
for dep in dependencies:
137-
src_path = os.path.join(args.DLL_DIR, dep)
138-
hashed_name = hash_filename(src_path) # already basename
139-
new_path = os.path.join(bundle_path, hashed_name)
140134
if dll.endswith(".pyd"):
141-
bundle_rel_path = os.path.join(
142-
"..\\" * rel_path.count(os.path.sep), bundle_name
143-
)
144-
mapping[dep.encode("ascii")] = os.path.join(
145-
bundle_rel_path, hashed_name
146-
).encode("ascii")
147-
else:
148-
mapping[dep.encode("ascii")] = hashed_name.encode("ascii")
149-
if not os.path.exists(new_path):
150-
shutil.copy2(src_path, new_path)
135+
rel_path = next(path for path in pyd_rel_paths if path.endswith(dll))
136+
137+
for dep in dependencies:
138+
src_path = os.path.join(args.DLL_DIR, dep)
139+
hashed_name = hash_filename(src_path) # already basename
140+
new_path = os.path.join(bundle_path, hashed_name)
141+
if dll.endswith(".pyd"):
142+
bundle_rel_path = os.path.join(
143+
"..\\" * rel_path.count(os.path.sep), bundle_name
144+
)
145+
mapping[dep.encode("ascii")] = os.path.join(
146+
bundle_rel_path, hashed_name
147+
).encode("ascii")
148+
else:
149+
mapping[dep.encode("ascii")] = hashed_name.encode("ascii")
150+
if not os.path.exists(new_path):
151+
shutil.copy2(src_path, new_path)
151152

152-
if dll.endswith(".pyd"):
153-
old_name = os.path.join(old_wheel_dir, rel_path)
154-
new_name = os.path.join(new_wheel_dir, rel_path)
155-
else:
156-
old_name = os.path.join(args.DLL_DIR, dll)
157-
hashed_name = hash_filename(old_name) # already basename
158-
new_name = os.path.join(bundle_path, hashed_name)
159-
160-
mangle_filename(old_name, new_name, mapping)
161-
162-
pathlib.Path(os.path.dirname(repaired_wheel)).mkdir(parents=True, exist_ok=True)
163-
with zipfile.ZipFile(repaired_wheel, "w", zipfile.ZIP_DEFLATED) as new_wheel:
164-
for root, dirs, files in os.walk(new_wheel_dir):
165-
new_root = os.path.relpath(root, new_wheel_dir)
166-
for file in files:
167-
new_wheel.write(os.path.join(root, file), os.path.join(new_root, file))
153+
if dll.endswith(".pyd"):
154+
old_name = os.path.join(old_wheel_dir, rel_path)
155+
new_name = os.path.join(new_wheel_dir, rel_path)
156+
else:
157+
old_name = os.path.join(args.DLL_DIR, dll)
158+
hashed_name = hash_filename(old_name) # already basename
159+
new_name = os.path.join(bundle_path, hashed_name)
160+
161+
mangle_filename(old_name, new_name, mapping)
162+
163+
pathlib.Path(os.path.dirname(repaired_wheel)).mkdir(parents=True, exist_ok=True)
164+
with zipfile.ZipFile(repaired_wheel, "w", zipfile.ZIP_DEFLATED) as new_wheel:
165+
for root, dirs, files in os.walk(new_wheel_dir):
166+
new_root = os.path.relpath(root, new_wheel_dir)
167+
for file in files:
168+
new_wheel.write(os.path.join(root, file), os.path.join(new_root, file))
168169

169170
now = datetime.now()
170171
print(now.strftime("%H:%M:%S"))

.github/workflows/main.yml

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030
fail-fast: false
3131
matrix:
3232
os: [ubuntu-24.04]
33-
python-version: ['3.10']
33+
python-version: ['3.14']
3434
steps:
3535
- name: Checkout github repo
3636
uses: actions/checkout@v6
@@ -62,12 +62,7 @@ jobs:
6262
fail-fast: false
6363
matrix:
6464
os: [ubuntu-24.04, macos-15, windows-2025]
65-
python-version: ['3.10', '3.11', '3.12', '3.13', '3.14']
66-
exclude:
67-
- os: macos-15
68-
python-version: '3.10'
69-
- os: windows-2025
70-
python-version: '3.10'
65+
python-version: ['3.14']
7166
steps:
7267
- name: Checkout github repo
7368
uses: actions/checkout@v6
@@ -96,13 +91,8 @@ jobs:
9691
strategy:
9792
fail-fast: false
9893
matrix:
99-
os: [ubuntu-24.04-arm, macos-15-intel]
100-
python-version: ['3.10', '3.11', '3.12', '3.13', '3.14']
101-
exclude:
102-
- os: macos-15
103-
python-version: '3.10'
104-
- os: windows-2025
105-
python-version: '3.10'
94+
os: [ubuntu-24.04-arm, macos-15-intel, windows-11-arm]
95+
python-version: ['3.14']
10696
steps:
10797
- name: Checkout github repo
10898
uses: actions/checkout@v6
@@ -157,7 +147,7 @@ jobs:
157147
echo "release=${varOS}" >> $GITHUB_OUTPUT
158148
- name: Cache modules
159149
id: cache_opengate_core_dependencies
160-
uses: actions/cache@v4
150+
uses: actions/cache@v5
161151
with:
162152
path: ~/software
163153
key: ${{ runner.os }}-${{ steps.get-os-version.outputs.release }}_geant4_${{ env.GEANT4_VERSION }}_itk_${{ env.ITK_VERSION }}_build
@@ -257,7 +247,7 @@ jobs:
257247
# echo "release=${varOS:1}" >> $GITHUB_OUTPUT
258248
# - name: Cache modules
259249
# id: cache_opengate_core_dependencies
260-
# uses: actions/cache@v4
250+
# uses: actions/cache@v5
261251
# with:
262252
# path: ~/software
263253
# key: ${{ runner.os }}-${{ steps.get-os-version.outputs.release }}_geant4_${{ env.GEANT4_VERSION }}_itk_${{ env.ITK_VERSION }}_build
@@ -312,7 +302,7 @@ jobs:
312302
miniconda-version: "latest"
313303
auto-update-conda: true
314304
activate-environment: vega-altair
315-
python-version: '3.10'
305+
python-version: '3.14'
316306
- name: Merge the results
317307
shell: bash -el {0}
318308
run: |

core/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# See LICENSE.md for further details
66
# --------------------------------------------------
77

8-
cmake_minimum_required(VERSION 3.5.0)
8+
cmake_minimum_required(VERSION 3.10.0)
99

1010
# remove warning about project version
1111
cmake_policy(SET CMP0048 NEW)

core/VERSION

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
10.0.3

0 commit comments

Comments
 (0)