[Mesa-dev] [PATCH mesa 3/6] scons: use python3-compatible lists

Jose Fonseca jfonseca at vmware.com
Wed Sep 20 17:03:21 UTC 2017


On 19/09/17 15:14, Eric Engestrom wrote:
> Signed-off-by: Eric Engestrom <eric.engestrom at imgtec.com>
> ---
>   SConstruct      | 3 +--
>   scons/custom.py | 8 ++++----
>   2 files changed, 5 insertions(+), 6 deletions(-)
> 
> diff --git a/SConstruct b/SConstruct
> index 0215aa83073f120fe9df..a59a8ea210e956bb67de 100644
> --- a/SConstruct
> +++ b/SConstruct
> @@ -152,8 +152,7 @@ try:
>   except ImportError:
>       pass
>   else:
> -    aliases = default_ans.keys()
> -    aliases.sort()
> +    aliases = sorted(default_ans.keys())
>       env.Help('\n')
>       env.Help('Recognized targets:\n')
>       for alias in aliases:
> diff --git a/scons/custom.py b/scons/custom.py
> index 955247ccf2045424c32b..0767ba936d410167116d 100644
> --- a/scons/custom.py
> +++ b/scons/custom.py
> @@ -113,7 +113,7 @@ def python_scan(node, env, path):
>       finder = modulefinder.ModuleFinder(path=path)
>       finder.run_script(node.abspath)
>       results = []
> -    for name, mod in finder.modules.iteritems():
> +    for name, mod in list(finder.modules.items()):

I think you can omit list() when used with for, here and other similar 
cases.

>           if mod.__file__ is None:
>               continue
>           assert os.path.exists(mod.__file__)
> @@ -189,7 +189,7 @@ def _pkg_check_modules(env, name, modules):
>       except OSError:
>           return
>       prefix = name + '_'
> -    for flag_name, flag_value in flags.iteritems():
> +    for flag_name, flag_value in list(flags.items())
>           assert '_' not in flag_name
>           env[prefix + flag_name] = flag_value
>   
> @@ -222,7 +222,7 @@ def pkg_use_modules(env, names):
>               raise Exception('Attempt to use unavailable module %s' % name)
>   
>           flags = {}
> -        for flag_name, flag_value in env.Dictionary().iteritems():
> +        for flag_name, flag_value in list(env.Dictionary().items()):
>               if flag_name.startswith(prefix):
>                   flag_name = flag_name[len(prefix):]
>                   if '_' not in flag_name:
> @@ -262,7 +262,7 @@ def parse_source_list(env, filename, names=None):
>   
>           symbols = names
>       else:
> -        symbols = sym_table.keys()
> +        symbols = list(sym_table.keys())

This one needs to stay.

>   
>       # convert the symbol table to source lists
>       src_lists = {}
> 

Either way, this patch is

Reviewed-by: Jose Fonseca <jfonseca at vmware.com>


More information about the mesa-dev mailing list