mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-01-31 19:10:36 +00:00
Bug 804005 - Update dom/imptests python to be py3k-compatible; r=jhammel
This commit is contained in:
parent
2306a43dbc
commit
1dafc5be3e
@ -10,6 +10,8 @@ Note: removes both source and destination directory before starting. Do not
|
||||
use with outstanding changes in either directory.
|
||||
"""
|
||||
|
||||
from __future__ import print_function, unicode_literals
|
||||
|
||||
import os
|
||||
import shutil
|
||||
import subprocess
|
||||
@ -32,7 +34,7 @@ def getData(confFile):
|
||||
dest = ""
|
||||
directories = []
|
||||
try:
|
||||
fp = open(confFile, "rb")
|
||||
fp = open(confFile, "r")
|
||||
first = True
|
||||
for line in fp:
|
||||
if first:
|
||||
@ -56,7 +58,7 @@ def copy(thissrcdir, dest, directories):
|
||||
"""Copy mochitests and support files from the external HG directory to their
|
||||
place in mozilla-central.
|
||||
"""
|
||||
print "Copying %s..." % (directories, )
|
||||
print("Copying %s..." % directories)
|
||||
for d in directories:
|
||||
subdirs, mochitests, supportfiles = parseManifestFile(dest, d)
|
||||
sourcedir = makePath("hg-%s" % dest, d)
|
||||
@ -79,9 +81,9 @@ def printMakefile(dest, directories):
|
||||
"""Create a .mk file to be included into the main Makefile.in, which lists the
|
||||
directories with tests.
|
||||
"""
|
||||
print "Creating .mk..."
|
||||
print("Creating .mk...")
|
||||
path = dest + ".mk"
|
||||
fp = open(path, "wb")
|
||||
fp = open(path, "w")
|
||||
fp.write("DIRS += \\\n")
|
||||
fp.write(writeMakefile.makefileString([makePath(dest, d) for d in directories]))
|
||||
fp.write("\n")
|
||||
@ -91,14 +93,10 @@ def printMakefile(dest, directories):
|
||||
def printMakefiles(thissrcdir, dest, directories):
|
||||
"""Create Makefile.in files for each directory that contains tests we import.
|
||||
"""
|
||||
print "Creating Makefile.ins..."
|
||||
print("Creating Makefile.ins...")
|
||||
for d in directories:
|
||||
if d:
|
||||
path = "%s/%s" % (dest, d)
|
||||
else:
|
||||
# Empty directory, i.e., the repository root
|
||||
path = dest
|
||||
print "Creating Makefile.in in %s..." % (path, )
|
||||
path = makePath(dest, d)
|
||||
print("Creating Makefile.in in %s..." % path)
|
||||
|
||||
subdirs, mochitests, supportfiles = parseManifestFile(dest, d)
|
||||
|
||||
@ -107,13 +105,13 @@ def printMakefiles(thissrcdir, dest, directories):
|
||||
|
||||
result = writeMakefile.substMakefile("importTestsuite.py", subdirs, files)
|
||||
|
||||
fp = open(path + "/Makefile.in", "wb")
|
||||
fp = open(path + "/Makefile.in", "w")
|
||||
fp.write(result)
|
||||
fp.close()
|
||||
|
||||
def hgadd(dest, directories):
|
||||
"""Inform hg of the files in |directories|."""
|
||||
print "hg addremoving..."
|
||||
print("hg addremoving...")
|
||||
for d in directories:
|
||||
subprocess.check_call(["hg", "addremove", "%s/%s" % (dest, d)])
|
||||
|
||||
@ -125,26 +123,26 @@ def importRepo(confFile, thissrcdir):
|
||||
try:
|
||||
repo, dest, directories = getData(confFile)
|
||||
hgdest = "hg-%s" % (dest, )
|
||||
print "Going to clone %s to %s..." % (repo, hgdest)
|
||||
print "Removing %s..." % dest
|
||||
print("Going to clone %s to %s..." % (repo, hgdest))
|
||||
print("Removing %s..." % dest)
|
||||
subprocess.check_call(["rm", "--recursive", "--force", dest])
|
||||
print "Removing %s..." % hgdest
|
||||
print("Removing %s..." % hgdest)
|
||||
subprocess.check_call(["rm", "--recursive", "--force", hgdest])
|
||||
print "Cloning %s to %s..." % (repo, hgdest)
|
||||
print("Cloning %s to %s..." % (repo, hgdest))
|
||||
subprocess.check_call(["hg", "clone", repo, hgdest])
|
||||
print "Going to import %s..." % (directories, )
|
||||
print("Going to import %s..." % directories)
|
||||
importDirs(thissrcdir, dest, directories)
|
||||
printMakefile(dest, directories)
|
||||
hgadd(dest, directories)
|
||||
print "Removing %s again..." % hgdest
|
||||
print("Removing %s again..." % hgdest)
|
||||
subprocess.check_call(["rm", "--recursive", "--force", hgdest])
|
||||
except subprocess.CalledProcessError, e:
|
||||
print e.returncode
|
||||
except subprocess.CalledProcessError as e:
|
||||
print(e.returncode)
|
||||
finally:
|
||||
print "Done"
|
||||
print("Done")
|
||||
|
||||
if __name__ == "__main__":
|
||||
if len(sys.argv) != 2:
|
||||
print "Need one argument."
|
||||
print("Need one argument.")
|
||||
else:
|
||||
importRepo(sys.argv[1], "dom/imptests")
|
||||
|
@ -2,10 +2,12 @@
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
from __future__ import print_function, unicode_literals
|
||||
|
||||
import collections
|
||||
import json
|
||||
import os
|
||||
import sys
|
||||
import collections
|
||||
|
||||
import writeMakefile
|
||||
|
||||
@ -54,15 +56,15 @@ def writeMakefiles(files):
|
||||
dirp, leaf = path.rsplit('/', 1)
|
||||
pathmap.setdefault(dirp, []).append(leaf)
|
||||
|
||||
for k, v in pathmap.iteritems():
|
||||
for k, v in pathmap.items():
|
||||
result = writeMakefile.substMakefile('parseFailures.py', [], v)
|
||||
|
||||
fp = open(k + '/Makefile.in', 'wb')
|
||||
fp = open(k + '/Makefile.in', 'w')
|
||||
fp.write(result)
|
||||
fp.close()
|
||||
|
||||
def main(logPath):
|
||||
fp = open(logPath, 'rb')
|
||||
fp = open(logPath, 'r')
|
||||
lines = extractLines(fp)
|
||||
fp.close()
|
||||
|
||||
@ -71,5 +73,5 @@ def main(logPath):
|
||||
|
||||
if __name__ == '__main__':
|
||||
if len(sys.argv) < 2:
|
||||
print "Please pass the path to the logfile from which failures should be extracted."
|
||||
print("Please pass the path to the logfile from which failures should be extracted.")
|
||||
main(sys.argv[1])
|
||||
|
@ -3,6 +3,8 @@
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
# You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import subprocess
|
||||
|
||||
repo = "https://dvcs.w3.org/hg/resources"
|
||||
|
@ -2,6 +2,8 @@
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
# You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import string
|
||||
|
||||
makefileTemplate = """# THIS FILE IS AUTOGENERATED BY ${caller} - DO NOT EDIT
|
||||
|
Loading…
x
Reference in New Issue
Block a user