Skip to content

Commit

Permalink
Support ; to split basedirs on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
fliiiix committed Feb 9, 2019
1 parent 923e84d commit b40c523
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
5 changes: 4 additions & 1 deletion docs/commandline.rst
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,10 @@ containing steps and terrain functions from multiple locations:
Since version v0.7.0 you can use multiple basedirs within one ``-b`` flag split
by a colon (:). Similar to the possibilities you've got with ``$PATH``.
This feature is not supported on Windows, because the colon (:) is used in almost any absolute path, e.g. ``C:\foo\bar``.
On Windows it is not possbile to use a colon (:) because it is used
in almost any absolute path, e.g. ``C:\foo\bar``.
Since version v0.11.2 you can use a semicolon (;) on Windows for
multiple basedirs.


Run - Early exit
Expand Down
6 changes: 2 additions & 4 deletions radish/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,5 @@ def flattened_basedirs(basedirs):
Multiple basedirs can be specified within a
single element split by a colon.
"""
if os.name == "nt":
return basedirs

return list(x for x in itertools.chain(*(x.split(":") for x in basedirs)) if x)
separator = ";" if os.name == "nt" else ":"
return list(x for x in itertools.chain(*(x.split(separator) for x in basedirs)) if x)
1 change: 1 addition & 0 deletions tests/unit/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
),
(["foo:", ":bar"], ["foo", "bar"], "posix"),
(["C:\\windows\\radish"], ["C:\\windows\\radish"], "nt"),
(["C:\\windows;radish"], ["C:\\windows", "radish"], "nt"),
],
)
def test_flattened_basedirs(mocker, basedirs, expected_basedirs, os_name):
Expand Down

0 comments on commit b40c523

Please sign in to comment.