Skip to content

Commit a4b3782

Browse files
authored
Improve handling of prepend_sys_path
Don't split using colons on windows Fixes sqlalchemy#1330
1 parent 3e48ed0 commit a4b3782

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

alembic/script/base.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -212,9 +212,12 @@ def from_config(cls, config: Config) -> ScriptDirectory:
212212

213213
prepend_sys_path = config.get_main_option("prepend_sys_path")
214214
if prepend_sys_path:
215-
sys.path[:0] = list(
216-
_split_on_space_comma_colon.split(prepend_sys_path)
217-
)
215+
if os.name == 'nt':
216+
prepend_paths = _split_on_space_comma.split(prepend_sys_path)
217+
else:
218+
prepend_paths = _split_on_space_comma_colon.split(prepend_sys_path)
219+
220+
sys.path[:0] = (os.path.normpath(path.strip()) for path in prepend_paths)
218221

219222
rvl = config.get_main_option("recursive_version_locations") == "true"
220223
return ScriptDirectory(

0 commit comments

Comments
 (0)