Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
michael@0 | 1 | :mod:`mozprofile` --- Create and modify Mozilla application profiles |
michael@0 | 2 | ==================================================================== |
michael@0 | 3 | |
michael@0 | 4 | Mozprofile_ is a python tool for creating and managing profiles for Mozilla's |
michael@0 | 5 | applications (Firefox, Thunderbird, etc.). In addition to creating profiles, |
michael@0 | 6 | mozprofile can install addons_ and set preferences_ Mozprofile can be utilized |
michael@0 | 7 | from the command line or as an API. |
michael@0 | 8 | |
michael@0 | 9 | The preferred way of setting up profile data (addons, permissions, preferences |
michael@0 | 10 | etc) is by passing them to the profile_ constructor. |
michael@0 | 11 | |
michael@0 | 12 | Addons |
michael@0 | 13 | ------ |
michael@0 | 14 | |
michael@0 | 15 | .. automodule:: mozprofile.addons |
michael@0 | 16 | :members: |
michael@0 | 17 | |
michael@0 | 18 | Addons may be installed individually or from a manifest. |
michael@0 | 19 | |
michael@0 | 20 | Example:: |
michael@0 | 21 | |
michael@0 | 22 | from mozprofile import FirefoxProfile |
michael@0 | 23 | |
michael@0 | 24 | # create new profile to pass to mozmill/mozrunner |
michael@0 | 25 | profile = FirefoxProfile(addons=["adblock.xpi"]) |
michael@0 | 26 | |
michael@0 | 27 | Command Line Interface |
michael@0 | 28 | ---------------------- |
michael@0 | 29 | |
michael@0 | 30 | .. automodule:: mozprofile.cli |
michael@0 | 31 | :members: |
michael@0 | 32 | |
michael@0 | 33 | The profile to be operated on may be specified with the ``--profile`` |
michael@0 | 34 | switch. If a profile is not specified, one will be created in a |
michael@0 | 35 | temporary directory which will be echoed to the terminal:: |
michael@0 | 36 | |
michael@0 | 37 | (mozmill)> mozprofile |
michael@0 | 38 | /tmp/tmp4q1iEU.mozrunner |
michael@0 | 39 | (mozmill)> ls /tmp/tmp4q1iEU.mozrunner |
michael@0 | 40 | user.js |
michael@0 | 41 | |
michael@0 | 42 | To run mozprofile from the command line enter: |
michael@0 | 43 | ``mozprofile --help`` for a list of options. |
michael@0 | 44 | |
michael@0 | 45 | Permissions |
michael@0 | 46 | ----------- |
michael@0 | 47 | |
michael@0 | 48 | .. automodule:: mozprofile.permissions |
michael@0 | 49 | :members: |
michael@0 | 50 | |
michael@0 | 51 | You can set permissions by creating a ``ServerLocations`` object that you pass |
michael@0 | 52 | to the ``Profile`` constructor. Hosts can be added to it with |
michael@0 | 53 | ``add_host(host, port)``. ``port`` can be 0. |
michael@0 | 54 | |
michael@0 | 55 | Preferences |
michael@0 | 56 | ----------- |
michael@0 | 57 | |
michael@0 | 58 | .. automodule:: mozprofile.prefs |
michael@0 | 59 | :members: |
michael@0 | 60 | |
michael@0 | 61 | Preferences can be set in several ways: |
michael@0 | 62 | |
michael@0 | 63 | - using the API: You can make a dictionary with the preferences and pass it to |
michael@0 | 64 | the ``Profile`` constructor. You can also add more preferences with the |
michael@0 | 65 | ``Profile.set_preferences`` method. |
michael@0 | 66 | - using a JSON blob file: ``mozprofile --preferences myprefs.json`` |
michael@0 | 67 | - using a ``.ini`` file: ``mozprofile --preferences myprefs.ini`` |
michael@0 | 68 | - via the command line: ``mozprofile --pref key:value --pref key:value [...]`` |
michael@0 | 69 | |
michael@0 | 70 | When setting preferences from an ``.ini`` file or the ``--pref`` switch, |
michael@0 | 71 | the value will be interpolated as an integer or a boolean |
michael@0 | 72 | (``true``/``false``) if possible. |
michael@0 | 73 | |
michael@0 | 74 | Profile |
michael@0 | 75 | -------------------- |
michael@0 | 76 | |
michael@0 | 77 | .. automodule:: mozprofile.profile |
michael@0 | 78 | :members: |
michael@0 | 79 | |
michael@0 | 80 | Resources |
michael@0 | 81 | ----------- |
michael@0 | 82 | Other Mozilla programs offer additional and overlapping functionality |
michael@0 | 83 | for profiles. There is also substantive documentation on profiles and |
michael@0 | 84 | their management. |
michael@0 | 85 | |
michael@0 | 86 | - ProfileManager_: XULRunner application for managing profiles. Has a GUI and CLI. |
michael@0 | 87 | - python-profilemanager_: python CLI interface similar to ProfileManager |
michael@0 | 88 | - profile documentation_ |
michael@0 | 89 | |
michael@0 | 90 | |
michael@0 | 91 | .. _Mozprofile: https://github.com/mozilla/mozbase/tree/master/mozprofile |
michael@0 | 92 | .. _addons: https://developer.mozilla.org/en/addons |
michael@0 | 93 | .. _preferences: https://developer.mozilla.org/En/A_Brief_Guide_to_Mozilla_Preferences |
michael@0 | 94 | .. _mozprofile.profile: https://github.com/mozilla/mozbase/tree/master/mozprofile/mozprofile/profile.py |
michael@0 | 95 | .. _AddonManager: https://github.com/mozilla/mozbase/tree/master/mozprofile/mozprofile/addons.py |
michael@0 | 96 | .. _here: https://github.com/mozilla/mozbase/blob/master/mozprofile/mozprofile/permissions.py |
michael@0 | 97 | .. _ProfileManager: https://developer.mozilla.org/en/Profile_Manager |
michael@0 | 98 | .. _python-profilemanager: http://k0s.org/mozilla/hg/profilemanager/ |
michael@0 | 99 | .. _documentation: http://support.mozilla.com/en-US/kb/Profiles |