b=450088 backing out (new reftest failed)
[wine-gecko.git] / testing / release / minotaur / getOsInfo.py
blob22055c36afd76f33566cbee4fcc00838a4ca2bbc
1 # The contents of this file are subject to the Mozilla Public License Version
2 # 1.1 (the "License"); you may not use this file except in compliance with
3 # the License. You may obtain a copy of the License at
4 # http://www.mozilla.org/MPL/
6 # Software distributed under the License is distributed on an "AS IS" basis,
7 # WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
8 # for the specific language governing rights and limitations under the
9 # License.
11 # The Original Code is Mozilla Corporation Code.
13 # The Initial Developer of the Original Code is
14 # Clint Talbert.
15 # Portions created by the Initial Developer are Copyright (C) 2007
16 # the Initial Developer. All Rights Reserved.
18 # Contributor(s):
19 # Clint Talbert <ctalbert@mozilla.com>
21 # Alternatively, the contents of this file may be used under the terms of
22 # either the GNU General Public License Version 2 or later (the "GPL"), or
23 # the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
24 # in which case the provisions of the GPL or the LGPL are applicable instead
25 # of those above. If you wish to allow use of your version of this file only
26 # under the terms of either the GPL or the LGPL, and not to allow others to
27 # use your version of this file under the terms of the MPL, indicate your
28 # decision by deleting the provisions above and replace them with the notice
29 # and other provisions required by the GPL or the LGPL. If you do not delete
30 # the provisions above, a recipient may use your version of this file under
31 # the terms of any one of the MPL, the GPL or the LGPL.
33 # ***** END LICENSE BLOCK *****
35 import re
36 from optparse import OptionParser
37 import platform
39 cygwinmatch = re.compile(".*cygwin.*", re.I)
41 def getPlatform():
42 # On Vista, python reports "Microsoft" and on cygwin shells it can report
43 # several different strings that contain the word "cygwin"
44 if platform.system() == "Microsoft" or cygwinmatch.search(platform.system()):
45 print "Windows"
46 else:
47 print platform.system()
49 def getFxName(os):
50 if os == "Darwin":
51 print "firefox-bin"
52 elif os == "Linux":
53 print "firefox"
54 else:
55 print "firefox.exe"
57 def main(os, fxname):
58 # The options given determine the behavior
59 # If no options -- return the OS
60 # If OS AND fxname, return the firefox executable name on this OS
61 # Anything else, fail.
63 retval = ""
65 if not os:
66 getPlatform()
67 elif os and fxname:
68 getFxName(os)
69 else:
70 raise SystemExit("Invalid Command use getOsInfo --h for help")
72 if __name__ == "__main__":
73 parser = OptionParser()
74 parser.add_option("-o", "--os", dest="os",
75 help="OS identifer - either Darwin, Linux, or Windows can be\
76 obtained by calling without any params", metavar="OS")
77 parser.add_option("-f", "--firefoxName", action="store_true", dest="fxname", default=False,
78 help="Firefox executable name on this platform requires OS")
79 (options, args) = parser.parse_args()
81 # Call Main
82 main(options.os, options.fxname)