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

« back to all changes in this revision

Viewing changes to mozilla/testing/mozbase/mozprofile/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
[Mozprofile](https://github.com/mozilla/mozbase/tree/master/mozprofile)
 
2
is a python tool for creating and managing profiles for Mozilla's
 
3
applications (Firefox, Thunderbird, etc.). In addition to creating profiles,
 
4
mozprofile can install [addons](https://developer.mozilla.org/en/addons)
 
5
and set
 
6
[preferences](https://developer.mozilla.org/En/A_Brief_Guide_to_Mozilla_Preferences).
 
7
Mozprofile can be utilized from the command line or as an API.
 
8
 
 
9
 
 
10
# Command Line Usage
 
11
 
 
12
mozprofile may be used to create profiles, set preferences in
 
13
profiles, or install addons into profiles.
 
14
 
 
15
The profile to be operated on may be specified with the `--profile`
 
16
switch. If a profile is not specified, one will be created in a
 
17
temporary directory which will be echoed to the terminal:
 
18
 
 
19
    (mozmill)> mozprofile
 
20
    /tmp/tmp4q1iEU.mozrunner
 
21
    (mozmill)> ls /tmp/tmp4q1iEU.mozrunner
 
22
    user.js
 
23
 
 
24
To run mozprofile from the command line enter:
 
25
`mozprofile --help` for a list of options.
 
26
 
 
27
 
 
28
# API Usage
 
29
 
 
30
To use mozprofile as an API you can import
 
31
[mozprofile.profile](https://github.com/mozilla/mozbase/tree/master/mozprofile/mozprofile/profile.py)
 
32
and/or the
 
33
[AddonManager](https://github.com/mozilla/mozbase/tree/master/mozprofile/mozprofile/addons.py).
 
34
 
 
35
`mozprofile.profile` features a generic `Profile` class.  In addition,
 
36
subclasses `FirefoxProfile` and `ThundebirdProfile` are available
 
37
with preset preferences for those applications.
 
38
 
 
39
`mozprofile.profile:Profile`:
 
40
 
 
41
    def __init__(self,
 
42
                 profile=None, # Path to the profile
 
43
                 addons=None,  # String of one or list of addons to install
 
44
                 addon_manifests=None,  # Manifest for addons, see http://ahal.ca/blog/2011/bulk-installing-fx-addons/
 
45
                 preferences=None, # Dictionary or class of preferences
 
46
                 locations=None, # locations to proxy
 
47
                 proxy=False, # setup a proxy
 
48
                 restore=True # If true remove all installed addons preferences when cleaning up
 
49
                 ):
 
50
 
 
51
    def reset(self):
 
52
        """reset the profile to the beginning state"""
 
53
 
 
54
    def set_preferences(self, preferences, filename='user.js'):
 
55
        """Adds preferences dict to profile preferences"""
 
56
 
 
57
    def clean_preferences(self):
 
58
        """Removed preferences added by mozrunner."""
 
59
 
 
60
    def cleanup(self):
 
61
        """Cleanup operations for the profile."""
 
62
 
 
63
 
 
64
`mozprofile.addons:AddonManager`:
 
65
 
 
66
    def __init__(self, profile):
 
67
        """profile - the path to the profile for which we install addons"""
 
68
 
 
69
    def install_addons(self, addons=None, manifests=None):
 
70
        """
 
71
        Installs all types of addons
 
72
        addons - a list of addon paths to install
 
73
        manifest - a list of addon manifests to install
 
74
        """
 
75
 
 
76
    @classmethod
 
77
    def get_amo_install_path(self, query):
 
78
        """
 
79
        Return the addon xpi install path for the specified AMO query.
 
80
        See: https://developer.mozilla.org/en/addons.mozilla.org_%28AMO%29_API_Developers%27_Guide/The_generic_AMO_API
 
81
        for query documentation.
 
82
        """
 
83
 
 
84
    @classmethod
 
85
    def addon_details(cls, addon_path):
 
86
        """
 
87
        returns a dictionary of details about the addon
 
88
        - addon_path : path to the addon directory
 
89
        Returns:
 
90
        {'id':      u'rainbow@colors.org', # id of the addon
 
91
         'version': u'1.4',                # version of the addon
 
92
         'name':    u'Rainbow',            # name of the addon
 
93
         'unpack': False } # whether to unpack the addon
 
94
        """
 
95
 
 
96
    def clean_addons(self):
 
97
        """Cleans up addons in the profile."""
 
98
 
 
99
 
 
100
# Installing Addons
 
101
 
 
102
Addons may be installed individually or from a manifest.
 
103
 
 
104
Example:
 
105
 
 
106
        from mozprofile import FirefoxProfile
 
107
        
 
108
        # create new profile to pass to mozmill/mozrunner
 
109
        profile = FirefoxProfile(addons=["adblock.xpi"])
 
110
 
 
111
 
 
112
# Setting Preferences
 
113
 
 
114
Preferences can be set in several ways:
 
115
 
 
116
- using the API: You can pass preferences in to the Profile class's
 
117
  constructor: `obj = FirefoxProfile(preferences=[("accessibility.typeaheadfind.flashBar", 0)])`
 
118
- using a JSON blob file: `mozprofile --preferences myprefs.json`
 
119
- using a `.ini` file: `mozprofile --preferences myprefs.ini`
 
120
- via the command line: `mozprofile --pref key:value --pref key:value [...]`
 
121
 
 
122
When setting preferences from  an `.ini` file or the `--pref` switch,
 
123
the value will be interpolated as an integer or a boolean
 
124
(`true`/`false`) if possible.
 
125
 
 
126
# Setting Permissions
 
127
 
 
128
mozprofile also takes care of adding permissions to the profile.
 
129
See https://github.com/mozilla/mozbase/blob/master/mozprofile/mozprofile/permissions.py
 
130
 
 
131
 
 
132
# Resources
 
133
 
 
134
Other Mozilla programs offer additional and overlapping functionality
 
135
for profiles.  There is also substantive documentation on profiles and
 
136
their management.
 
137
 
 
138
- [ProfileManager](https://developer.mozilla.org/en/Profile_Manager) : 
 
139
  XULRunner application for managing profiles. Has a GUI and CLI.
 
140
- [python-profilemanager](http://k0s.org/mozilla/hg/profilemanager/) : python CLI interface similar to ProfileManager
 
141
- profile documentation : http://support.mozilla.com/en-US/kb/Profiles