Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitc226759

Browse files
committed
Try to find pg_config from system PATH
1 parent80a3e55 commitc226759

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

‎testgres/utils.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
fromcontextlibimportcontextmanager
1313
fromdistutils.versionimportLooseVersion
14+
fromdistutils.spawnimportfind_executable
1415
fromsiximportiteritems
1516

1617
from .configimporttestgres_config
@@ -116,10 +117,15 @@ def get_bin_path(filename):
116117
ifpg_bin:
117118
returnos.path.join(pg_bin,filename)
118119

120+
pg_config_path=find_executable('pg_config')
121+
ifpg_config_path:
122+
bindir=get_pg_config(pg_config_path)["BINDIR"]
123+
returnos.path.join(bindir,filename)
124+
119125
returnfilename
120126

121127

122-
defget_pg_config():
128+
defget_pg_config(pg_config_path=None):
123129
"""
124130
Return output of pg_config (provided that it is installed).
125131
NOTE: this fuction caches the result by default (see GlobalConfig).
@@ -150,8 +156,8 @@ def cache_pg_config_data(cmd):
150156
if_pg_config_data:
151157
return_pg_config_data
152158

153-
# try PG_CONFIG
154-
pg_config=os.environ.get("PG_CONFIG")
159+
# tryspecified pg_config path orPG_CONFIG
160+
pg_config=pg_config_pathoros.environ.get("PG_CONFIG")
155161
ifpg_config:
156162
returncache_pg_config_data(pg_config)
157163

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp