Skip to content
This repository has been archived by the owner on Sep 20, 2024. It is now read-only.

Commit

Permalink
Merge pull request #2302 from pypeclub/bugfix/OP-2050_Delivery-action…
Browse files Browse the repository at this point in the history
…-cannot-publish-representation-published-on-different-platform

Delivery: Fix delivery paths created on windows
  • Loading branch information
iLLiCiTiT authored Nov 26, 2021
2 parents 6124d5b + b3d581d commit 4eaea20
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions openpype/lib/delivery.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,13 @@ def path_from_representation(representation, anatomy):
path = pipeline.format_template_with_optional_keys(
context, template
)
path = os.path.normpath(path.replace("/", "\\"))

except KeyError:
# Template references unavailable data
return None

return os.path.normpath(path)
return path


def copy_file(src_path, dst_path):
Expand Down Expand Up @@ -179,9 +180,11 @@ def process_single_file(
Returns:
(collections.defaultdict , int)
"""
# Make sure path is valid for all platforms
src_path = os.path.normpath(src_path.replace("\\", "/"))

if not os.path.exists(src_path):
msg = "{} doesn't exist for {}".format(src_path,
repre["_id"])
msg = "{} doesn't exist for {}".format(src_path, repre["_id"])
report_items["Source file was not found"].append(msg)
return report_items, 0

Expand All @@ -192,8 +195,10 @@ def process_single_file(
else:
delivery_path = anatomy_filled["delivery"][template_name]

# context.representation could be .psd
# Backwards compatibility when extension contained `.`
delivery_path = delivery_path.replace("..", ".")
# Make sure path is valid for all platforms
delivery_path = os.path.normpath(delivery_path.replace("\\", "/"))

delivery_folder = os.path.dirname(delivery_path)
if not os.path.exists(delivery_folder):
Expand Down Expand Up @@ -230,14 +235,14 @@ def process_sequence(
Returns:
(collections.defaultdict , int)
"""
src_path = os.path.normpath(src_path.replace("\\", "/"))

def hash_path_exist(myPath):
res = myPath.replace('#', '*')
glob_search_results = glob.glob(res)
if len(glob_search_results) > 0:
return True
else:
return False
return False

if not hash_path_exist(src_path):
msg = "{} doesn't exist for {}".format(src_path,
Expand Down Expand Up @@ -307,6 +312,7 @@ def hash_path_exist(myPath):
else:
delivery_path = anatomy_filled["delivery"][template_name]

delivery_path = os.path.normpath(delivery_path.replace("\\", "/"))
delivery_folder = os.path.dirname(delivery_path)
dst_head, dst_tail = delivery_path.split(frame_indicator)
dst_padding = src_collection.padding
Expand Down

0 comments on commit 4eaea20

Please sign in to comment.