-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild-wheels-macos.sh
executable file
·77 lines (65 loc) · 2.02 KB
/
build-wheels-macos.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#!/bin/bash
set -e
# Check OS and platform
os=$(uname -s)
platform=$(uname -m)
minversion=7
maxversion=13
if [[ "$os" == "Darwin" && "$platform" == "arm64" ]]; then
# Set an environment variable if OS is macOS and platform is ARM
minversion=8
fi
# Debug only
#minversion=10
#maxversion=10
# Define an array of Python version strings
# Define a function to create an array of Python versions
generate_python_versions() {
min_version=$1
max_version=$2
# Initialize an empty array
python_versions=()
# Loop from the minimum to the maximum version
for ((version=min_version; version<=max_version; version++)); do
python_versions+=("3.$version")
done
# Print the generated array
echo ${python_versions[@]}
}
create_and_activate_conda_env() {
version=$1
# Create a conda environment for each Python version
echo "Creating conda environment for Python $version"
conda create -y -n "env_python_$version" python=$version
# Activate the environment
echo "Activating conda environment for Python $version"
conda activate "env_python_$version"
}
deactivate_and_remove_conda_env() {
version=$1
# Deactivate the environment
echo "Deactivating conda environment for Python $version"
conda deactivate
# Remove the environment
echo "Removing conda environment for Python $version"
conda remove -y -n "env_python_$version" --all
echo "-----end of processing python version $version"
}
generate_python_versions minversion maxversion
rm -rf ./dist
eval "$(conda shell.bash hook)"
for version in "${python_versions[@]}"; do
echo "-----processing python verion $version"
create_and_activate_conda_env $version
# Build distributable
rm -rf ./build
rm -rf ../../build_py
echo "Executing command in conda environment for Python $version"
python --version
echo "Installing wheel in conda environment for Python $version"
python -m pip install wheel
python -m pip install conan
python setup.py sdist bdist_wheel
ls -la ./dist
deactivate_and_remove_conda_env $version
done