summaryrefslogtreecommitdiff
path: root/src/buildstream/utils.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/buildstream/utils.py')
-rw-r--r--src/buildstream/utils.py22
1 files changed, 4 insertions, 18 deletions
diff --git a/src/buildstream/utils.py b/src/buildstream/utils.py
index 03ff67bf2..0c729aaa0 100644
--- a/src/buildstream/utils.py
+++ b/src/buildstream/utils.py
@@ -30,7 +30,6 @@ import shutil
import signal
import stat
from stat import S_ISDIR
-import string
import subprocess
import tempfile
import itertools
@@ -42,6 +41,10 @@ from . import _signals
from ._exceptions import BstError, ErrorDomain
from ._protos.build.bazel.remote.execution.v2 import remote_execution_pb2
+# Contains utils that have been rewritten in Cython for speed benefits
+# This makes them available when importing from utils
+from ._utils import url_directory_name # pylint: disable=unused-import
+
# The magic number for timestamps: 2011-11-11 11:11:11
BST_ARBITRARY_TIMESTAMP = calendar.timegm([2011, 11, 11, 11, 11, 11])
@@ -456,23 +459,6 @@ def get_host_tool(name):
return program_path
-def url_directory_name(url):
- """Normalizes a url into a directory name
-
- Args:
- url (str): A url string
-
- Returns:
- A string which can be used as a directory name
- """
- valid_chars = string.digits + string.ascii_letters + '%_'
-
- def transl(x):
- return x if x in valid_chars else '_'
-
- return ''.join([transl(x) for x in url])
-
-
def get_bst_version():
"""Gets the major, minor release portion of the
BuildStream version.