You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@buildstream.apache.org by gi...@apache.org on 2020/12/29 13:23:54 UTC

[buildstream] 11/25: element: platform independent _get_normal_name

This is an automated email from the ASF dual-hosted git repository.

github-bot pushed a commit to branch aevri/win32_minimal
in repository https://gitbox.apache.org/repos/asf/buildstream.git

commit 98b2c87e3d80433f133b49456596f10ec689bf3e
Author: Angelos Evripiotis <je...@bloomberg.net>
AuthorDate: Tue Jun 25 14:23:43 2019 +0100

    element: platform independent _get_normal_name
    
    Note that windows has two path separators '/' and '\', handle both.
---
 src/buildstream/element.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/buildstream/element.py b/src/buildstream/element.py
index 4ebb17d..bbb0459 100644
--- a/src/buildstream/element.py
+++ b/src/buildstream/element.py
@@ -3369,7 +3369,10 @@ def _overlap_error_detail(f, forbidden_overlap_elements, elements):
 #     (str): The normalised element name
 #
 def _get_normal_name(element_name):
-    return os.path.splitext(element_name.replace(os.sep, '-'))[0]
+    name_no_sep = element_name.replace(os.sep, '-')
+    if os.altsep is not None:
+        name_no_sep = name_no_sep.replace(os.altsep, '-')
+    return os.path.splitext(name_no_sep)[0]
 
 
 # _compose_artifact_name():