From: mwerezak <242428+mwerezak@users.noreply.github.com> Date: Thu, 19 Oct 2023 15:50:44 +0000 (-0400) Subject: Improve handling of prepend_sys_path X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=2383617314f5eb50202d3ccd66a027f22fb8277b;p=thirdparty%2Fsqlalchemy%2Falembic.git Improve handling of prepend_sys_path Don't split using colons on windows Fixes #1330 --- diff --git a/alembic/script/base.py b/alembic/script/base.py index 30df6ddb..75061ce2 100644 --- a/alembic/script/base.py +++ b/alembic/script/base.py @@ -221,9 +221,12 @@ class 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(