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:14:31 UTC

[buildstream] 02/16: Move _ALIAS_SEPARATOR into utils

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

github-bot pushed a commit to branch jonathan/mirror-client-sourcedownloader-tidy
in repository https://gitbox.apache.org/repos/asf/buildstream.git

commit c4294e24640a360dca9d40dd7ea9f09c759dae95
Author: Jonathan Maw <jo...@codethink.co.uk>
AuthorDate: Mon Apr 9 16:18:27 2018 +0100

    Move _ALIAS_SEPARATOR into utils
    
    The separator is useful in source files other than _project.py
---
 buildstream/_project.py | 7 ++-----
 buildstream/utils.py    | 4 ++++
 2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/buildstream/_project.py b/buildstream/_project.py
index 188bf27..110aeec 100644
--- a/buildstream/_project.py
+++ b/buildstream/_project.py
@@ -36,9 +36,6 @@ from ._projectrefs import ProjectRefs, ProjectRefStorage
 from ._versions import BST_FORMAT_VERSION
 
 
-# The separator we use for user specified aliases
-_ALIAS_SEPARATOR = ':'
-
 # Project Configuration file
 _PROJECT_CONF_FILE = 'project.conf'
 
@@ -137,8 +134,8 @@ class Project():
     # fully qualified urls based on the shorthand which is allowed
     # to be specified in the YAML
     def translate_url(self, url):
-        if url and _ALIAS_SEPARATOR in url:
-            url_alias, url_body = url.split(_ALIAS_SEPARATOR, 1)
+        if url and utils._ALIAS_SEPARATOR in url:
+            url_alias, url_body = url.split(utils._ALIAS_SEPARATOR, 1)
             alias_url = self._aliases.get(url_alias)
             if alias_url:
                 url = alias_url + url_body
diff --git a/buildstream/utils.py b/buildstream/utils.py
index 70759dc..cf0123d 100644
--- a/buildstream/utils.py
+++ b/buildstream/utils.py
@@ -43,6 +43,10 @@ from . import _signals
 from ._exceptions import BstError, ErrorDomain
 
 
+# The separator we use for user specified aliases
+_ALIAS_SEPARATOR = ':'
+
+
 class UtilError(BstError):
     """Raised by utility functions when system calls fail.