~ubuntu-branches/ubuntu/quantal/enigmail/quantal-security

« back to all changes in this revision

Viewing changes to mozilla/testing/mozbase/mozinfo/README.md

  • Committer: Package Import Robot
  • Author(s): Chris Coulson
  • Date: 2013-09-13 16:02:15 UTC
  • mfrom: (0.12.16)
  • Revision ID: package-import@ubuntu.com-20130913160215-u3g8nmwa0pdwagwc
Tags: 2:1.5.2-0ubuntu0.12.10.1
* New upstream release v1.5.2 for Thunderbird 24

* Build enigmail using a stripped down Thunderbird 17 build system, as it's
  now quite difficult to build the way we were doing previously, with the
  latest Firefox build system
* Add debian/patches/no_libxpcom.patch - Don't link against libxpcom, as it
  doesn't exist anymore (but exists in the build system)
* Add debian/patches/use_sdk.patch - Use the SDK version of xpt.py and
  friends
* Drop debian/patches/ipc-pipe_rename.diff (not needed anymore)
* Drop debian/patches/makefile_depth.diff (not needed anymore)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
Throughout [mozmill](https://developer.mozilla.org/en/Mozmill)
 
2
and other Mozilla python code, checking the underlying
 
3
platform is done in many different ways.  The various checks needed
 
4
lead to a lot of copy+pasting, leaving the reader to wonder....is this
 
5
specific check necessary for (e.g.) an operating system?  Because
 
6
information is not consolidated, checks are not done consistently, nor
 
7
is it defined what we are checking for.
 
8
 
 
9
[MozInfo](https://github.com/mozilla/mozbase/tree/master/mozinfo)
 
10
proposes to solve this problem.  MozInfo is a bridge interface,
 
11
making the underlying (complex) plethora of OS and architecture
 
12
combinations conform to a subset of values of relavence to 
 
13
Mozilla software. The current implementation exposes relavent key,
 
14
values: `os`, `version`, `bits`, and `processor`.  Additionally, the
 
15
service pack in use is available on the windows platform.
 
16
 
 
17
 
 
18
# API Usage
 
19
 
 
20
MozInfo is a python package.  Downloading the software and running
 
21
`python setup.py develop` will allow you to do `import mozinfo`
 
22
from python.  
 
23
[mozinfo.py](https://github.com/mozilla/mozbase/blob/master/mozinfo/mozinfo.py)
 
24
is the only file contained is this package,
 
25
so if you need a single-file solution, you can just download or call
 
26
this file through the web.
 
27
 
 
28
The top level attributes (`os`, `version`, `bits`, `processor`) are
 
29
available as module globals:
 
30
 
 
31
    if mozinfo.os == 'win': ...
 
32
 
 
33
In addition, mozinfo exports a dictionary, `mozinfo.info`, that
 
34
contain these values.  mozinfo also exports:
 
35
 
 
36
- `choices`: a dictionary of possible values for os, bits, and
 
37
  processor
 
38
- `main`: the console_script entry point for mozinfo
 
39
- `unknown`: a singleton denoting a value that cannot be determined
 
40
 
 
41
`unknown` has the string representation `"UNKNOWN"`. unknown will evaluate
 
42
as `False` in python:
 
43
 
 
44
    if not mozinfo.os: ... # unknown!
 
45
 
 
46
 
 
47
# Command Line Usage
 
48
 
 
49
MozInfo comes with a command line, `mozinfo` which may be used to
 
50
diagnose one's current system.
 
51
 
 
52
Example output:
 
53
 
 
54
    os: linux
 
55
    version: Ubuntu 10.10
 
56
    bits: 32
 
57
    processor: x86
 
58
 
 
59
Three of these fields, os, bits, and processor, have a finite set of
 
60
choices.  You may display the value of these choices using 
 
61
`mozinfo --os`, `mozinfo --bits`, and `mozinfo --processor`. 
 
62
`mozinfo --help` documents command-line usage.