From 596934d996e3c94a9cfb420a00c517bd7f06b4ad Mon Sep 17 00:00:00 2001 From: Michel Pelletier Date: Fri, 27 Aug 2021 18:46:52 -0700 Subject: [PATCH] parameterize pg version based on release tag --- .github/workflows/wheels.yml | 3 ++- {postgresql_wheel => postgresql}/__init__.py | 0 setup.py | 17 ++++++++--------- tools/install_pg.sh | 13 ++++++++++--- 4 files changed, 20 insertions(+), 13 deletions(-) rename {postgresql_wheel => postgresql}/__init__.py (100%) diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index 48e197f..fea8ff2 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -22,7 +22,8 @@ jobs: - name: Build wheels run: python -m cibuildwheel --output-dir wheelhouse env: - CIBW_BEFORE_ALL_LINUX: "bash tools/install_pg.sh" + CIBW_ENVIRONMENT: + CIBW_BEFORE_ALL_LINUX: ${{ format('sh tools/install_pg.sh {0}', github.ref) }} - name: Run tests run: pytest tests/ diff --git a/postgresql_wheel/__init__.py b/postgresql/__init__.py similarity index 100% rename from postgresql_wheel/__init__.py rename to postgresql/__init__.py diff --git a/setup.py b/setup.py index 6b6c48d..9ce6381 100644 --- a/setup.py +++ b/setup.py @@ -11,17 +11,16 @@ def package_files(directory): return paths -extra_files = package_files("postgresql_wheel/binary") +extra_files = package_files("postgresql/binary") setup( - name="postgresql-wheel", + name="postgresql_wheel", version="13.4", - description="PostgreSQL in a Python Wheel.", + description="PostgreSQL Server compiled into a Python Wheel.", author="Michel Pelletier", - packages=["postgresql_wheel"], - package_data={"postgresql_wheel": extra_files}, - setup_requires=["cffi>=1.0.0"], - install_requires=["psycopg2-binary"], - cffi_modules=["postgresql_wheel/__init__.py:ffibuilder"], - python_requires=">=3.7,<3.10", + packages=["postgresql"], + package_data={"postgresql": extra_files}, + setup_requires=["cffi"], + cffi_modules=["postgresql/__init__.py:ffibuilder"], + python_requires=">=3.8,<3.9", ) diff --git a/tools/install_pg.sh b/tools/install_pg.sh index 0585e8b..7de2df5 100644 --- a/tools/install_pg.sh +++ b/tools/install_pg.sh @@ -1,9 +1,16 @@ +if [[ $1 =~ refs/tags/([0-9]+\.[0-9]+).*$ ]]; +then + VERSION=${BASH_REMATCH[1]} + echo "Building ${VERSION}" +else + exit -1 +fi yum install -y zlib-devel readline-devel -curl -L -O https://ftp.postgresql.org/pub/source/v13.4/postgresql-13.4.tar.gz +curl -L -O https://ftp.postgresql.org/pub/source/v13.4/postgresql-${VERSION}.tar.gz -tar -xzf postgresql-13.4.tar.gz -cd postgresql-13.4 +tar -xzf postgresql-${VERSION}.tar.gz +cd postgresql-${VERSION} ./configure --prefix=`pwd`/../postgresql/binary make -j 4 make install