summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Ennis <james.ennis@codethink.co.uk>2019-08-16 11:05:52 +0100
committerJames Ennis <james.ennis@codethink.co.uk>2019-08-16 16:06:00 +0100
commit18937d9cf99bb1e33b156cc501bec0f5c3713fcd (patch)
tree4a799c647627866bc1a86fa2451637efb775aee7
parent244a0b93afe0c08e0ec4f5d9d0abf742b77f87d2 (diff)
downloadbuildstream-18937d9cf99bb1e33b156cc501bec0f5c3713fcd.tar.gz
element.py: Move _get_normal_name() to utils
-rw-r--r--src/buildstream/element.py17
-rw-r--r--src/buildstream/testing/runcli.py3
-rw-r--r--src/buildstream/utils.py15
3 files changed, 18 insertions, 17 deletions
diff --git a/src/buildstream/element.py b/src/buildstream/element.py
index f58d139b6..6253ffc46 100644
--- a/src/buildstream/element.py
+++ b/src/buildstream/element.py
@@ -198,7 +198,7 @@ class Element(Plugin):
project.ensure_fully_loaded()
self.project_name = self._get_project().name
- self.normal_name = _get_normal_name(self.name)
+ self.normal_name = utils._get_normal_name(self.name)
"""A normalized element name
This is the original element without path separators or
@@ -3292,21 +3292,6 @@ def _overlap_error_detail(f, forbidden_overlap_elements, elements):
return ""
-# _get_normal_name():
-#
-# Get the element name without path separators or
-# the extension.
-#
-# Args:
-# element_name (str): The element's name
-#
-# Returns:
-# (str): The normalised element name
-#
-def _get_normal_name(element_name):
- return os.path.splitext(element_name.replace(os.sep, '-'))[0]
-
-
# _compose_artifact_name():
#
# Compose the completely resolved 'artifact_name' as a filepath
diff --git a/src/buildstream/testing/runcli.py b/src/buildstream/testing/runcli.py
index 95bf83eff..29d7391cf 100644
--- a/src/buildstream/testing/runcli.py
+++ b/src/buildstream/testing/runcli.py
@@ -53,7 +53,8 @@ from _pytest.capture import MultiCapture, FDCapture, FDCaptureBinary
from buildstream._frontend import cli as bst_cli
from buildstream import _yaml
from buildstream._cas import CASCache
-from buildstream.element import _get_normal_name, _compose_artifact_name
+from buildstream.element import _compose_artifact_name
+from buildstream.utils import _get_normal_name
# Special private exception accessor, for test case purposes
from buildstream._exceptions import BstError, get_last_exception, get_last_task_error
diff --git a/src/buildstream/utils.py b/src/buildstream/utils.py
index 2c57925d4..8a17e6fe5 100644
--- a/src/buildstream/utils.py
+++ b/src/buildstream/utils.py
@@ -1372,3 +1372,18 @@ def _get_compression(tar):
else:
# Assume just an unconventional name was provided, default to uncompressed
return ''
+
+
+# _get_normal_name():
+#
+# Get the element name without path separators or
+# the extension.
+#
+# Args:
+# element_name (str): The element's name
+#
+# Returns:
+# (str): The normalised element name
+#
+def _get_normal_name(element_name):
+ return os.path.splitext(element_name.replace(os.sep, '-'))[0]