Skip to content

Commit

Permalink
Fix path list with whitespace
Browse files Browse the repository at this point in the history
  • Loading branch information
daniel.asztalos committed Mar 29, 2019
1 parent 4629d99 commit 354d171
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/rez/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,10 @@ class OptionalStrList(StrList):
class PathList(StrList):
sep = os.pathsep

def _parse_env_var(self, value):
value = value.split(self.sep)
return [x for x in value if x]


class Int(Setting):
schema = Schema(int)
Expand Down
13 changes: 13 additions & 0 deletions src/rez/tests/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,19 @@ def _data(self):
finally:
os.environ = old_environ

def test_7(self):
"""Test path list environment variable with whitespace."""
c = Config([self.root_config_file], locked=False)

# test basic env-var override
packages_path = [
"c:/foo bar/baz",
"c:/foo 2 bar/baz",
]
os.environ["REZ_PACKAGES_PATH"] = os.pathsep.join(packages_path)

self.assertEqual(c.packages_path, packages_path)


if __name__ == '__main__':
unittest.main()
Expand Down

0 comments on commit 354d171

Please sign in to comment.