Skip to content

Commit 6d6ee5d

Browse files
committed
Linux and Windows whl built - working on macOS
1 parent 815a050 commit 6d6ee5d

2 files changed

Lines changed: 26 additions & 19 deletions

File tree

‎build_manylinux.sh‎

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@ export SSCDIR=/io/ssc
44
export SAMNTDIR=/io/sam
55
export PYSAMDIR=/io/pysam
66

7-
if [ "$(uname -m)" = "aarch64" ]; then
7+
ARCH=$(uname -m)
8+
9+
if [ $ARCH = "aarch64" ]; then
810
ORTOOLS=or-tools_aarch64_AlmaLinux-8.10_cpp_v9.14.6206
911
else
1012
ORTOOLS=or-tools_x86_64_AlmaLinux-8.10_cpp_v9.14.6206
@@ -47,23 +49,18 @@ cd $PYSAMDIR
4749
# Stage external files (libs, defaults) into PySAM/
4850
/opt/python/cp312-cp312/bin/python prepare_build.py || exit
4951

50-
#for PYTHONENV in cp39-cp39 cp310-cp310 cp311-cp311 cp312-cp312 cp313-cp313 cp314-cp314
51-
for PYTHONENV in cp312-cp312
52+
for PYTHONENV in cp39-cp39 cp310-cp310 cp311-cp311 cp312-cp312 cp313-cp313 cp314-cp314
5253
do
5354
yes | /opt/python/$PYTHONENV/bin/python -m pip install --upgrade pip
5455
yes | /opt/python/$PYTHONENV/bin/pip install -r tests/requirements.txt
55-
#yes | /opt/python/$PYTHONENV/bin/pip install auditwheel build
5656
yes | /opt/python/$PYTHONENV/bin/pip install repairwheel
5757
yes | /opt/python/$PYTHONENV/bin/pip install build
5858
yes | /opt/python/$PYTHONENV/bin/pip uninstall NREL-PySAM
5959
yes | /opt/python/$PYTHONENV/bin/pip uninstall NLR-PySAM
6060
/opt/python/$PYTHONENV/bin/python -m build --wheel || exit
61-
WHEEL=$(ls dist/nlr_pysam-*-$PYTHONENV-*linux*.whl)
62-
# export LD_LIBRARY_PATH=/io/pysam/PySAM:$LD_LIBRARY_PATH
63-
# auditwheel repair "$WHEEL" -w dist/wheelhouse/
64-
# /opt/python/$PYTHONENV/bin/python -m repairwheel "$WHEEL" -l /io/pysam/PySAM -o dist/wheelhouse/
61+
WHEEL=$(ls dist/nlr_pysam-*-$PYTHONENV-*linux*$ARCH.whl)
6562
/opt/python/$PYTHONENV/bin/python -m repairwheel "$WHEEL" -l "$ORTOOLSDIR/lib64" -o dist/wheelhouse/
66-
REPAIRED_WHEEL=$(ls dist/wheelhouse/nlr_pysam-*-$PYTHONENV-*linux*.whl)
63+
REPAIRED_WHEEL=$(ls dist/wheelhouse/nlr_pysam-*-$PYTHONENV-*linux*$ARCH.whl)
6764
yes | /opt/python/$PYTHONENV/bin/pip install "$REPAIRED_WHEEL"
6865
# /opt/python/$PYTHONENV/bin/pytest -s tests
6966
retVal=$?
@@ -74,4 +71,4 @@ do
7471
done
7572

7673
# Clean up staged files
77-
#/opt/python/cp312-cp312/bin/python prepare_build.py --clean
74+
/opt/python/cp312-cp312/bin/python prepare_build.py --clean

‎build_unix-sj.sh‎

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,10 @@ rm -rf ${SAMNTDIR}/../cmake-build-release
1111
mkdir -p ${SAMNTDIR}/../cmake-build-release
1212
cd ${SAMNTDIR}/../cmake-build-release || exit
1313

