Skip to content

Commit

Permalink
add plumbum commands
Browse files Browse the repository at this point in the history
  • Loading branch information
michelp committed Aug 28, 2021
1 parent 753401a commit 53df0e2
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 12 deletions.
15 changes: 14 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,15 @@
# postgresql-wheel
A Python wheel containing PostgreSQL

A Python wheel for Linux containing the PostgreSQL database server.

The wheel can be installed with pip:

```
$ pip install postgresql-wheel
Collecting postgresql-wheel
Using cached postgresql_wheel-13.4-cp38-cp38-manylinux_2_12_x86_64.manylinux2010_x86_64.whl (13.8 MB)
Installing collected packages: postgresql-wheel
Successfully installed postgresql-wheel-13.4
$ ipython
```

13 changes: 6 additions & 7 deletions postgresql/__init__.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
from cffi import FFI
from pathlib import Path

ffibuilder = FFI()
from plumbum import local
import postgresql

ffibuilder.set_source("_postgresql", "")
local.path.append(Path(postgresql.__file__).parent / "bin")

ffibuilder.cdef("")

if __name__ == "__main__":
ffibuilder.compile(verbose=True)
initdb = local.cmd.initdb
pg_ctl = local.cmd.pg_ctl
5 changes: 3 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def package_files(directory):
return paths


extra_files = package_files("postgresql/binary")
extra_files = package_files("postgresql")

setup(
name="postgresql_wheel",
Expand All @@ -21,6 +21,7 @@ def package_files(directory):
packages=["postgresql"],
package_data={"postgresql": extra_files},
setup_requires=["cffi"],
cffi_modules=["postgresql/__init__.py:ffibuilder"],
install_requires=["plumbum"],
cffi_modules=["postgresql/build.py:ffibuilder"],
python_requires=">=3.8,<3.9",
)
4 changes: 2 additions & 2 deletions tools/install_pg.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ then
VERSION=${BASH_REMATCH[1]}
echo "Building ${VERSION}"
else
exit -1
VERSION=13.4
fi

yum install -y zlib-devel readline-devel
curl -L -O https://ftp.postgresql.org/pub/source/v13.4/postgresql-${VERSION}.tar.gz

tar -xzf postgresql-${VERSION}.tar.gz
cd postgresql-${VERSION}
./configure --prefix=`pwd`/../postgresql/binary
./configure --prefix=`pwd`/../postgresql
make -j 4
make install
cd ..
Expand Down

0 comments on commit 53df0e2

Please sign in to comment.