mirror of
https://github.com/python/cpython.git
synced 2025-09-09 18:32:22 +00:00
Remove incorrect usages of map() in distutils.
Reported by Lisandro Dalcin.
This commit is contained in:
parent
9a2310d1b6
commit
61cb087359
6 changed files with 11 additions and 9 deletions
|
@ -158,7 +158,7 @@ class Command:
|
||||||
print(indent + header)
|
print(indent + header)
|
||||||
indent = indent + " "
|
indent = indent + " "
|
||||||
for (option, _, _) in self.user_options:
|
for (option, _, _) in self.user_options:
|
||||||
option = option.translate(longopt_xlate)
|
option = longopt_xlate(option)
|
||||||
if option[-1] == "=":
|
if option[-1] == "=":
|
||||||
option = option[:-1]
|
option = option[:-1]
|
||||||
value = getattr(self, option)
|
value = getattr(self, option)
|
||||||
|
|
|
@ -244,7 +244,7 @@ class build_ext(Command):
|
||||||
|
|
||||||
if self.define:
|
if self.define:
|
||||||
defines = self.define.split(',')
|
defines = self.define.split(',')
|
||||||
self.define = map(lambda symbol: (symbol, '1'), defines)
|
self.define = [(symbol, '1') for symbol in defines]
|
||||||
|
|
||||||
# The option for macros to undefine is also a string from the
|
# The option for macros to undefine is also a string from the
|
||||||
# option parsing, but has to be a list. Multiple symbols can also
|
# option parsing, but has to be a list. Multiple symbols can also
|
||||||
|
|
|
@ -864,7 +864,8 @@ Common commands: (see '--help-commands' for more)
|
||||||
for (option, (source, value)) in option_dict.items():
|
for (option, (source, value)) in option_dict.items():
|
||||||
if DEBUG: print(" %s = %s (from %s)" % (option, value, source))
|
if DEBUG: print(" %s = %s (from %s)" % (option, value, source))
|
||||||
try:
|
try:
|
||||||
bool_opts = map(translate_longopt, command_obj.boolean_options)
|
bool_opts = [translate_longopt(o)
|
||||||
|
for o in command_obj.boolean_options]
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
bool_opts = []
|
bool_opts = []
|
||||||
try:
|
try:
|
||||||
|
|
|
@ -85,13 +85,13 @@ class FileList:
|
||||||
if len(words) < 2:
|
if len(words) < 2:
|
||||||
raise DistutilsTemplateError(
|
raise DistutilsTemplateError(
|
||||||
"'%s' expects <pattern1> <pattern2> ..." % action)
|
"'%s' expects <pattern1> <pattern2> ..." % action)
|
||||||
patterns = map(convert_path, words[1:])
|
patterns = [convert_path(w) for w in words[1:]]
|
||||||
elif action in ('recursive-include', 'recursive-exclude'):
|
elif action in ('recursive-include', 'recursive-exclude'):
|
||||||
if len(words) < 3:
|
if len(words) < 3:
|
||||||
raise DistutilsTemplateError(
|
raise DistutilsTemplateError(
|
||||||
"'%s' expects <dir> <pattern1> <pattern2> ..." % action)
|
"'%s' expects <dir> <pattern1> <pattern2> ..." % action)
|
||||||
dir = convert_path(words[1])
|
dir = convert_path(words[1])
|
||||||
patterns = map(convert_path, words[2:])
|
patterns = [convert_path(w) for w in words[2:]]
|
||||||
elif action in ('graft', 'prune'):
|
elif action in ('graft', 'prune'):
|
||||||
if len(words) != 2:
|
if len(words) != 2:
|
||||||
raise DistutilsTemplateError(
|
raise DistutilsTemplateError(
|
||||||
|
|
|
@ -104,10 +104,10 @@ class MWerksCompiler (CCompiler) :
|
||||||
# This is because we (usually) create the project in a subdirectory of
|
# This is because we (usually) create the project in a subdirectory of
|
||||||
# where we are now, and keeping the paths relative is too much work right
|
# where we are now, and keeping the paths relative is too much work right
|
||||||
# now.
|
# now.
|
||||||
sources = map(self._filename_to_abs, self.__sources)
|
sources = [self._filename_to_abs(s) for s in self.__sources]
|
||||||
include_dirs = map(self._filename_to_abs, self.__include_dirs)
|
include_dirs = [self._filename_to_abs(d) for d in self.__include_dirs]
|
||||||
if objects:
|
if objects:
|
||||||
objects = map(self._filename_to_abs, objects)
|
objects = [self._filename_to_abs(o) for o in objects]
|
||||||
else:
|
else:
|
||||||
objects = []
|
objects = []
|
||||||
if build_temp:
|
if build_temp:
|
||||||
|
|
|
@ -292,7 +292,7 @@ line 3 \\
|
||||||
continues on next line
|
continues on next line
|
||||||
"""
|
"""
|
||||||
# result 1: no fancy options
|
# result 1: no fancy options
|
||||||
result1 = map(lambda x: x + "\n", test_data.split("\n")[0:-1])
|
result1 = [x + "\n" for x in test_data.split("\n")[:-1]]
|
||||||
|
|
||||||
# result 2: just strip comments
|
# result 2: just strip comments
|
||||||
result2 = ["\n",
|
result2 = ["\n",
|
||||||
|
@ -357,4 +357,5 @@ line 3 \\
|
||||||
join_lines=1, rstrip_ws=1, collapse_join=1)
|
join_lines=1, rstrip_ws=1, collapse_join=1)
|
||||||
test_input(6, "join lines with collapsing", in_file, result6)
|
test_input(6, "join lines with collapsing", in_file, result6)
|
||||||
|
|
||||||
|
del in_file
|
||||||
os.remove(filename)
|
os.remove(filename)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue