Browse files

bug 761809 - fix mozinstall on windows. r=jhammel

  • Loading branch information...
1 parent 9238b1d commit deefc89ce05c0b4c660aadd2082e6ba45bc0f53a @escapewindow escapewindow committed Jun 21, 2012
Showing with 29 additions and 13 deletions.
  1. +1 −5 mozharness/base/python.py
  2. +20 −2 mozharness/base/script.py
  3. +8 −6 mozharness/mozilla/testing/testbase.py
View
6 mozharness/base/python.py
@@ -162,11 +162,7 @@ def install_module(self, module, module_url=None, install_method=None):
elif install_method == 'easy_install':
# Allow easy_install to be overridden by
# self.config['exes']['easy_install']
- easy_install = self.query_exe('easy_install', default=self.query_python_path('easy_install'))
- if isinstance(easy_install, list):
- command = easy_install[:]
- else:
- command = [easy_install]
+ command = self.query_exe('easy_install', default=self.query_python_path('easy_install'), return_type="list")
else:
self.fatal("install_module() doesn't understand an install_method of %s!" % install_method)
View
22 mozharness/base/script.py
@@ -321,19 +321,37 @@ def query_env(self, partial_env=None, replace_dict=None,
self.env = env
return env
- def query_exe(self, exe_name, exe_dict='exes', default=None):
+ def query_exe(self, exe_name, exe_dict='exes', default=None,
+ return_type=None, error_level=FATAL):
"""One way to work around PATH rewrites.
By default, return exe_name, and we'll fall through to searching
os.environ["PATH"].
However, if self.config[exe_dict][exe_name] exists, return that.
This lets us override exe paths via config file.
+ 'return_type' can be None (don't do anything to the value),
+ 'list' (return a list), or 'string' (return a string).
+
If we need runtime setting, we can build in self.exes support later.
"""
if default is None:
default = exe_name
- return self.config.get(exe_dict, {}).get(exe_name, default)
+ exe = self.config.get(exe_dict, {}).get(exe_name, default)
+ if isinstance(exe, list):
+ exe = exe[:]
+ elif not isinstance(exe, str):
+ self.log("query_exe: %s is not a string or list: %s!" % (exe_name, str(exe)), level=error_level)
+ return exe
+ if return_type == "list":
+ if isinstance(exe, str):
+ exe = [exe]
+ elif return_type == "string":
+ if isinstance(exe, list):
+ exe = subprocess.list2cmdline(exe)
+ elif return_type is not None:
+ self.log("Unknown return_type type %s requested in query_exe!" % return_type, level=error_level)
+ return exe
def run_command(self, command, cwd=None, error_list=None, parse_at_end=False,
halt_on_failure=False, success_codes=None,
View
14 mozharness/mozilla/testing/testbase.py
@@ -182,17 +182,19 @@ def preflight_install(self):
def install(self):
""" Dependent on mozinstall """
# install the application
- mozinstall = self.query_exe("mozinstall", default=self.query_python_path("mozinstall"))
- if isinstance(mozinstall, list):
- cmd = mozinstall[:]
- else:
- cmd = [mozinstall]
+ cmd = self.query_exe("mozinstall", default=self.query_python_path("mozinstall"), return_type="list")
+ # Remove the below when we no longer need to support mozinstall 0.3
+ self.info("Detecting whether we're running mozinstall >=1.0...")
+ output = self.get_output_from_command(cmd + ['-h'])
+ if '--source' in output:
+ cmd.append('--source')
+ # End remove
dirs = self.query_abs_dirs()
target_dir = dirs.get('abs_app_install_dir',
os.path.join(dirs['abs_work_dir'],
'application'))
self.mkdir_p(target_dir)
- cmd.extend(['--source', self.installer_path,
+ cmd.extend([self.installer_path,
'--destination', target_dir])
# TODO we'll need some error checking here
self.binary_path = self.get_output_from_command(cmd)

0 comments on commit deefc89

Please sign in to comment.