[libcxx-commits] [libcxx] 75a815a - [libc++] Use Lit utilities instead of old libcxx utilities for str/bytes conversions
Louis Dionne via libcxx-commits
libcxx-commits at lists.llvm.org
Thu Apr 30 12:53:38 PDT 2020
Author: Louis Dionne
Date: 2020-04-30T15:49:40-04:00
New Revision: 75a815a28c58bd20ede05115b5cf1441aedf6d04
URL: https://github.com/llvm/llvm-project/commit/75a815a28c58bd20ede05115b5cf1441aedf6d04
DIFF: https://github.com/llvm/llvm-project/commit/75a815a28c58bd20ede05115b5cf1441aedf6d04.diff
LOG: [libc++] Use Lit utilities instead of old libcxx utilities for str/bytes conversions
The libcxx.util utilities don't work properly, and we should remove them
when we get rid of compiler.py. In particular, libcxx.util.to_string
appears to be completely broken.
Added:
Modified:
libcxx/test/libcxx/selftest/dsl/lit.local.cfg
libcxx/utils/libcxx/test/target_info.py
Removed:
################################################################################
diff --git a/libcxx/test/libcxx/selftest/dsl/lit.local.cfg b/libcxx/test/libcxx/selftest/dsl/lit.local.cfg
index 93e0ed52e0e6..8cf3543690f4 100644
--- a/libcxx/test/libcxx/selftest/dsl/lit.local.cfg
+++ b/libcxx/test/libcxx/selftest/dsl/lit.local.cfg
@@ -10,7 +10,8 @@
# in this directory. We then base64-decode them from the tests when we need to.
# Another option would be to have a way to prevent expansion in Lit itself.
import base64
-base64Encode = lambda s: base64.b64encode(s.encode()).decode()
+import lit.util
+base64Encode = lambda s: lit.util.to_string(base64.b64encode(lit.util.to_bytes(s)))
escaped = [(k.replace('%{', '%{escaped_'), base64Encode(v)) for (k, v) in config.substitutions]
config.substitutions.extend(escaped)
diff --git a/libcxx/utils/libcxx/test/target_info.py b/libcxx/utils/libcxx/test/target_info.py
index 2f4debacb6bb..b5b8a9ded804 100644
--- a/libcxx/utils/libcxx/test/target_info.py
+++ b/libcxx/utils/libcxx/test/target_info.py
@@ -7,6 +7,7 @@
#===----------------------------------------------------------------------===//
import importlib
+import lit.util
import locale
import os
import platform
@@ -14,7 +15,7 @@
import subprocess
import sys
-from libcxx.util import executeCommand, to_string
+from libcxx.util import executeCommand
class DefaultTargetInfo(object):
def __init__(self, full_config):
@@ -91,12 +92,12 @@ def __init__(self, full_config):
super(DarwinLocalTI, self).__init__(full_config)
def is_host_macosx(self):
- name = to_string(subprocess.check_output(['sw_vers', '-productName'])).strip()
+ name = lit.util.to_string(subprocess.check_output(['sw_vers', '-productName'])).strip()
return name == "Mac OS X"
def get_macosx_version(self):
assert self.is_host_macosx()
- version = to_string(subprocess.check_output(['sw_vers', '-productVersion'])).strip()
+ version = lit.util.to_string(subprocess.check_output(['sw_vers', '-productVersion'])).strip()
version = re.sub(r'([0-9]+\.[0-9]+)(\..*)?', r'\1', version)
return version
More information about the libcxx-commits
mailing list