From 56338f3d70abada98a85451f4f83ed9a3ec93b38 Mon Sep 17 00:00:00 2001 From: iLLiCiTiT Date: Thu, 9 Apr 2020 18:10:38 +0200 Subject: [PATCH] do not use PYPE_CORE_* environments --- .../global/publish/submit_publish_job.py | 8 +--- .../maya/publish/submit_maya_muster.py | 38 ++++++------------- .../nuke/publish/submit_nuke_deadline.py | 31 ++++++--------- 3 files changed, 25 insertions(+), 52 deletions(-) diff --git a/pype/plugins/global/publish/submit_publish_job.py b/pype/plugins/global/publish/submit_publish_job.py index f8b2c80fa3..8525657b21 100644 --- a/pype/plugins/global/publish/submit_publish_job.py +++ b/pype/plugins/global/publish/submit_publish_job.py @@ -20,13 +20,7 @@ def _get_script(): if module_path.endswith(".pyc"): module_path = module_path[: -len(".pyc")] + ".py" - module_path = os.path.normpath(module_path) - mount_root = os.path.normpath(os.environ["PYPE_CORE_MOUNT"]) - network_root = os.path.normpath(os.environ["PYPE_CORE_PATH"]) - - module_path = module_path.replace(mount_root, network_root) - - return module_path + return os.path.normpath(module_path) # Logic to retrieve latest files concerning extendFrames diff --git a/pype/plugins/maya/publish/submit_maya_muster.py b/pype/plugins/maya/publish/submit_maya_muster.py index fdd246d012..c6660fe601 100644 --- a/pype/plugins/maya/publish/submit_maya_muster.py +++ b/pype/plugins/maya/publish/submit_maya_muster.py @@ -309,13 +309,7 @@ class MayaSubmitMuster(pyblish.api.InstancePlugin): output_dir = instance.data["outputDir"] metadata_path = os.path.join(output_dir, metadata_filename) - # replace path for UNC / network share paths, co PYPE is found - # over network. It assumes PYPE is located somewhere in - # PYPE_CORE_PATH - pype_root = os.environ["PYPE_SETUP_PATH"].replace( - os.path.normpath(os.environ['PYPE_CORE_MOUNT']), - os.path.normpath(os.environ['PYPE_CORE_PATH']) - ) + pype_root = os.environ["PYPE_SETUP_PATH"] # we must provide either full path to executable or use musters own # python named MPython.exe, residing directly in muster bin @@ -516,33 +510,25 @@ class MayaSubmitMuster(pyblish.api.InstancePlugin): environment["PATH"] = os.environ["PATH"] # self.log.debug("enviro: {}".format(environment['PYPE_SCRIPTS'])) clean_environment = {} - for key in environment: + for key, value in environment.items(): clean_path = "" self.log.debug("key: {}".format(key)) - to_process = environment[key] - if key == "PYPE_CORE_MOUNT": - clean_path = environment[key] - elif "://" in environment[key]: - clean_path = environment[key] - elif os.pathsep not in to_process: - try: - path = environment[key] - path.decode('UTF-8', 'strict') - clean_path = os.path.normpath(path) - except UnicodeDecodeError: - print('path contains non UTF characters') + if "://" in value: + clean_path = value else: - for path in environment[key].split(os.pathsep): + valid_paths = [] + for path in value.split(os.pathsep): + if not path: + continue try: path.decode('UTF-8', 'strict') - clean_path += os.path.normpath(path) + os.pathsep + valid_paths.append(os.path.normpath(path)) except UnicodeDecodeError: print('path contains non UTF characters') - # this should replace paths so they are pointing to network share - clean_path = clean_path.replace( - os.path.normpath(environment['PYPE_CORE_MOUNT']), - os.path.normpath(environment['PYPE_CORE_PATH'])) + if valid_paths: + clean_path = os.pathsep.join(valid_paths) + clean_environment[key] = clean_path return clean_environment diff --git a/pype/plugins/nuke/publish/submit_nuke_deadline.py b/pype/plugins/nuke/publish/submit_nuke_deadline.py index 9ee988b5ae..81952dcd9c 100644 --- a/pype/plugins/nuke/publish/submit_nuke_deadline.py +++ b/pype/plugins/nuke/publish/submit_nuke_deadline.py @@ -194,36 +194,29 @@ class NukeSubmitDeadline(pyblish.api.InstancePlugin): environment["PATH"] = os.environ["PATH"] # self.log.debug("enviro: {}".format(environment['PYPE_SCRIPTS'])) clean_environment = {} - for key in environment: + for key, value in environment.items(): clean_path = "" self.log.debug("key: {}".format(key)) - to_process = environment[key] - if key == "PYPE_CORE_MOUNT": - clean_path = environment[key] - elif "://" in environment[key]: - clean_path = environment[key] - elif os.pathsep not in to_process: - try: - path = environment[key] - path.decode('UTF-8', 'strict') - clean_path = os.path.normpath(path) - except UnicodeDecodeError: - print('path contains non UTF characters') + if "://" in value: + clean_path = value else: - for path in environment[key].split(os.pathsep): + valid_paths = [] + for path in value.split(os.pathsep): + if not path: + continue try: path.decode('UTF-8', 'strict') - clean_path += os.path.normpath(path) + os.pathsep + valid_paths.append(os.path.normpath(path)) except UnicodeDecodeError: print('path contains non UTF characters') + if valid_paths: + clean_path = os.pathsep.join(valid_paths) + if key == "PYTHONPATH": clean_path = clean_path.replace('python2', 'python3') - clean_path = clean_path.replace( - os.path.normpath(environment['PYPE_CORE_MOUNT']), - os.path.normpath(environment['PYPE_CORE_PATH']) - ) + self.log.debug("clean path: {}".format(clean_path)) clean_environment[key] = clean_path environment = clean_environment