Bug 1603181 - mozbuild/preprocessor.py and test_preprocessor.py support Python3 r=froydnj

Differential Revision: https://phabricator.services.mozilla.com/D56808

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Ricky Stewart 2019-12-12 00:13:25 +00:00
parent c424194edf
commit 8125df23f2
4 changed files with 8 additions and 12 deletions

View File

@ -324,14 +324,14 @@ class Preprocessor:
for cmd, level in (
('define', 0),
('undef', 0),
('if', sys.maxint),
('ifdef', sys.maxint),
('ifndef', sys.maxint),
('if', sys.maxsize),
('ifdef', sys.maxsize),
('ifndef', sys.maxsize),
('else', 1),
('elif', 1),
('elifdef', 1),
('elifndef', 1),
('endif', sys.maxint),
('endif', sys.maxsize),
('expand', 0),
('literal', 0),
('filter', 0),
@ -730,9 +730,7 @@ class Preprocessor:
current = dict(self.filters)
for f in filters:
current[f] = getattr(self, 'filter_' + f)
filterNames = current.keys()
filterNames.sort()
self.filters = [(fn, current[fn]) for fn in filterNames]
self.filters = [(fn, current[fn]) for fn in sorted(current.keys())]
return
def do_unfilter(self, args):
@ -741,9 +739,7 @@ class Preprocessor:
for f in filters:
if f in current:
del current[f]
filterNames = current.keys()
filterNames.sort()
self.filters = [(fn, current[fn]) for fn in filterNames]
self.filters = [(fn, current[fn]) for fn in sorted(current.keys())]
return
# Filters

View File

@ -3,5 +3,6 @@ subsuite = mozbuild
[test_expression.py]
[test_licenses.py]
[test_preprocessor.py]
[test_pythonutil.py]
[test_util_fileavoidwrite.py]

View File

@ -45,5 +45,4 @@ skip-if = (os == "win")
[test_makeutil.py]
[test_mozconfig.py]
[test_mozinfo.py]
[test_preprocessor.py]
[test_util.py]

View File

@ -6,9 +6,9 @@ from __future__ import absolute_import, print_function
import unittest
from StringIO import StringIO
import os
import shutil
from six import StringIO
from tempfile import mkdtemp