Skip to content

Commit

Permalink
Improve handling of prepend_sys_path
Browse files Browse the repository at this point in the history
Don't split using colons on windows
Fixes sqlalchemy#1330
  • Loading branch information
mwerezak authored Oct 19, 2023
1 parent 3e48ed0 commit a4b3782
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions alembic/script/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,9 +212,12 @@ def from_config(cls, config: Config) -> ScriptDirectory:

prepend_sys_path = config.get_main_option("prepend_sys_path")
if prepend_sys_path:
sys.path[:0] = list(
_split_on_space_comma_colon.split(prepend_sys_path)
)
if os.name == 'nt':
prepend_paths = _split_on_space_comma.split(prepend_sys_path)
else:
prepend_paths = _split_on_space_comma_colon.split(prepend_sys_path)

sys.path[:0] = (os.path.normpath(path.strip()) for path in prepend_paths)

rvl = config.get_main_option("recursive_version_locations") == "true"
return ScriptDirectory(
Expand Down

0 comments on commit a4b3782

Please sign in to comment.