# HG changeset patch # User Jeff Hammel # Date 1296687129 28800 # Node ID 854ac4008ac8c27404ceaeb0347f21ae060a10c6 # Parent 4e5e38de6b1e566f4ecba8178c3bfe86c79c3edc Exactly one of property and extract_fn must be set diff -r 4e5e38de6b1e -r 854ac4008ac8 autobot/process/factory.py --- a/autobot/process/factory.py Wed Feb 02 14:44:34 2011 -0800 +++ b/autobot/process/factory.py Wed Feb 02 14:52:09 2011 -0800 @@ -19,12 +19,6 @@ command = 'if %s; else false; fi' % '; elif '.join(args) return ['bash', '-c', command] -def url_basename(returncode, stdout, stderr): - """ - extract the end part of the URL ~ the basename - """ - return stdout.rsplit('/', 1)[-1] - ### factories class FirefoxDownloaderFactory(BuildFactory): @@ -34,6 +28,9 @@ 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)" + # determine the (damn) url script = 'get-latest-tinderbox' if base_url: @@ -46,9 +43,14 @@ )) # get the filename - self.addStep(SetProperty(property='firefox_bundle', - command=['echo', WithProperties('%(firefox_url)s')], - extract_fn=url_basename)) + 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', @@ -61,6 +63,7 @@ # - linux has firefox in a .tar.bz2 file # - mac has firefox in a .dmg file [TODO] # - windows has firefox in a .zip file + class SourceFactory(BuildFactory):