Skip to content

Commit

Permalink
Merge branch 'fix-linux-build'
Browse files Browse the repository at this point in the history
  • Loading branch information
coldfix committed Dec 17, 2024
2 parents 7a88047 + ffe1029 commit fda8b21
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 21 deletions.
9 changes: 5 additions & 4 deletions .github/build/linux/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
ARG BASE=manylinux1_x86_64
ARG BASE=manylinux2014_x86_64
FROM quay.io/pypa/$BASE

ARG UID=1000
ARG GID=$UID
ENV PATH="/opt/python/cp36-cp36m/bin:${PATH}"
# Highest version supported by manylinux1:
ENV PATH="/opt/python/cp39-cp39/bin:${PATH}"

RUN groupadd -o -g $GID runner && \
useradd -o -u $UID -g $GID runner && \
if [[ $AUDITWHEEL_PLAT == manylinux2014_* ]]; then \
yum install -y glibc-static; \
fi && \
pip install --upgrade cmake cython --only-binary=cmake && \
pip install --upgrade cmake 'cython>=3.1.0a1' --only-binary=cmake && \
for PYBIN in /opt/python/cp3*/bin; do \
"${PYBIN}/pip" install -U setuptools; \
"${PYBIN}/pip" install -U "setuptools[core]"; \
done

VOLUME /mnt
Expand Down
6 changes: 4 additions & 2 deletions .github/build/linux/cpymad.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
set -ex

# Build variables:
export MADXDIR=$(readlink -nf "$1")
export MADXDIR="$(readlink -nf "${1:-/mnt/dist/MAD-X}")"
export X11=0 BLAS=0 LAPACK=0
export CFLAGS="-fno-lto"
export LDFLAGS="-fno-lto"
Expand All @@ -23,7 +23,9 @@ export LDFLAGS="-fno-lto"
python setup.py sdist

for PYBIN in /opt/python/cp3*/bin; do
"${PYBIN}/pip" wheel dist/*.tar.gz --no-deps -w rawdist/
if "${PYBIN}/python" -c "import sys;exit(sys.version_info<(3,8))"; then
"${PYBIN}/pip" wheel dist/*.tar.gz --no-deps -w rawdist/
fi
done

# Bundle external shared libraries into the wheels
Expand Down
19 changes: 10 additions & 9 deletions .github/build/linux/madx.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,22 @@
#
# Arguments:
# <SRCDIR>: root directory of MAD-X sources
#
# Outputs:
# <SRCDIR>/build: cmake build directory
# <SRCDIR>/dist: MAD-X installation directory (binary distribution)
# <BUILDDIR>: cmake build directory
# <INSTALLDIR>: MAD-X installation directory (binary distribution)
set -ex

cd "$1"
mkdir -p build
cd build
SRCDIR="$(readlink -nm "${1:-/mnt/src/MAD-X}")"
BUILDDIR="$(readlink -nm "${2:-/mnt/build/MAD-X}")"
INSTALLDIR="$(readlink -nm "${3:-/mnt/dist/MAD-X}")"

mkdir -p "$BUILDDIR"
cd "$BUILDDIR"

if [[ ! -f CMakeCache.txt ]]; then
cmake .. \
cmake "$SRCDIR" \
-DBUILD_SHARED_LIBS=OFF \
-DMADX_STATIC=ON \
-DCMAKE_INSTALL_PREFIX=../dist \
-DCMAKE_INSTALL_PREFIX="$INSTALLDIR" \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_C_FLAGS="-fvisibility=hidden" \
-DCMAKE_CXX_FLAGS="-fvisibility=hidden" \
Expand Down
9 changes: 5 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ jobs:
strategy:
matrix:
base:
- manylinux1_x86_64
- manylinux2014_x86_64
- manylinux2014_aarch64
steps:
Expand Down Expand Up @@ -65,7 +64,7 @@ jobs:
-w /mnt \
-v `pwd`:/mnt \
builder \
.github/build/linux/madx.sh src/MAD-X
.github/build/linux/madx.sh src/MAD-X build/MAD-X dist/MAD-X
shell: bash

- name: Build cpymad wheels
Expand All @@ -74,14 +73,16 @@ jobs:
-w /mnt \
-v `pwd`:/mnt \
builder \
.github/build/linux/cpymad.sh src/MAD-X/dist
.github/build/linux/cpymad.sh dist/MAD-X
shell: bash

- name: Upload cpymad wheels
uses: actions/upload-artifact@v4
with:
name: dist-linux-${{ matrix.base }}
path: dist
path: |
dist/
!dist/MAD-X
build_windows:
name: "Build: Windows"
Expand Down
4 changes: 2 additions & 2 deletions src/cpymad/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@
"""


if sys.version_info < (3, 8):
if sys.version_info < (3, 9):
_unsupported_version = (
"Support for python 3.7 and below will be removed in a future release!\n"
"Support for python 3.8 and below will be removed in a future release!\n"
"If you need continued support for an older version, let us know at:\n"
" https://github.com/hibtc/cpymad/issues")
warnings.warn(_unsupported_version, DeprecationWarning)
Expand Down

0 comments on commit fda8b21

Please sign in to comment.