Bug 1365080 - Replace self.query_exe('python') with sys.executable; r=ted
authorGregory Szorc <gps@mozilla.com>
Mon, 15 May 2017 16:02:28 -0700
changeset 410561 df3950d5ce913d4f5ddaf6a674296263decc2da7
parent 410560 67979a427b75bdf7c9f60d185d879755e19c096c
child 410562 ff48915ee1d850708c528d310a2598f470b7bf02
push id7391
push usermtabara@mozilla.com
push dateMon, 12 Jun 2017 13:08:53 +0000
treeherdermozilla-beta@2191d7f87e2e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersted
bugs1365080
milestone55.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 1365080 - Replace self.query_exe('python') with sys.executable; r=ted mozharness is Python. self.query_exe('python') could resolve to a different Python interpreter from what mozharness is running as. In order to promote consistency, always invoke python processes with the Python being used to run mozharness. In some cases, this may cause former `python` processes to run as Python 2.7 instead of 2.6 (since `python` resolves to a 2.6 interpreter on many systems). It may also result in slightly different Python binaries being used. But I think sharing interpreters between the mozharness script and launched processes is logical. So if this causes problems, I'd like to flush those out. MozReview-Commit-ID: KfawUvT5jgW
testing/mozharness/mozharness/mozilla/purge.py
testing/mozharness/mozharness/mozilla/signing.py
testing/mozharness/mozharness/mozilla/updates/balrog.py
testing/mozharness/scripts/release/publish_balrog.py
testing/mozharness/scripts/release/updates.py
--- a/testing/mozharness/mozharness/mozilla/purge.py
+++ b/testing/mozharness/mozharness/mozilla/purge.py
@@ -5,16 +5,17 @@
 # You can obtain one at http://mozilla.org/MPL/2.0/.
 # ***** END LICENSE BLOCK *****
 """Purge/clobber support
 """
 
 # Figure out where our external_tools are
 # These are in a sibling directory to the 'mozharness' module
 import os
+import sys
 import mozharness
 external_tools_path = os.path.join(
     os.path.abspath(os.path.dirname(os.path.dirname(mozharness.__file__))),
     'external_tools',
 )
 
 from mozharness.base.log import ERROR
 
@@ -42,17 +43,17 @@ class PurgeMixin(object):
         branch = self.buildbot_config['properties']['branch']
         buildername = self.buildbot_config['properties']['buildername']
         slave = self.buildbot_config['properties']['slavename']
         master = self.buildbot_config['properties']['master']
 
         cmd = []
         if self._is_windows():
             # The virtualenv isn't setup yet, so just use python directly.
-            cmd.append(self.query_exe('python'))
+            cmd.append(sys.executable)
         # Add --dry-run if you don't want to do this for realz
         cmd.extend([self.clobber_tool])
         # TODO configurable list
         cmd.extend(['-s', 'scripts'])
         cmd.extend(['-s', 'logs'])
         cmd.extend(['-s', 'buildprops.json'])
         cmd.extend(['-s', 'token'])
         cmd.extend(['-s', 'oauth.txt'])
--- a/testing/mozharness/mozharness/mozilla/signing.py
+++ b/testing/mozharness/mozharness/mozilla/signing.py
@@ -5,16 +5,17 @@
 # You can obtain one at http://mozilla.org/MPL/2.0/.
 # ***** END LICENSE BLOCK *****
 """Mozilla-specific signing methods.
 """
 
 import os
 import re
 import json
