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
11 # The Original Code is Mozilla Corporation Code.
13 # The Initial Developer of the Original Code is
15 # Portions created by the Initial Developer are Copyright (C) 2007
16 # the Initial Developer. All Rights Reserved.
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 *****
36 from optparse
import OptionParser
39 cygwinmatch
= re
.compile(".*cygwin.*", re
.I
)
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()):
47 print platform
.system()
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.
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()
82 main(options
.os
, options
.fxname
)