diff options
author | Nat Goodspeed <nat@lindenlab.com> | 2018-08-17 14:39:32 -0400 |
---|---|---|
committer | Nat Goodspeed <nat@lindenlab.com> | 2018-08-17 14:39:32 -0400 |
commit | 52fe35737024abc5712bda770801fdeb703881fc (patch) | |
tree | 2f8de3b1c01d2d118e5ff5fa0df122883b6db287 | |
parent | 64034e83940e717d5aaf1e1f0dac5a9ed59bf835 (diff) |
DRTVWR-447: Use os.path.split(path) instead of path.split(os.sep).
On Windows, where 'path' might be separated either with '/' or '\', the latter
breaks unless all path separators are in fact the os.sep character '\'. While
it would be possible to code something fancy with os.sep and os.altsep,
testing the latter for None, much simpler to let os.path.split() handle it.
-rwxr-xr-x | indra/lib/python/indra/util/llmanifest.py | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/indra/lib/python/indra/util/llmanifest.py b/indra/lib/python/indra/util/llmanifest.py index c24e25ba89..611f72269e 100755 --- a/indra/lib/python/indra/util/llmanifest.py +++ b/indra/lib/python/indra/util/llmanifest.py @@ -251,17 +251,21 @@ def main(): additional_packages = os.environ.get("additional_packages", "").split() if additional_packages: # Determine destination prefix / suffix for additional packages. - base_dest_parts = args['dest'].split(os.sep) + base_dest_parts = list(os.path.split(args['dest'])) base_dest_parts.insert(-1, "{}") - base_dest_template = os.sep.join(base_dest_parts) + base_dest_template = os.path.join(*base_dest_parts) # Determine touched prefix / suffix for additional packages. if touch: - base_touch_parts = touch.split(os.sep) + base_touch_parts = list(os.path.split(touch)) + # Because of the special insert() logic below, we don't just want + # [dirpath, basename]; we want [dirpath, directory, basename]. + # Further split the dirpath and replace it in the list. + base_touch_parts[0:1] = os.path.split(base_touch_parts[0]) if "arwin" in args['platform']: base_touch_parts.insert(-1, "{}") else: base_touch_parts.insert(-2, "{}") - base_touch_template = os.sep.join(base_touch_parts) + base_touch_template = os.path.join(*base_touch_parts) for package_id in additional_packages: args['channel_suffix'] = os.environ.get(package_id + "_viewer_channel_suffix") args['sourceid'] = os.environ.get(package_id + "_sourceid") |