Skip to content

Commit a334bdb

Browse files
author
James William Pye
committed
Return None if there is no resolvable default installation.
1 parent 60cf1da commit a334bdb

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

postgresql/installation.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,11 +186,16 @@ def default_pg_config():
186186
if os.path.exists(os.path.join(x, 'pg_config'))
187187
] + [None])[0]
188188
)
189-
return pg_config_path if os.path.exists(pg_config_path) else None
189+
return pg_config_path if (
190+
pg_config_path and os.path.exists(pg_config_path)
191+
) else None
190192

191193
@classmethod
192194
def default(typ):
193-
return typ(typ.default_pg_config())
195+
path = typ.default_pg_config()
196+
if path is None:
197+
return None
198+
return typ(path)
194199

195200
def __new__(typ, pg_config_path):
196201
# One instance for each installation.

0 commit comments

Comments
 (0)