mirror of
https://github.com/psycopg/psycopg2.git
synced 2025-10-19 01:54:23 +03:00
Merge branch 'fix-ci'
This commit is contained in:
commit
c4a3866c30
6
.github/workflows/packages.yml
vendored
6
.github/workflows/packages.yml
vendored
|
@ -5,8 +5,8 @@ on:
|
|||
|
||||
env:
|
||||
PIP_BREAK_SYSTEM_PACKAGES: "1"
|
||||
LIBPQ_VERSION: "16.0"
|
||||
OPENSSL_VERSION: "1.1.1w"
|
||||
LIBPQ_VERSION: "17.6"
|
||||
OPENSSL_VERSION: "3.5.4"
|
||||
|
||||
jobs:
|
||||
sdist: # {{{
|
||||
|
@ -65,7 +65,7 @@ jobs:
|
|||
fail-fast: false
|
||||
matrix:
|
||||
platform: [manylinux, musllinux]
|
||||
arch: [x86_64, i686, aarch64, ppc64le]
|
||||
arch: [x86_64, aarch64, ppc64le]
|
||||
pyver: [cp38, cp39, cp310, cp311, cp312, cp313]
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
# Build a modern version of libpq and depending libs from source on Centos 5, Alpine or macOS
|
||||
|
||||
set -euo pipefail
|
||||
set -x
|
||||
|
||||
# Last release: https://www.postgresql.org/ftp/source/
|
||||
# IMPORTANT! Change the cache key in packages.yml when upgrading libraries
|
||||
|
@ -12,13 +11,13 @@ postgres_version="${LIBPQ_VERSION}"
|
|||
# last release: https://www.openssl.org/source/
|
||||
openssl_version="${OPENSSL_VERSION}"
|
||||
|
||||
# last release: https://kerberos.org/dist/
|
||||
# Latest release: https://kerberos.org/dist/
|
||||
krb5_version="1.21.3"
|
||||
|
||||
# last release: https://openldap.org/software/download/
|
||||
ldap_version="2.6.8"
|
||||
# Latest release: https://openldap.org/software/download/
|
||||
ldap_version="2.6.9"
|
||||
|
||||
# last release: https://github.com/cyrusimap/cyrus-sasl/releases
|
||||
# Latest release: https://github.com/cyrusimap/cyrus-sasl/releases
|
||||
sasl_version="2.1.28"
|
||||
|
||||
export LIBPQ_BUILD_PREFIX=${LIBPQ_BUILD_PREFIX:-/tmp/libpq.build}
|
||||
|
@ -40,20 +39,30 @@ case "$(uname)" in
|
|||
;;
|
||||
esac
|
||||
|
||||
# Install packages required for test and wheels build, regardless of whether
|
||||
# we will build the libpq or not.
|
||||
case "$ID" in
|
||||
alpine)
|
||||
apk add --no-cache krb5-libs
|
||||
;;
|
||||
esac
|
||||
|
||||
if [[ -f "${LIBPQ_BUILD_PREFIX}/lib/libpq.${library_suffix}" ]]; then
|
||||
echo "libpq already available: build skipped" >&2
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Install packages required to build the libpq.
|
||||
case "$ID" in
|
||||
centos)
|
||||
yum update -y
|
||||
yum install -y zlib-devel krb5-devel pam-devel
|
||||
yum install -y flex krb5-devel pam-devel perl-IPC-Cmd perl-Time-Piece zlib-devel
|
||||
;;
|
||||
|
||||
alpine)
|
||||
apk upgrade
|
||||
apk add --no-cache zlib-dev krb5-dev linux-pam-dev openldap-dev openssl-dev
|
||||
apk add --no-cache flex krb5-dev linux-pam-dev openldap-dev \
|
||||
openssl-dev zlib-dev
|
||||
;;
|
||||
|
||||
macos)
|
||||
|
@ -91,18 +100,18 @@ else
|
|||
make_configure_standard_flags=( \
|
||||
--prefix=${LIBPQ_BUILD_PREFIX} \
|
||||
CPPFLAGS=-I${LIBPQ_BUILD_PREFIX}/include/ \
|
||||
LDFLAGS=-L${LIBPQ_BUILD_PREFIX}/lib \
|
||||
"LDFLAGS=-L${LIBPQ_BUILD_PREFIX}/lib -L${LIBPQ_BUILD_PREFIX}/lib64" \
|
||||
)
|
||||
fi
|
||||
|
||||
|
||||
if [ "$ID" == "centos" ] || [ "$ID" == "macos" ]; then
|
||||
if [[ ! -f "${LIBPQ_BUILD_PREFIX}/openssl.cnf" ]]; then
|
||||
|
||||
# Build openssl if needed
|
||||
openssl_tag="OpenSSL_${openssl_version//./_}"
|
||||
openssl_tag="openssl-${openssl_version}"
|
||||
openssl_dir="openssl-${openssl_tag}"
|
||||
if [ ! -d "${openssl_dir}" ]; then
|
||||
curl -sL \
|
||||
curl -fsSL \
|
||||
https://github.com/openssl/openssl/archive/${openssl_tag}.tar.gz \
|
||||
| tar xzf -
|
||||
|
||||
|
@ -116,8 +125,8 @@ if [ "$ID" == "centos" ] || [ "$ID" == "macos" ]; then
|
|||
./configure "darwin64-$MACOSX_ARCHITECTURE-cc" $options
|
||||
fi
|
||||
|
||||
make depend
|
||||
make
|
||||
make -s depend
|
||||
make -s
|
||||
else
|
||||
pushd "${openssl_dir}"
|
||||
fi
|
||||
|
@ -126,6 +135,7 @@ if [ "$ID" == "centos" ] || [ "$ID" == "macos" ]; then
|
|||
make install_sw
|
||||
popd
|
||||
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
|
@ -134,12 +144,12 @@ if [ "$ID" == "macos" ]; then
|
|||
# Build kerberos if needed
|
||||
krb5_dir="krb5-${krb5_version}/src"
|
||||
if [ ! -d "${krb5_dir}" ]; then
|
||||
curl -sL "https://kerberos.org/dist/krb5/${krb5_version%.*}/krb5-${krb5_version}.tar.gz" \
|
||||
curl -fsSL "https://kerberos.org/dist/krb5/${krb5_version%.*}/krb5-${krb5_version}.tar.gz" \
|
||||
| tar xzf -
|
||||
|
||||
pushd "${krb5_dir}"
|
||||
./configure "${make_configure_standard_flags[@]}"
|
||||
make
|
||||
make -s
|
||||
else
|
||||
pushd "${krb5_dir}"
|
||||
fi
|
||||
|
@ -151,6 +161,7 @@ fi
|
|||
|
||||
|
||||
if [ "$ID" == "centos" ] || [ "$ID" == "macos" ]; then
|
||||
if [[ ! -f "${LIBPQ_BUILD_PREFIX}/lib/libsasl2.${library_suffix}" ]]; then
|
||||
|
||||
# Build libsasl2 if needed
|
||||
# The system package (cyrus-sasl-devel) causes an amazing error on i686:
|
||||
|
@ -159,7 +170,7 @@ if [ "$ID" == "centos" ] || [ "$ID" == "macos" ]; then
|
|||
sasl_tag="cyrus-sasl-${sasl_version}"
|
||||
sasl_dir="cyrus-sasl-${sasl_tag}"
|
||||
if [ ! -d "${sasl_dir}" ]; then
|
||||
curl -sL \
|
||||
curl -fsSL \
|
||||
https://github.com/cyrusimap/cyrus-sasl/archive/${sasl_tag}.tar.gz \
|
||||
| tar xzf -
|
||||
|
||||
|
@ -167,7 +178,7 @@ if [ "$ID" == "centos" ] || [ "$ID" == "macos" ]; then
|
|||
|
||||
autoreconf -i
|
||||
./configure "${make_configure_standard_flags[@]}" --disable-macos-framework
|
||||
make
|
||||
make -s
|
||||
else
|
||||
pushd "${sasl_dir}"
|
||||
fi
|
||||
|
@ -178,16 +189,18 @@ if [ "$ID" == "centos" ] || [ "$ID" == "macos" ]; then
|
|||
make install
|
||||
popd
|
||||
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
if [ "$ID" == "centos" ] || [ "$ID" == "macos" ]; then
|
||||
if [[ ! -f "${LIBPQ_BUILD_PREFIX}/lib/libldap.${library_suffix}" ]]; then
|
||||
|
||||
# Build openldap if needed
|
||||
ldap_tag="${ldap_version}"
|
||||
ldap_dir="openldap-${ldap_tag}"
|
||||
if [ ! -d "${ldap_dir}" ]; then
|
||||
curl -sL \
|
||||
curl -fsSL \
|
||||
https://www.openldap.org/software/download/OpenLDAP/openldap-release/openldap-${ldap_tag}.tgz \
|
||||
| tar xzf -
|
||||
|
||||
|
@ -195,10 +208,10 @@ if [ "$ID" == "centos" ] || [ "$ID" == "macos" ]; then
|
|||
|
||||
./configure "${make_configure_standard_flags[@]}" --enable-backends=no --enable-null
|
||||
|
||||
make depend
|
||||
make -C libraries/liblutil/
|
||||
make -C libraries/liblber/
|
||||
make -C libraries/libldap/
|
||||
make -s depend
|
||||
make -s -C libraries/liblutil/
|
||||
make -s -C libraries/liblber/
|
||||
make -s -C libraries/libldap/
|
||||
else
|
||||
pushd "${ldap_dir}"
|
||||
fi
|
||||
|
@ -210,6 +223,7 @@ if [ "$ID" == "centos" ] || [ "$ID" == "macos" ]; then
|
|||
chmod +x ${LIBPQ_BUILD_PREFIX}/lib/{libldap,liblber}*.${library_suffix}*
|
||||
popd
|
||||
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
|
@ -217,7 +231,7 @@ fi
|
|||
postgres_tag="REL_${postgres_version//./_}"
|
||||
postgres_dir="postgres-${postgres_tag}"
|
||||
if [ ! -d "${postgres_dir}" ]; then
|
||||
curl -sL \
|
||||
curl -fsSL \
|
||||
https://github.com/postgres/postgres/archive/${postgres_tag}.tar.gz \
|
||||
| tar xzf -
|
||||
|
||||
|
@ -231,15 +245,14 @@ if [ ! -d "${postgres_dir}" ]; then
|
|||
src/include/pg_config_manual.h
|
||||
fi
|
||||
|
||||
# Often needed, but currently set by the workflow
|
||||
# export LD_LIBRARY_PATH="${LIBPQ_BUILD_PREFIX}/lib"
|
||||
export LD_LIBRARY_PATH="${LIBPQ_BUILD_PREFIX}/lib:${LIBPQ_BUILD_PREFIX}/lib64"
|
||||
|
||||
./configure "${make_configure_standard_flags[@]}" --sysconfdir=/etc/postgresql-common \
|
||||
--with-gssapi --with-openssl --with-pam --with-ldap \
|
||||
--without-readline --without-icu
|
||||
make -C src/interfaces/libpq
|
||||
make -C src/bin/pg_config
|
||||
make -C src/include
|
||||
make -s -C src/interfaces/libpq
|
||||
make -s -C src/bin/pg_config
|
||||
make -s -C src/include
|
||||
else
|
||||
pushd "${postgres_dir}"
|
||||
fi
|
||||
|
|
|
@ -12,7 +12,7 @@ dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
|||
prjdir="$( cd "${dir}/../.." && pwd )"
|
||||
|
||||
# Build dependency libraries
|
||||
"${prjdir}/scripts/build/build_libpq.sh"
|
||||
"${prjdir}/scripts/build/build_libpq.sh" > /dev/null
|
||||
|
||||
# Show dependency tree
|
||||
otool -L /tmp/libpq.build/lib/*.dylib
|
||||
|
|
|
@ -71,10 +71,13 @@ class NetworkingTestCase(testutils.ConnectingTestCase):
|
|||
cur.execute("select %s", [ip.ip_interface('::ffff:102:300/128')])
|
||||
|
||||
# The texual representation of addresses has changed in Python 3.13
|
||||
if sys.version_info >= (3, 13):
|
||||
# https://github.com/python/cpython/issues/128840
|
||||
if str(ip.ip_interface("::ffff:102:300/128")) == "::ffff:1.2.3.0/128":
|
||||
self.assertEquals(cur.fetchone()[0], '::ffff:1.2.3.0/128')
|
||||
else:
|
||||
elif str(ip.ip_interface("::ffff:102:300/128")) == "::ffff:102:300/128":
|
||||
self.assertEquals(cur.fetchone()[0], '::ffff:102:300/128')
|
||||
else:
|
||||
assert False, "unexpected"
|
||||
|
||||
@testutils.skip_if_crdb("cidr")
|
||||
def test_cidr_cast(self):
|
||||
|
@ -117,10 +120,13 @@ class NetworkingTestCase(testutils.ConnectingTestCase):
|
|||
cur.execute("select %s", [ip.ip_network('::ffff:102:300/128')])
|
||||
|
||||
# The texual representation of addresses has changed in Python 3.13
|
||||
if sys.version_info >= (3, 13):
|
||||
# https://github.com/python/cpython/issues/128840
|
||||
if str(ip.ip_interface("::ffff:102:300/128")) == "::ffff:1.2.3.0/128":
|
||||
self.assertEquals(cur.fetchone()[0], '::ffff:1.2.3.0/128')
|
||||
else:
|
||||
elif str(ip.ip_interface("::ffff:102:300/128")) == "::ffff:102:300/128":
|
||||
self.assertEquals(cur.fetchone()[0], '::ffff:102:300/128')
|
||||
else:
|
||||
assert False, "unexpected"
|
||||
|
||||
|
||||
def test_suite():
|
||||
|
|
Loading…
Reference in New Issue
Block a user