summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRussel Winder <russel@winder.org.uk>2017-07-11 06:18:09 (GMT)
committerRussel Winder <russel@winder.org.uk>2017-07-11 06:18:09 (GMT)
commit1142cf4ebc2d0a05da8409265f890b40344d3c9e (patch)
treec7752d3922ba8572ba010767cb6d45c3e7019095
parent9d59015f77a88e1a54170206bd943ef7c584d1e9 (diff)
parentd2b59cc6d18e5d3139f623ab4285de34b3dd5596 (diff)
downloadSCons-1142cf4ebc2d0a05da8409265f890b40344d3c9e.zip
SCons-1142cf4ebc2d0a05da8409265f890b40344d3c9e.tar.gz
SCons-1142cf4ebc2d0a05da8409265f890b40344d3c9e.tar.bz2
Merge in from mainline.
-rw-r--r--QMTest/TestCmd.py35
-rw-r--r--bench/lvars-gvars.py6
-rw-r--r--src/engine/SCons/PathList.py4
-rw-r--r--src/engine/SCons/Subst.py2
4 files changed, 24 insertions, 23 deletions
diff --git a/QMTest/TestCmd.py b/QMTest/TestCmd.py
index 61da8b9..0aab9a8 100644
--- a/QMTest/TestCmd.py
+++ b/QMTest/TestCmd.py
@@ -1407,29 +1407,22 @@ class TestCmd(object):
self.timer = threading.Timer(float(timeout), self._timeout)
self.timer.start()
- if sys.version_info[0] == 3 and sys.platform == 'win32':
+ if IS_PY3 and sys.platform == 'win32':
# Set this otherwist stdout/stderr pipes default to
# windows default locale cp1252 which will throw exception
# if using non-ascii characters.
# For example test/Install/non-ascii-name.py
os.environ['PYTHONIOENCODING'] = 'utf-8'
- if sys.version_info[0] == 2 or sys.version_info[0:2] < (3, 6):
- p = Popen(cmd,
- stdin=stdin,
- stdout=subprocess.PIPE,
- stderr=stderr_value,
- env=os.environ,
- universal_newlines=False)
- else:
- # this will only work on py3.6, encoding
- p = Popen(cmd,
- stdin=stdin,
- stdout=subprocess.PIPE,
- stderr=stderr_value,
- env=os.environ,
- universal_newlines=universal_newlines,
- encoding='utf-8')
+ # It seems that all pythons up to py3.6 still set text mode if you set encoding.
+ # TODO: File enhancement request on python to propagate universal_newlines even
+ # if encoding is set.hg c
+ p = Popen(cmd,
+ stdin=stdin,
+ stdout=subprocess.PIPE,
+ stderr=stderr_value,
+ env=os.environ,
+ universal_newlines=False)
self.process = p
return p
@@ -1452,7 +1445,9 @@ class TestCmd(object):
if not stream:
return stream
- elif sys.version_info[0] == 3 and sys.version_info[1] < 6:
+ # TODO: Run full tests on both platforms and see if this fixes failures
+ # It seems that py3.6 still sets text mode if you set encoding.
+ elif sys.version_info[0] == 3:# TODO and sys.version_info[1] < 6:
stream = stream.decode('utf-8')
stream = stream.replace('\r\n', '\n')
elif sys.version_info[0] == 2:
@@ -1521,8 +1516,8 @@ class TestCmd(object):
if is_List(stdin):
stdin = ''.join(stdin)
- if stdin and sys.version_info[0] == 3 and sys.version_info[1] < 6:
- stdin = bytearray(stdin,'utf-8')
+ if stdin and IS_PY3:# and sys.version_info[1] < 6:
+ stdin = to_bytes(stdin)
# TODO(sgk): figure out how to re-use the logic in the .finish()
# method above. Just calling it from here causes problems with
diff --git a/bench/lvars-gvars.py b/bench/lvars-gvars.py
index bdb09ef..1511203 100644
--- a/bench/lvars-gvars.py
+++ b/bench/lvars-gvars.py
@@ -45,6 +45,12 @@ def Func4(var, gvars, lvars):
except NameError:
x = ''
+def Func5(var, gvars, lvars):
+ """Chained get with default values"""
+ for i in IterationList:
+ x = lvars.get(var,gvars.get(var,''))
+
+
# Data to pass to the functions on each run. Each entry is a
# three-element tuple:
#
diff --git a/src/engine/SCons/PathList.py b/src/engine/SCons/PathList.py
index 77e30c4..76cbeab 100644
--- a/src/engine/SCons/PathList.py
+++ b/src/engine/SCons/PathList.py
@@ -104,11 +104,11 @@ class _PathList(object):
pl = []
for p in pathlist:
try:
- index = p.find('$')
+ found = '$' in p
except (AttributeError, TypeError):
type = TYPE_OBJECT
else:
- if index == -1:
+ if not found:
type = TYPE_STRING_NO_SUBST
else:
type = TYPE_STRING_SUBST
diff --git a/src/engine/SCons/Subst.py b/src/engine/SCons/Subst.py
index 3c9b390..9aa4bbc 100644
--- a/src/engine/SCons/Subst.py
+++ b/src/engine/SCons/Subst.py
@@ -438,7 +438,7 @@ def scons_subst(strSubst, env, mode=SUBST_RAW, target=None, source=None, gvars={
return s
else:
key = s[1:]
- if key[0] == '{' or key.find('.') >= 0:
+ if key[0] == '{' or '.' in key:
if key[0] == '{':
key = key[1:-1]
try: