Skip to content

Commit

Permalink
[libc++] Use Lit utilities instead of old libcxx utilities for str/by…
Browse files Browse the repository at this point in the history
…tes 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.
  • Loading branch information
ldionne committed Apr 30, 2020
1 parent b4934ae commit 75a815a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
3 changes: 2 additions & 1 deletion libcxx/test/libcxx/selftest/dsl/lit.local.cfg
Expand Up @@ -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)

Expand Down
7 changes: 4 additions & 3 deletions libcxx/utils/libcxx/test/target_info.py
Expand Up @@ -7,14 +7,15 @@
#===----------------------------------------------------------------------===//

import importlib
import lit.util
import locale
import os
import platform
import re
import subprocess
import sys

from libcxx.util import executeCommand, to_string
from libcxx.util import executeCommand

class DefaultTargetInfo(object):
def __init__(self, full_config):
Expand Down Expand Up @@ -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

Expand Down

0 comments on commit 75a815a

Please sign in to comment.