summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMats Wichmann <mats@linux.com>2018-08-27 16:18:39 (GMT)
committerMats Wichmann <mats@linux.com>2018-12-17 15:09:39 (GMT)
commitfbdfe85f5123a9ac41adef700b57df3b6ee41468 (patch)
treef131090bb91d6d2cd64113ebc6c9e92f7d4ad9eb
parent28ad2f71fddddb6522ce2ff6505bfbfb1d1c265b (diff)
downloadSCons-fbdfe85f5123a9ac41adef700b57df3b6ee41468.zip
SCons-fbdfe85f5123a9ac41adef700b57df3b6ee41468.tar.gz
SCons-fbdfe85f5123a9ac41adef700b57df3b6ee41468.tar.bz2
small type-related cleanups
Two files in packaging: ipk.py indexed off the result of running filter, but in Python 3 filter returns an iterable, not a list. Convert to a list first. msi.py removes forbidden characters using a list comprehension, but the result is a list, so when it then calls upper() on it that's a method that does not exist on a list. Join it back into a string. Found another place in the same file that also assumed the list comprehension leaves a string, not a list, although it doesn't then call a nonexistent method on it. Signed-off-by: Mats Wichmann <mats@linux.com>
-rw-r--r--src/engine/SCons/Tool/packaging/ipk.py8
-rw-r--r--src/engine/SCons/Tool/packaging/msi.py6
2 files changed, 9 insertions, 5 deletions
diff --git a/src/engine/SCons/Tool/packaging/ipk.py b/src/engine/SCons/Tool/packaging/ipk.py
index ad4fe0f..2ecaa9b 100644
--- a/src/engine/SCons/Tool/packaging/ipk.py
+++ b/src/engine/SCons/Tool/packaging/ipk.py
@@ -26,9 +26,11 @@
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+import os
+
import SCons.Builder
import SCons.Node.FS
-import os
+import SCons.Util
from SCons.Tool.packaging import stripinstallbuilder, putintopackageroot
@@ -119,7 +121,9 @@ def build_specfiles(source, target, env):
try:
return opened_files[needle]
except KeyError:
- file=filter(lambda x: x.get_path().rfind(needle)!=-1, haystack)[0]
+ files = filter(lambda x: x.get_path().rfind(needle) != -1, haystack)
+ # Py3: filter returns an iterable, not a list
+ file = list(files)[0]
opened_files[needle]=open(file.get_abspath(), 'w')
return opened_files[needle]
diff --git a/src/engine/SCons/Tool/packaging/msi.py b/src/engine/SCons/Tool/packaging/msi.py
index 7e28df3..052d7d8 100644
--- a/src/engine/SCons/Tool/packaging/msi.py
+++ b/src/engine/SCons/Tool/packaging/msi.py
@@ -63,8 +63,8 @@ def convert_to_id(s, id_set):
"""
charset = 'ABCDEFGHIJKLMNOPQRSTUVWXYabcdefghijklmnopqrstuvwxyz0123456789_.'
if s[0] in '0123456789.':
- s += '_'+s
- id = [c for c in s if c in charset]
+ s = '_' + s
+ id = ''.join([c for c in s if c in charset])
# did we already generate an id for this file?
try:
@@ -108,7 +108,7 @@ def gen_dos_short_file_name(file, filename_set):
# strip forbidden characters.
forbidden = '."/[]:;=, '
- fname = [c for c in fname if c not in forbidden]
+ fname = ''.join([c for c in fname if c not in forbidden])
# check if we already generated a filename with the same number:
# thisis1.txt, thisis2.txt etc.