+import sys
 
 from mozharness.base.errors import BaseErrorList
 from mozharness.base.log import ERROR, FATAL
 from mozharness.base.signing import AndroidSigningMixin, BaseSigningMixin
 
 AndroidSignatureVerificationErrorList = BaseErrorList + [{
     "regex": re.compile(r'''^Invalid$'''),
     "level": FATAL,
@@ -40,19 +41,18 @@ class SigningMixin(BaseSigningMixin):
         if 'MOZ_SIGNING_SERVERS' not in os.environ:
             self.fatal("MOZ_SIGNING_SERVERS not in env; no MOZ_SIGN_CMD for you!")
         dirs = self.query_abs_dirs()
         signing_dir = os.path.join(dirs['abs_work_dir'], 'tools', 'release', 'signing')
         cache_dir = os.path.join(dirs['abs_work_dir'], 'signing_cache')
         token = os.path.join(dirs['base_work_dir'], 'token')
         nonce = os.path.join(dirs['base_work_dir'], 'nonce')
         host_cert = os.path.join(signing_dir, 'host.cert')
-        python = self.query_exe('python')
         cmd = [
-            python,
+            sys.executable,
             os.path.join(signing_dir, 'signtool.py'),
             '--cachedir', cache_dir,
             '-t', token,
             '-n', nonce,
             '-c', host_cert,
         ]
         if formats:
             for f in formats:
--- a/testing/mozharness/mozharness/mozilla/updates/balrog.py
+++ b/testing/mozharness/mozharness/mozilla/updates/balrog.py
@@ -1,10 +1,11 @@
 from itertools import chain
 import os
+import sys
 
 from mozharness.base.log import INFO
 
 
 # BalrogMixin {{{1
 class BalrogMixin(object):
     @staticmethod
     def _query_balrog_username(server_config, product=None):
@@ -51,17 +52,17 @@ class BalrogMixin(object):
         )
         submitter_script = os.path.join(
             dirs["abs_tools_dir"], "scripts", "updates", "balrog-submitter.py"
         )
 
         self.generate_balrog_props(props_path)
 
         cmd = [
-            self.query_exe("python"),
+            sys.executable,
             submitter_script,
             "--build-properties", props_path,
             "-t", release_type,
             "--credentials-file", credentials_file,
         ]
         if self._log_level_at_least(INFO):
             cmd.append("--verbose")
 
@@ -85,17 +86,17 @@ class BalrogMixin(object):
                 self.info("Ignoring result, ignore_failures set to True")
             else:
                 return_codes.append(return_code)
         # return the worst (max) code
         return max(return_codes)
 
     def submit_balrog_release_pusher(self, dirs):
         product = self.buildbot_config["properties"]["product"]
-        cmd = [self.query_exe("python"), os.path.join(os.path.join(dirs['abs_tools_dir'], "scripts/updates/balrog-release-pusher.py"))]
+        cmd = [sys.executable, os.path.join(os.path.join(dirs['abs_tools_dir'], "scripts/updates/balrog-release-pusher.py"))]
         cmd.extend(["--build-properties", os.path.join(dirs["base_work_dir"], "balrog_props.json")])
         cmd.extend(["--buildbot-configs", "https://hg.mozilla.org/build/buildbot-configs"])
         cmd.extend(["--release-config", os.path.join(dirs['build_dir'], self.config.get("release_config_file"))])
         cmd.extend(["--credentials-file", os.path.join(dirs['base_work_dir'], self.config.get("balrog_credentials_file"))])
         cmd.extend(["--release-channel", self.query_release_config()['release_channel']])
 
         return_codes = []
         for server in self.config["balrog_servers"]:
@@ -125,17 +126,17 @@ class BalrogMixin(object):
             dirs["abs_tools_dir"], "scripts", "updates",
             "balrog-nightly-locker.py"
         )
         credentials_file = os.path.join(
             dirs["base_work_dir"], c["balrog_credentials_file"]
         )
 
         cmd = [
-            self.query_exe("python"),
+            sys.executable,
             submitter_script,
             "--credentials-file", credentials_file,
             "--api-root", c["balrog_api_root"],
             "--username", c["balrog_username"],
         ]
         for r in rule_ids:
             cmd.extend(["-r", str(r)])
 
--- a/testing/mozharness/scripts/release/publish_balrog.py
+++ b/testing/mozharness/scripts/release/publish_balrog.py
@@ -88,17 +88,17 @@ class PublishBalrog(MercurialScript, Bui
     def submit_to_balrog(self):
         for _, channel_config in self.query_channel_configs():
             self._submit_to_balrog(channel_config)
 
     def _submit_to_balrog(self, channel_config):
         dirs = self.query_abs_dirs()
         auth = os.path.join(os.getcwd(), self.config['credentials_file'])
         cmd = [
-            self.query_exe("python"),
+            sys.executable,
             os.path.join(dirs["abs_tools_dir"],
                          "scripts/build-promotion/balrog-release-shipper.py")]
         cmd.extend([
             "--api-root", self.config["balrog_api_root"],
             "--credentials-file", auth,
             "--username", self.config["balrog_username"],
             "--version", self.config["version"],
             "--product", self.config["product"],
--- a/testing/mozharness/scripts/release/updates.py
+++ b/testing/mozharness/scripts/release/updates.py
@@ -230,17 +230,17 @@ class UpdatesBumper(MercurialScript, Bui
     def bump_update_verify_configs(self, channel, channel_config):
         dirs = self.query_abs_dirs()
         script = os.path.join(
             dirs["abs_tools_dir"],
             "scripts/build-promotion/create-update-verify-config.py")
         patcher_config = self.query_patcher_config(channel_config)
         patcher_config_product = self.query_patcher_config_product(channel_config)
         for platform in self.config["platforms"]:
-            cmd = [self.query_exe("python"), script]
+            cmd = [sys.executable, script]
             output = self.query_update_verify_config(channel, platform)
             cmd.extend([
                 "--config", patcher_config,
                 "--platform", platform,
                 "--update-verify-channel",
                 channel_config["update_verify_channel"],
                 "--output", output,
                 "--archive-prefix", self.config["archive_prefix"],
@@ -269,17 +269,17 @@ class UpdatesBumper(MercurialScript, Bui
     def submit_to_balrog(self):
         for _, channel_config in self.query_channel_configs():
             self._submit_to_balrog(channel_config)
 
     def _submit_to_balrog(self, channel_config):
         dirs = self.query_abs_dirs()
         auth = os.path.join(os.getcwd(), self.config['credentials_file'])
         cmd = [
-            self.query_exe("python"),
+            sys.executable,
             os.path.join(dirs["abs_tools_dir"],
                          "scripts/build-promotion/balrog-release-pusher.py")]
         cmd.extend([
             "--api-root", self.config["balrog_api_root"],
             "--download-domain", self.config["download_domain"],
             "--archive-domain", self.config["archive_domain"],
             "--credentials-file", auth,
             "--product", self.config["product"],