Skip to content

Commit 53df0e2

Browse files
committed
add plumbum commands
1 parent 753401a commit 53df0e2

File tree

4 files changed

+25
-12
lines changed

4 files changed

+25
-12
lines changed

README.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,15 @@
11
# postgresql-wheel
2-
A Python wheel containing PostgreSQL
2+
3+
A Python wheel for Linux containing the PostgreSQL database server.
4+
5+
The wheel can be installed with pip:
6+
7+
```
8+
$ pip install postgresql-wheel
9+
Collecting postgresql-wheel
10+
Using cached postgresql_wheel-13.4-cp38-cp38-manylinux_2_12_x86_64.manylinux2010_x86_64.whl (13.8 MB)
11+
Installing collected packages: postgresql-wheel
12+
Successfully installed postgresql-wheel-13.4
13+
$ ipython
14+
```
15+

postgresql/__init__.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
1-
from cffi import FFI
1+
from pathlib import Path
22

3-
ffibuilder = FFI()
3+
from plumbum import local
4+
import postgresql
45

5-
ffibuilder.set_source("_postgresql", "")
6+
local.path.append(Path(postgresql.__file__).parent / "bin")
67

7-
ffibuilder.cdef("")
8-
9-
if __name__ == "__main__":
10-
ffibuilder.compile(verbose=True)
8+
initdb = local.cmd.initdb
9+
pg_ctl = local.cmd.pg_ctl

setup.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ def package_files(directory):
1111
return paths
1212

1313

14-
extra_files = package_files("postgresql/binary")
14+
extra_files = package_files("postgresql")
1515

1616
setup(
1717
name="postgresql_wheel",
@@ -21,6 +21,7 @@ def package_files(directory):
2121
packages=["postgresql"],
2222
package_data={"postgresql": extra_files},
2323
setup_requires=["cffi"],
24-
cffi_modules=["postgresql/__init__.py:ffibuilder"],
24+
install_requires=["plumbum"],
25+
cffi_modules=["postgresql/build.py:ffibuilder"],
2526
python_requires=">=3.8,<3.9",
2627
)

tools/install_pg.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@ then
33
VERSION=${BASH_REMATCH[1]}
44
echo "Building ${VERSION}"
55
else
6-
exit -1
6+
VERSION=13.4
77
fi
88

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

1212
tar -xzf postgresql-${VERSION}.tar.gz
1313
cd postgresql-${VERSION}
14-
./configure --prefix=`pwd`/../postgresql/binary
14+
./configure --prefix=`pwd`/../postgresql
1515
make -j 4
1616
make install
1717
cd ..

0 commit comments

Comments
 (0)