Bug 1393657 - Reformat profileserver.py; r=glandium
authorGregory Szorc <gps@mozilla.com>
Thu, 24 Aug 2017 18:30:18 -0700
changeset 426285 46cb55bc06c848ad5503a711cb02763489fff0ae
parent 426284 758077726592e53df0e7d0f7b0a6e9fbaca9dca5
child 426286 2c8f9c706b62d90f64e39f0da9945bfa541175c1
push id7761
push userjlund@mozilla.com
push dateFri, 15 Sep 2017 00:19:52 +0000
treeherdermozilla-beta@c38455951db4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersglandium
bugs1393657
milestone57.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1393657 - Reformat profileserver.py; r=glandium The file was using 2 space indent. I ran `autopep8` on it. Most of the changes are whitespace only. MozReview-Commit-ID: 1C7yDUQCfKl
build/pgo/profileserver.py
--- a/build/pgo/profileserver.py
+++ b/build/pgo/profileserver.py
@@ -14,76 +14,80 @@ from mozbuild.base import MozbuildObject
 from mozhttpd import MozHttpd
 from mozprofile import FirefoxProfile, Profile, Preferences
 from mozprofile.permissions import ServerLocations
 from mozrunner import FirefoxRunner, CLI
 
 PORT = 8888
 
 if __name__ == '__main__':
-  cli = CLI()
-  debug_args, interactive = cli.debugger_arguments()
+    cli = CLI()
+    debug_args, interactive = cli.debugger_arguments()
 
-  build = MozbuildObject.from_environment()
-  httpd = MozHttpd(port=PORT,
-                   docroot=os.path.join(build.topsrcdir, "build", "pgo"))
-  httpd.start(block=False)
+    build = MozbuildObject.from_environment()
+    httpd = MozHttpd(port=PORT,
+                     docroot=os.path.join(build.topsrcdir, "build", "pgo"))
+    httpd.start(block=False)
 
-  locations = ServerLocations()
-  locations.add_host(host='127.0.0.1',
-                     port=PORT,
-                     options='primary,privileged')
+    locations = ServerLocations()
+    locations.add_host(host='127.0.0.1',
+                       port=PORT,
+                       options='primary,privileged')
 
-  #TODO: mozfile.TemporaryDirectory
-  profilePath = tempfile.mkdtemp()
-  try:
-    #TODO: refactor this into mozprofile
-    prefpath = os.path.join(build.topsrcdir, "testing", "profiles", "prefs_general.js")
-    prefs = {}
-    prefs.update(Preferences.read_prefs(prefpath))
-    interpolation = { "server": "%s:%d" % httpd.httpd.server_address,
-                      "OOP": "false"}
-    prefs = json.loads(json.dumps(prefs) % interpolation)
-    for pref in prefs:
-      prefs[pref] = Preferences.cast(prefs[pref])
-    profile = FirefoxProfile(profile=profilePath,
-                             preferences=prefs,
-                             addons=[os.path.join(build.topsrcdir, 'tools', 'quitter', 'quitter@mozilla.org.xpi')],
-                             locations=locations)
+    # TODO: mozfile.TemporaryDirectory
+    profilePath = tempfile.mkdtemp()
+    try:
+        # TODO: refactor this into mozprofile
+        prefpath = os.path.join(
+            build.topsrcdir, "testing", "profiles", "prefs_general.js")
+        prefs = {}
+        prefs.update(Preferences.read_prefs(prefpath))
+        interpolation = {"server": "%s:%d" % httpd.httpd.server_address,
+                         "OOP": "false"}
+        prefs = json.loads(json.dumps(prefs) % interpolation)
+        for pref in prefs:
+            prefs[pref] = Preferences.cast(prefs[pref])
+        profile = FirefoxProfile(profile=profilePath,
+                                 preferences=prefs,
+                                 addons=[os.path.join(
+                                     build.topsrcdir, 'tools', 'quitter', 'quitter@mozilla.org.xpi')],
+                                 locations=locations)
 
-    env = os.environ.copy()
-    env["MOZ_CRASHREPORTER_NO_REPORT"] = "1"
-    env["XPCOM_DEBUG_BREAK"] = "warn"
+        env = os.environ.copy()
+        env["MOZ_CRASHREPORTER_NO_REPORT"] = "1"
+        env["XPCOM_DEBUG_BREAK"] = "warn"
 
-    # For VC12+, make sure we can find the right bitness of pgort1x0.dll
-    if not substs.get('HAVE_64BIT_BUILD'):
-        for e in ('VS140COMNTOOLS', 'VS120COMNTOOLS'):
-            if e not in env:
-                continue
+        # For VC12+, make sure we can find the right bitness of pgort1x0.dll
+        if not substs.get('HAVE_64BIT_BUILD'):
+            for e in ('VS140COMNTOOLS', 'VS120COMNTOOLS'):
+                if e not in env:
+                    continue
 
-            vcdir = os.path.abspath(os.path.join(env[e], '../../VC/bin'))
-            if os.path.exists(vcdir):
-                env['PATH'] = '%s;%s' % (vcdir, env['PATH'])
-                break
+                vcdir = os.path.abspath(os.path.join(env[e], '../../VC/bin'))
+                if os.path.exists(vcdir):
+                    env['PATH'] = '%s;%s' % (vcdir, env['PATH'])
+                    break
 
-    # Run Firefox a first time to initialize its profile
-    runner = FirefoxRunner(profile=profile,
-                           binary=build.get_binary_path(where="staged-package"),
-                           cmdargs=['javascript:Quitter.quit()'],
-                           env=env)
-    runner.start()
-    runner.wait()
+        # Run Firefox a first time to initialize its profile
+        runner = FirefoxRunner(profile=profile,
+                               binary=build.get_binary_path(
+                                   where="staged-package"),
+                               cmdargs=['javascript:Quitter.quit()'],
+                               env=env)
+        runner.start()
+        runner.wait()
 
-    jarlog = os.getenv("JARLOG_FILE")
-    if jarlog:
-      env["MOZ_JAR_LOG_FILE"] = os.path.abspath(jarlog)
-      print "jarlog: %s" % env["MOZ_JAR_LOG_FILE"]
+        jarlog = os.getenv("JARLOG_FILE")
+        if jarlog:
+            env["MOZ_JAR_LOG_FILE"] = os.path.abspath(jarlog)
+            print "jarlog: %s" % env["MOZ_JAR_LOG_FILE"]
 
-    cmdargs = ["http://localhost:%d/index.html" % PORT]
-    runner = FirefoxRunner(profile=profile,
-                           binary=build.get_binary_path(where="staged-package"),
-                           cmdargs=cmdargs,
-                           env=env)
-    runner.start(debug_args=debug_args, interactive=interactive)
-    runner.wait()
-    httpd.stop()
-  finally:
-    shutil.rmtree(profilePath)
+        cmdargs = ["http://localhost:%d/index.html" % PORT]
+        runner = FirefoxRunner(profile=profile,
+                               binary=build.get_binary_path(
+                                   where="staged-package"),
+                               cmdargs=cmdargs,
+                               env=env)
+        runner.start(debug_args=debug_args, interactive=interactive)
+        runner.wait()
+        httpd.stop()
+    finally:
+        shutil.rmtree(profilePath)