14-
if [ "$(python3 -c "import platform; print(platform.processor())")" = "arm" ]
14+
ARCH=$(uname -m)
15+
16+
#if [ "$(python3 -c "import platform; print(platform.processor())")" = "arm" ]
17+
if [ $ARCH = "arm64" ]
1518
then
1619
cmake -DCMAKE_BUILD_TYPE=Release \
1720
-DSAM_SKIP_AUTOGEN=0 -DSAMAPI_EXPORT=1 \
@@ -42,22 +45,29 @@ eval "$(mamba shell hook --shell bash)"
4245
# Stage external files (libs, defaults) into PySAM/
4346
python prepare_build.py || exit
4447

45-
for PYTHONENV in pysam_build_3.9 pysam_build_3.10 pysam_build_3.11 pysam_build_3.12 pysam_build_3.13 pysam_build_3.14
48+
for PYTHONENV in cp39-cp39 cp310-cp310 cp311-cp311 cp312-cp312 cp313-cp313 cp314-cp314
4649
do
47-
mamba activate $(conda info --base)/envs/$PYTHONENV
50+
conda deactivate
51+
conda activate $PYTHONENV
4852
yes | python -m pip install --upgrade pip
4953
yes | pip install -r tests/requirements.txt
54+
yes | pip install repairwheel
5055
yes | pip install build
5156
yes | pip uninstall NREL-PySAM
5257
yes | pip uninstall NLR-PySAM
53-
pip install . || exit
58+
python -m build --wheel
59+
WHEEL=$(ls dist/nlr_pysam-*-$PYTHONENV-*macos*$ARCH.whl)
60+
python -m repairwheel "$WHEEL" -l "$ORTOOLSDIR/lib" -o dist/wheelhouse/
61+
REPAIRED_WHEEL=$(ls dist/wheelhouse/nlr_pysam-*-$PYTHONENV-*macos*$ARCH.whl)
62+
yes | pip install "$REPAIRED_WHEEL"
63+
64+
5465
# pytest -s tests
5566
# retVal=$?
5667
# if [ $retVal -ne 0 ]; then
5768
# echo "Error in Tests"
5869
# exit 1
5970
# fi
60-
python -m build --wheel
6171
done
6272

6373

@@ -81,16 +91,16 @@ python prepare_build.py --clean
8191
cd ..
8292
if [ "$(python3 -c "import platform; print(platform.processor())")" = "arm" ]
8393
then
84-
docker pull quay.io/pypa/manylinux_2_28_aarch64
94+
docker pull quay.io/pypa/manylinux_2_34_aarch64
8595
# docker run --rm -dit -v $(pwd):/io quay.io/pypa/manylinux_2_28_aarch64 /bin/bash
8696
docker run --rm -v $(pwd):/io quay.io/pypa/manylinux_2_28_aarch64 /io/pysam/build_manylinux.sh || exit
8797
else
88-
docker pull quay.io/pypa/manylinux_2_28_x86_64
98+
docker pull quay.io/pypa/manylinux_2_34_x86_64
8999
# docker run --rm -dit -v $(pwd):/io quay.io/pypa/manylinux_2_28_x86_64 /bin/bash
90-
docker run --rm -v $(pwd):/io quay.io/pypa/manylinux_2_28_x86_64 /io/pysam/build_manylinux.sh || exit
100+
docker run --rm -v $(pwd):/io quay.io/pypa/manylinux_2_34_x86_64 /io/pysam/build_manylinux.sh || exit
91101
fi
92102

93-
rename -s linux manylinux2014 $PYSAMDIR/dist/*-linux_*
103+
rename -s linux manylinux2014 $PYSAMDIR/dist/wheelhouse/*-manylinux_*
94104
docker pull continuumio/anaconda3
95105
docker run --rm --env PYSAMDIR=/io/pysam -v $(pwd):/io continuumio/anaconda3 /io/pysam/build_conda.sh
96106

0 commit comments

Comments
 (0)