Skip to content

Commit

Permalink
parameterize pg version based on release tag
Browse files Browse the repository at this point in the history
  • Loading branch information
michelp committed Aug 28, 2021
1 parent 7015810 commit 596934d
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 13 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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/
Expand Down
File renamed without changes.
17 changes: 8 additions & 9 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
)
13 changes: 10 additions & 3 deletions tools/install_pg.sh
Original file line number Diff line number Diff line change
@@ -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
Expand Down

0 comments on commit 596934d

Please sign in to comment.