Skip to content

Commit 2ca4f69

Browse files
committed
feat: build python shared objects
**Summary:** See pypa#1185 We propose to: * update the branch and "bake" the shared libraries build * remove old Python (<3.8) versions that we do not care * remove the GIL build * remove compression for static libs
1 parent 12314b7 commit 2ca4f69

File tree

3 files changed

+9
-26
lines changed

3 files changed

+9
-26
lines changed

docker/Dockerfile

+1-18
Original file line numberDiff line numberDiff line change
@@ -107,16 +107,6 @@ RUN export OPENSSL_ROOT=openssl-3.0.14 && \
107107
export OPENSSL_DOWNLOAD_URL=https://www.openssl.org/source && \
108108
manylinux-entrypoint /build_scripts/build-openssl.sh
109109

110-
111-
FROM build_cpython_system_ssl AS build_cpython36
112-
COPY build_scripts/cpython-pubkeys.txt /build_scripts/cpython-pubkeys.txt
113-
RUN manylinux-entrypoint /build_scripts/build-cpython.sh 3.6.15
114-
115-
FROM build_cpython_system_ssl AS build_cpython37
116-
COPY build_scripts/cpython-pubkeys.txt /build_scripts/cpython-pubkeys.txt
117-
RUN manylinux-entrypoint /build_scripts/build-cpython.sh 3.7.17
118-
119-
120110
FROM build_cpython AS build_cpython38
121111
COPY build_scripts/ambv-pubkey.txt /build_scripts/cpython-pubkeys.txt
122112
RUN manylinux-entrypoint /build_scripts/build-cpython.sh 3.8.19
@@ -141,24 +131,17 @@ FROM build_cpython AS build_cpython313
141131
COPY build_scripts/cpython-pubkey-312-313.txt /build_scripts/cpython-pubkeys.txt
142132
RUN manylinux-entrypoint /build_scripts/build-cpython.sh 3.13.0rc1
143133

144-
FROM build_cpython AS build_cpython313_nogil
145-
COPY build_scripts/cpython-pubkey-312-313.txt /build_scripts/cpython-pubkeys.txt
146-
RUN manylinux-entrypoint /build_scripts/build-cpython.sh 3.13.0rc1 nogil
147-
148134

149135
FROM runtime_base
150136
COPY --from=build_git /manylinux-rootfs /
151137
COPY --from=build_cpython_system_ssl /manylinux-rootfs /
152138
COPY build_scripts /opt/_internal/build_scripts/
153-
RUN --mount=type=bind,target=/build_cpython36,from=build_cpython36 \
154-
--mount=type=bind,target=/build_cpython37,from=build_cpython37 \
155-
--mount=type=bind,target=/build_cpython38,from=build_cpython38 \
139+
RUN --mount=type=bind,target=/build_cpython38,from=build_cpython38 \
156140
--mount=type=bind,target=/build_cpython39,from=build_cpython39 \
157141
--mount=type=bind,target=/build_cpython310,from=build_cpython310 \
158142
--mount=type=bind,target=/build_cpython311,from=build_cpython311 \
159143
--mount=type=bind,target=/build_cpython312,from=build_cpython312 \
160144
--mount=type=bind,target=/build_cpython313,from=build_cpython313 \
161-
--mount=type=bind,target=/build_cpython313_nogil,from=build_cpython313_nogil \
162145
mkdir -p /opt/_internal && \
163146
cp -rf /build_cpython*/opt/_internal/* /opt/_internal/ && \
164147
manylinux-entrypoint /opt/_internal/build_scripts/finalize.sh \

docker/build_scripts/build-cpython.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ pushd Python-${CPYTHON_VERSION}
3333
PREFIX="/opt/_internal/cpython-${CPYTHON_VERSION}"
3434
mkdir -p ${PREFIX}/lib
3535
CFLAGS_EXTRA=""
36-
CONFIGURE_ARGS="--disable-shared --with-ensurepip=no"
36+
CONFIGURE_ARGS="--enable-shared --with-ensurepip=no"
3737

3838
if [ "${2:-}" == "nogil" ]; then
3939
PREFIX="${PREFIX}-nogil"
@@ -63,7 +63,7 @@ fi
6363
# do not change the default for user built extension (yet?)
6464
./configure \
6565
CFLAGS_NODIST="${MANYLINUX_CFLAGS} ${MANYLINUX_CPPFLAGS} ${CFLAGS_EXTRA}" \
66-
LDFLAGS_NODIST="${MANYLINUX_LDFLAGS}" \
66+
LDFLAGS_NODIST="${MANYLINUX_LDFLAGS} -Wl,-rpath=${PREFIX}/lib" \
6767
--prefix=${PREFIX} ${CONFIGURE_ARGS} > /dev/null
6868
make > /dev/null
6969
make install > /dev/null

docker/build_scripts/finalize.sh

+6-6
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@ MY_DIR=$(dirname "${BASH_SOURCE[0]}")
99
# Get build utilities
1010
source $MY_DIR/build_utils.sh
1111

12-
# most people don't need libpython*.a, and they're many megabytes.
13-
# compress them all together for best efficiency
14-
pushd /opt/_internal
15-
XZ_OPT=-9e tar -cJf static-libs-for-embedding-only.tar.xz cpython-*/lib/libpython*.a
16-
popd
17-
find /opt/_internal -name '*.a' -print0 | xargs -0 rm -f
12+
# # most people don't need libpython*.a, and they're many megabytes.
13+
# # compress them all together for best efficiency
14+
# pushd /opt/_internal
15+
# XZ_OPT=-9e tar -cJf static-libs-for-embedding-only.tar.xz cpython-*/lib/libpython*.a
16+
# popd
17+
# find /opt/_internal -name '*.a' -print0 | xargs -0 rm -f
1818

1919
# disable some pip warnings
2020
export PIP_ROOT_USER_ACTION=ignore

0 commit comments

Comments
 (0)