changeset 205:45da31ae738e

unzip and get path of firefox on windows
author Jeff Hammel <jhammel@mozilla.com>
date Fri, 04 Feb 2011 08:11:07 -0800
parents 5f188d2a36aa
children 3e5d1c1e302d
files autobot/process/factory.py
diffstat 1 files changed, 15 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/autobot/process/factory.py	Wed Feb 02 18:17:07 2011 -0800
+++ b/autobot/process/factory.py	Fri Feb 04 08:11:07 2011 -0800
@@ -62,20 +62,31 @@
 
     # 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]
-    # - windows has firefox in a .zip file
     if platform['os'] == 'linux':
       self.addStep(ShellCommand(command=['tar', 'xjvf',
                                          WithProperties('%(firefox_bundle)s')],
                                 haltOnFailure=True
                                 ))
       self.addStep(SetProperty(property='firefox',
-                               command=['python', '-c',
-                                        'import os; print os.path.abspath("firefox/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'))
     else:
+      # TODO: mac
       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 WirthProperties 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):
   """