Skip to content

Commit 003ed11

Browse files
committed
wrap all programs in bin
1 parent 22c0877 commit 003ed11

File tree

1 file changed

+20
-8
lines changed

1 file changed

+20
-8
lines changed

postgresql/__init__.py

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,30 @@
1+
import sys
12
from subprocess import check_output
23
from pathlib import Path
3-
import postgresql
44

5-
pg_bin = Path(postgresql.__file__).parent / "bin"
5+
pg_bin = Path(__file__).parent / "bin"
66

77

8-
def initdb(cmdline):
9-
cmdline = str(pg_bin / "initdb") + " " + cmdline
10-
return check_output(cmdline, shell=True)
8+
def prog(name):
9+
def f(cmdline):
10+
cmdline = str(pg_bin / name) + " " + cmdline
11+
return check_output(cmdline, shell=True)
1112

13+
return f
1214

13-
def pg_ctl(cmdline):
14-
cmdline = str(pg_bin / "pg_ctl") + " " + cmdline
15-
return check_output(cmdline, shell=True)
15+
16+
progs = """
17+
clusterdb ecpg pg_checksums pg_dumpall pg_restore pg_verifybackup reindexdb
18+
createdb initdb pg_config pg_isready pg_rewind pg_waldump vacuumdb
19+
createuser pg_archivecleanup pg_controldata pg_receivewal pg_test_fsync postgres
20+
dropdb pg_basebackup pg_ctl pg_recvlogical pg_test_timing postmaster
21+
dropuser pgbench pg_dump pg_resetwal pg_upgrade psql
22+
""".split()
23+
24+
25+
this = sys.modules[__name__]
26+
for p in progs:
27+
setattr(this, p, prog(p))
1628

1729

1830
from . import _version

0 commit comments

Comments
 (0)