From 52fe35737024abc5712bda770801fdeb703881fc Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Fri, 17 Aug 2018 14:39:32 -0400 Subject: 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. --- indra/lib/python/indra/util/llmanifest.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'indra/lib') 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") -- cgit v1.2.3