# HG changeset patch # User Jeff Hammel # Date 1397625394 25200 # Node ID db20e7be25768bc757ccded39911e8e9fd75df7f # Parent df26365cd6479717a9f2d624f5b4ab465fc09879 remove obselete diff -r df26365cd647 -r db20e7be2576 autobot/process/factory.py --- a/autobot/process/factory.py Tue Apr 15 21:37:40 2014 -0700 +++ b/autobot/process/factory.py Tue Apr 15 22:16:34 2014 -0700 @@ -21,111 +21,6 @@ ### factories -class FirefoxDownloaderFactory(BuildFactory): - """ - factory to aid in downloading Firefox - """ - - def __init__(self, platform, base_url=None): - - # must have the os specified! - assert platform.get('os'), "platform['os'] must be one of (linux, win, mac); you have %s" % platform - - # determine the url - script = 'get-latest-tinderbox' - if base_url: - command = [script, '-u', base_url] - else: - command = [script] - self.addStep(SetProperty(property='firefox_url', - command=command, - haltOnFailure=True - )) - - # get the filename - def firefox_bundle_name(returncode, stdout, stderr): - """ - extract the end part of the URL ~ the basename - """ - return {'firefox_bundle': stdout.rsplit('/', 1)[-1]} - - self.addStep(SetProperty(command=['echo', WithProperties('%(firefox_url)s')], - extract_fn=firefox_bundle_name)) - - # download Firefox - self.addStep(ShellCommand(command=['wget', - WithProperties('%(firefox_url)s'), - '-O', - WithProperties('%(firefox_bundle)s')], - description='download Firefox', - haltOnFailure=True)) - - # three cases: - # - linux has firefox in a .tar.bz2 file - # - windows has firefox in a .zip file - # - mac has firefox in a .dmg file [TODO] - if platform['os'] == 'linux': - self.addStep(ShellCommand(command=['tar', 'xjvf', - WithProperties('%(firefox_bundle)s')], - haltOnFailure=True - )) - self.addStep(SetProperty(property='firefox', - command=self.abspath('firefox/firefox'))) - elif platform['os'] == 'win': - self.addStep(ShellCommand(command=['unzip', WithProperties('%(firefox_bundle)s')], - haltOnFailure=True)) - self.addStep(SetProperty(property='firefox', - command=self.abspath('firefox/firefox.exe'))) - elif platform['os'] == 'mac': - # See: - # http://mxr.mozilla.org/mozilla-central/source/build/package/mac_osx/unpack-diskimage - # http://hg.mozilla.org/qa/mozmill-automation/file/default/libs/install.py - # http://mxr.mozilla.org/mozilla/source/testing/release/minotaur/installdmg.sh - # https://github.com/harthur/mozregression/blob/master/mozregression/mozInstall.py#L218 - # TODO: throw these into toolbox - # ideally, the duplication of intent should be disappeared - # probably in the short term, a python script should be written - # as part of autobot, since currently the slaves will need this - # In the longer term, a silly python package should be thrown on - # pypi that does this and all other implementations destroyed - self.addStep(ShellCommand(command=['rm', '-rf', 'firefox-tmp'])) - self.addStep(ShellCommand(command=['mkdir', 'firefox-tmp'], - haltOnFailure=True)) - self.addStep(ShellCommand(command=['hdiutil', 'attach', - '-verbose', '-noautoopen', - WithProperties('%(firefox_bundle)s'), - '-mountpoint', 'firefox-tmp'], - haltOnFailure=True)) - self.addStep(ShellCommand(command=['rm', '-rf', 'firefox'])) - def app_name(returncode, stdout, stderr): - """ - extract the name of the app - """ - return {'app_name': stdout.rsplit('/', 1)[-1]} - self.addStep(SetProperty(command=['echo', 'firefox-tmp', '*.app'], - extract_fn=app_name)) - self.addStep(ShellCommand(command=['cp', '-r', 'firefox-tmp', 'firefox'])) - - # it would be nice to reuse the logic from - # https://github.com/mozautomation/mozmill/blob/master/mozrunner/mozrunner/runner.py - # however, I can't think of a clever way of doing this right now. - # When refactoring Mozilla, things like this should be kept in - # mind wrt consolidating towards best practices instead of - # copy+pasting and creating (dysfunctional, difficult to maintain) - # code islands - self.addStep(SetProperty(property='firefox', - command=self.abspath(WithProperties('firefox/%(app_name)s/Contents/MacOS/firefox-bin')))) - else: - raise NotImplementedError("FirefoxDownloader doesn't know how to work with your os: %s" % platform['os']) - - def abspath(self, path): - """returns a command that will print the absolute path""" - # TODO: could use WithProperties if needed - # could also go not in a class, again if needed - return ['python', '-c', - 'import os; print os.path.abspath("%s")' % path] - - class SourceFactory(BuildFactory): """ base class for factories with VCS sources @@ -258,6 +153,7 @@ self.addStep(SetProperty(property='PATH', command=WithProperties('echo %(scripts)s:$PATH'))) + class PythonSourceFactory(VirtualenvFactory): """ setup several python packages