Back to index

enigmail  1.4.3
Classes | Functions | Variables
build.mozinfo Namespace Reference

Classes

class  unknown

Functions

def sanitize
def update
def main

Variables

 _os = os
tuple unknown = unknown()
dictionary info
tuple processor = os.environ.get("PROCESSOR_ARCHITEW6432", processor)
tuple system = os.environ.get("OS", system)
tuple service_pack = os.sys.getwindowsversion()
string version = " "
string bits = "64bit"
dictionary choices
tuple __all__ = info.keys()

Function Documentation

def build.mozinfo.main (   args = None)

Definition at line 166 of file mozinfo.py.

00166 
00167 def main(args=None):
00168 
00169     # parse the command line
00170     from optparse import OptionParser
00171     parser = OptionParser()
00172     for key in choices:
00173         parser.add_option('--%s' % key, dest=key,
00174                           action='store_true', default=False,
00175                           help="display choices for %s" % key)
00176     options, args = parser.parse_args()
00177 
00178     # args are JSON blobs to override info
00179     if args:
00180         try:
00181             from json import loads
00182         except ImportError:
00183             try:
00184                 from simplejson import loads
00185             except ImportError:
00186                 def loads(string):
00187                     """*really* simple json; will not work with unicode"""
00188                     return eval(string, {'true': True, 'false': False, 'null': None})
00189         for arg in args:
00190             if _os.path.exists(arg):
00191                 string = file(arg).read()
00192             else:
00193                 string = arg
00194             update(loads(string))
00195 
00196     # print out choices if requested
00197     flag = False
00198     for key, value in options.__dict__.items():
00199         if value is True:
00200             print '%s choices: %s' % (key, ' '.join([str(choice)
00201                                                      for choice in choices[key]]))
00202             flag = True
00203     if flag: return
00204 
00205     # otherwise, print out all info
00206     for key, value in info.items():
00207         print '%s: %s' % (key, value)

Here is the call graph for this function:

def build.mozinfo.sanitize (   info)
Do some sanitization of input values, primarily
to handle universal Mac builds.

Definition at line 132 of file mozinfo.py.

00132 
00133 def sanitize(info):
00134     """Do some sanitization of input values, primarily
00135     to handle universal Mac builds."""
00136     if "processor" in info and info["processor"] == "universal-x86-x86_64":
00137         # If we're running on OS X 10.6 or newer, assume 64-bit
00138         if release[:4] >= "10.6":
00139             info["processor"] = "x86_64"
00140             info["bits"] = 64
00141         else:
00142             info["processor"] = "x86"
00143             info["bits"] = 32
00144 
# method for updating information

Here is the caller graph for this function:

def build.mozinfo.update (   new_info)
update the info

Definition at line 145 of file mozinfo.py.

00145 
00146 def update(new_info):
00147     """update the info"""
00148     info.update(new_info)
00149     sanitize(info)
00150     globals().update(info)
00151 
00152     # convenience data for os access
00153     for os_name in choices['os']:
00154         globals()['is' + os_name.title()] = info['os'] == os_name
00155     # unix is special
00156     if isLinux:
00157         globals()['isUnix'] = True
00158 
00159 update({})
00160 
# exports

Here is the call graph for this function:

Here is the caller graph for this function:


Variable Documentation

tuple build.mozinfo.__all__ = info.keys()

Definition at line 161 of file mozinfo.py.

Definition at line 65 of file mozinfo.py.

tuple build.mozinfo.bits = "64bit"

Definition at line 117 of file mozinfo.py.

Initial value:
00001 {'os': ['linux', 'win', 'mac', 'unix'],
00002            'bits': [32, 64],
00003            'processor': ['x86', 'x86_64', 'ppc']}

Definition at line 127 of file mozinfo.py.

dictionary build.mozinfo.info
Initial value:
00001 {'os': unknown,
00002         'processor': unknown,
00003         'version': unknown,
00004         'bits': unknown }

Definition at line 76 of file mozinfo.py.

string build.mozinfo.processor = os.environ.get("PROCESSOR_ARCHITEW6432", processor)

Definition at line 89 of file mozinfo.py.

tuple build.mozinfo.service_pack = os.sys.getwindowsversion()

Definition at line 93 of file mozinfo.py.

tuple build.mozinfo.system = os.environ.get("OS", system)

Definition at line 92 of file mozinfo.py.

Definition at line 73 of file mozinfo.py.

string build.mozinfo.version = " "

Definition at line 97 of file mozinfo.py.