-
-
Notifications
You must be signed in to change notification settings - Fork 516
Build musllinux
wheels
#1392
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Build musllinux
wheels
#1392
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
#!/bin/bash | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. diff --git a/scripts/build/build_manylinux_2_24.sh b/scripts/build/build_musllinux_1_1.sh
index 742014ad..62860dcb 100755
--- a/scripts/build/build_manylinux_2_24.sh
+++ b/scripts/build/build_musllinux_1_1.sh
@@ -1,6 +1,6 @@
#!/bin/bash
-# Create manylinux_2_24 wheels for psycopg2
+# Create musllinux_1_1 wheels for psycopg2
#
# Look at the .github/workflows/packages.yml file for hints about how to use it.
@@ -27,16 +27,16 @@ if [[ "${PACKAGE_NAME:-}" ]]; then
fi
# Install prerequisite libraries
-curl -k -s https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add -
-echo "deb http://apt.postgresql.org/pub/repos/apt stretch-pgdg main" \
- > /etc/apt/sources.list.d/pgdg.list
-apt-get -y update
-apt-get install -y libpq-dev
+apk update
+apk add postgresql-dev
+# Add findutils because the Busybox version lacks the `-ls` flag, used by the
+# `strip_wheel.sh` script.
+apk add findutils
# Create the wheel packages
for pyver in $PYVERS; do
pybin="/opt/python/${pyver}/bin"
- "${pybin}/pip" wheel "${prjdir}" -w "${prjdir}/dist/"
+ "${pybin}/python" -m build -w -o "${prjdir}/dist/" "${prjdir}"
done
# Bundle external shared libraries into the wheels
@@ -45,11 +45,8 @@ for whl in "${prjdir}"/dist/*.whl; do
auditwheel repair "$whl" -w "$distdir"
done
-# Make sure the libpq is not in the system
-for f in $(find /usr/lib /usr/lib64 -name libpq\*) ; do
- mkdir -pv "/libpqbak/$(dirname $f)"
- mv -v "$f" "/libpqbak/$(dirname $f)"
-done
+# Make sure the postgresql-dev is not in the system
+apk del postgresql-dev
# Install packages and test
cd "${prjdir}"
@@ -69,8 +66,3 @@ for pyver in $PYVERS; do
"${pybin}/python" -c "import tests; tests.unittest.main(defaultTest='tests.test_suite')"
done
-
-# Restore the libpq packages
-for f in $(cd /libpqbak/ && find . -not -type d); do
- mv -v "/libpqbak/$f" "/$f"
-done |
||
|
||
# Create musllinux_1_1 wheels for psycopg2 | ||
# | ||
# Look at the .github/workflows/packages.yml file for hints about how to use it. | ||
|
||
set -euo pipefail | ||
set -x | ||
|
||
dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" | ||
prjdir="$( cd "${dir}/../.." && pwd )" | ||
|
||
# Build all the available versions, or just the ones specified in PYVERS | ||
if [ ! "${PYVERS:-}" ]; then | ||
PYVERS="$(ls /opt/python/)" | ||
fi | ||
|
||
# Find psycopg version | ||
version=$(grep -e ^PSYCOPG_VERSION "${prjdir}/setup.py" | sed "s/.*'\(.*\)'/\1/") | ||
# A gratuitous comment to fix broken vim syntax file: '") | ||
distdir="${prjdir}/dist/psycopg2-$version" | ||
|
||
# Replace the package name | ||
if [[ "${PACKAGE_NAME:-}" ]]; then | ||
sed -i "s/^setup(name=\"psycopg2\"/setup(name=\"${PACKAGE_NAME}\"/" \ | ||
"${prjdir}/setup.py" | ||
fi | ||
|
||
# Install prerequisite libraries | ||
apk update | ||
apk add postgresql-dev | ||
# Add findutils because the Busybox version lacks the `-ls` flag, used by the | ||
# `strip_wheel.sh` script. | ||
apk add findutils | ||
|
||
# Create the wheel packages | ||
for pyver in $PYVERS; do | ||
pybin="/opt/python/${pyver}/bin" | ||
"${pybin}/python" -m build -w -o "${prjdir}/dist/" "${prjdir}" | ||
dvarrazzo marked this conversation as resolved.
Show resolved
Hide resolved
|
||
done | ||
|
||
# Bundle external shared libraries into the wheels | ||
for whl in "${prjdir}"/dist/*.whl; do | ||
"${dir}/strip_wheel.sh" "$whl" | ||
auditwheel repair "$whl" -w "$distdir" | ||
lithammer marked this conversation as resolved.
Show resolved
Hide resolved
|
||
done | ||
|
||
# Make sure the postgresql-dev is not in the system | ||
apk del postgresql-dev | ||
|
||
# Install packages and test | ||
cd "${prjdir}" | ||
for pyver in $PYVERS; do | ||
pybin="/opt/python/${pyver}/bin" | ||
"${pybin}/pip" install ${PACKAGE_NAME:-psycopg2} --no-index -f "$distdir" | ||
|
||
# Print psycopg and libpq versions | ||
"${pybin}/python" -c "import psycopg2; print(psycopg2.__version__)" | ||
"${pybin}/python" -c "import psycopg2; print(psycopg2.__libpq_version__)" | ||
"${pybin}/python" -c "import psycopg2; print(psycopg2.extensions.libpq_version())" | ||
|
||
# Fail if we are not using the expected libpq library | ||
if [[ "${WANT_LIBPQ:-}" ]]; then | ||
"${pybin}/python" -c "import psycopg2, sys; sys.exit(${WANT_LIBPQ} != psycopg2.extensions.libpq_version())" | ||
fi | ||
|
||
"${pybin}/python" -c "import tests; tests.unittest.main(defaultTest='tests.test_suite')" | ||
lithammer marked this conversation as resolved.
Show resolved
Hide resolved
|
||
done |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.