OLD | NEW |
(Empty) | |
| 1 Metadata-Version: 2.0 |
| 2 Name: appdirs |
| 3 Version: 1.4.0 |
| 4 Summary: A small Python module for determining appropriate " + "platform
-specific dirs, e.g. a "user data dir". |
| 5 Home-page: http://github.com/ActiveState/appdirs |
| 6 Author: Trent Mick; Sridhar Ratnakumar |
| 7 Author-email: trentm@gmail.com; github@srid.name |
| 8 License: MIT |
| 9 Keywords: application directory log cache user |
| 10 Platform: UNKNOWN |
| 11 Classifier: Development Status :: 4 - Beta |
| 12 Classifier: Intended Audience :: Developers |
| 13 Classifier: License :: OSI Approved :: MIT License |
| 14 Classifier: Operating System :: OS Independent |
| 15 Classifier: Programming Language :: Python :: 2 |
| 16 Classifier: Programming Language :: Python :: 2.4 |
| 17 Classifier: Programming Language :: Python :: 2.5 |
| 18 Classifier: Programming Language :: Python :: 2.6 |
| 19 Classifier: Programming Language :: Python :: 2.7 |
| 20 Classifier: Programming Language :: Python :: 3 |
| 21 Classifier: Programming Language :: Python :: 3.1 |
| 22 Classifier: Programming Language :: Python :: 3.2 |
| 23 Classifier: Topic :: Software Development :: Libraries :: Python Modules |
| 24 |
| 25 .. image:: https://secure.travis-ci.org/ActiveState/appdirs.png |
| 26 :target: http://travis-ci.org/ActiveState/appdirs |
| 27 |
| 28 the problem |
| 29 =========== |
| 30 |
| 31 What directory should your app use for storing user data? If running on Mac OS X
, you |
| 32 should use:: |
| 33 |
| 34 ~/Library/Application Support/<AppName> |
| 35 |
| 36 If on Windows (at least English Win XP) that should be:: |
| 37 |
| 38 C:\Documents and Settings\<User>\Application Data\Local Settings\<AppAuthor>
\<AppName> |
| 39 |
| 40 or possibly:: |
| 41 |
| 42 C:\Documents and Settings\<User>\Application Data\<AppAuthor>\<AppName> |
| 43 |
| 44 for `roaming profiles <http://bit.ly/9yl3b6>`_ but that is another story. |
| 45 |
| 46 On Linux (and other Unices) the dir, according to the `XDG |
| 47 spec <http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html>`_,
is:: |
| 48 |
| 49 ~/.local/share/<AppName> |
| 50 |
| 51 |
| 52 ``appdirs`` to the rescue |
| 53 ========================= |
| 54 |
| 55 This kind of thing is what the ``appdirs`` module is for. ``appdirs`` will |
| 56 help you choose an appropriate: |
| 57 |
| 58 - user data dir (``user_data_dir``) |
| 59 - user config dir (``user_config_dir``) |
| 60 - user cache dir (``user_cache_dir``) |
| 61 - site data dir (``site_data_dir``) |
| 62 - site config dir (``site_config_dir``) |
| 63 - user log dir (``user_log_dir``) |
| 64 |
| 65 and also: |
| 66 |
| 67 - is a single module so other Python packages can include their own private copy |
| 68 - is slightly opinionated on the directory names used. Look for "OPINION" in |
| 69 documentation and code for when an opinion is being applied. |
| 70 |
| 71 |
| 72 some example output |
| 73 =================== |
| 74 |
| 75 On Mac OS X:: |
| 76 |
| 77 >>> from appdirs import * |
| 78 >>> appname = "SuperApp" |
| 79 >>> appauthor = "Acme" |
| 80 >>> user_data_dir(appname, appauthor) |
| 81 '/Users/trentm/Library/Application Support/SuperApp' |
| 82 >>> site_data_dir(appname, appauthor) |
| 83 '/Library/Application Support/SuperApp' |
| 84 >>> user_cache_dir(appname, appauthor) |
| 85 '/Users/trentm/Library/Caches/SuperApp' |
| 86 >>> user_log_dir(appname, appauthor) |
| 87 '/Users/trentm/Library/Logs/SuperApp' |
| 88 |
| 89 On Windows 7:: |
| 90 |
| 91 >>> from appdirs import * |
| 92 >>> appname = "SuperApp" |
| 93 >>> appauthor = "Acme" |
| 94 >>> user_data_dir(appname, appauthor) |
| 95 'C:\\Users\\trentm\\AppData\\Local\\Acme\\SuperApp' |
| 96 >>> user_data_dir(appname, appauthor, roaming=True) |
| 97 'C:\\Users\\trentm\\AppData\\Roaming\\Acme\\SuperApp' |
| 98 >>> user_cache_dir(appname, appauthor) |
| 99 'C:\\Users\\trentm\\AppData\\Local\\Acme\\SuperApp\\Cache' |
| 100 >>> user_log_dir(appname, appauthor) |
| 101 'C:\\Users\\trentm\\AppData\\Local\\Acme\\SuperApp\\Logs' |
| 102 |
| 103 On Linux:: |
| 104 |
| 105 >>> from appdirs import * |
| 106 >>> appname = "SuperApp" |
| 107 >>> appauthor = "Acme" |
| 108 >>> user_data_dir(appname, appauthor) |
| 109 '/home/trentm/.local/share/SuperApp |
| 110 >>> site_data_dir(appname, appauthor) |
| 111 '/usr/local/share/SuperApp' |
| 112 >>> site_data_dir(appname, appauthor, multipath=True) |
| 113 '/usr/local/share/SuperApp:/usr/share/SuperApp' |
| 114 >>> user_cache_dir(appname, appauthor) |
| 115 '/home/trentm/.cache/SuperApp' |
| 116 >>> user_log_dir(appname, appauthor) |
| 117 '/home/trentm/.cache/SuperApp/log' |
| 118 >>> user_config_dir(appname) |
| 119 '/home/trentm/.config/SuperApp' |
| 120 >>> site_config_dir(appname) |
| 121 '/etc/xdg/SuperApp' |
| 122 >>> os.environ['XDG_CONFIG_DIRS'] = '/etc:/usr/local/etc' |
| 123 >>> site_config_dir(appname, multipath=True) |
| 124 '/etc/SuperApp:/usr/local/etc/SuperApp' |
| 125 |
| 126 |
| 127 ``AppDirs`` for convenience |
| 128 =========================== |
| 129 |
| 130 :: |
| 131 |
| 132 >>> from appdirs import AppDirs |
| 133 >>> dirs = AppDirs("SuperApp", "Acme") |
| 134 >>> dirs.user_data_dir |
| 135 '/Users/trentm/Library/Application Support/SuperApp' |
| 136 >>> dirs.site_data_dir |
| 137 '/Library/Application Support/SuperApp' |
| 138 >>> dirs.user_cache_dir |
| 139 '/Users/trentm/Library/Caches/SuperApp' |
| 140 >>> dirs.user_log_dir |
| 141 '/Users/trentm/Library/Logs/SuperApp' |
| 142 |
| 143 |
| 144 |
| 145 Per-version isolation |
| 146 ===================== |
| 147 |
| 148 If you have multiple versions of your app in use that you want to be |
| 149 able to run side-by-side, then you may want version-isolation for these |
| 150 dirs:: |
| 151 |
| 152 >>> from appdirs import AppDirs |
| 153 >>> dirs = AppDirs("SuperApp", "Acme", version="1.0") |
| 154 >>> dirs.user_data_dir |
| 155 '/Users/trentm/Library/Application Support/SuperApp/1.0' |
| 156 >>> dirs.site_data_dir |
| 157 '/Library/Application Support/SuperApp/1.0' |
| 158 >>> dirs.user_cache_dir |
| 159 '/Users/trentm/Library/Caches/SuperApp/1.0' |
| 160 >>> dirs.user_log_dir |
| 161 '/Users/trentm/Library/Logs/SuperApp/1.0' |
| 162 |
| 163 |
| 164 |
| 165 appdirs Changelog |
| 166 ================= |
| 167 |
| 168 appdirs 1.4.0 |
| 169 ------------- |
| 170 - [PR #42] AppAuthor is now optional on Windows |
| 171 - [issue 41] Support Jython on Windows, Mac, and Unix-like platforms. Windows |
| 172 support requires `JNA <https://github.com/twall/jna>`_. |
| 173 - [PR #44] Fix incorrect behaviour of the site_config_dir method |
| 174 |
| 175 appdirs 1.3.0 |
| 176 ------------- |
| 177 - [Unix, issue 16] Conform to XDG standard, instead of breaking it for |
| 178 everybody |
| 179 - [Unix] Removes gratuitous case mangling of the case, since \*nix-es are |
| 180 usually case sensitive, so mangling is not wise |
| 181 - [Unix] Fixes the uterly wrong behaviour in ``site_data_dir``, return result |
| 182 based on XDG_DATA_DIRS and make room for respecting the standard which |
| 183 specifies XDG_DATA_DIRS is a multiple-value variable |
| 184 - [Issue 6] Add ``*_config_dir`` which are distinct on nix-es, according to |
| 185 XDG specs; on Windows and Mac return the corresponding ``*_data_dir`` |
| 186 |
| 187 appdirs 1.2.0 |
| 188 ------------- |
| 189 |
| 190 - [Unix] Put ``user_log_dir`` under the *cache* dir on Unix. Seems to be more |
| 191 typical. |
| 192 - [issue 9] Make ``unicode`` work on py3k. |
| 193 |
| 194 appdirs 1.1.0 |
| 195 ------------- |
| 196 |
| 197 - [issue 4] Add ``AppDirs.user_log_dir``. |
| 198 - [Unix, issue 2, issue 7] appdirs now conforms to `XDG base directory spec |
| 199 <http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html>`_. |
| 200 - [Mac, issue 5] Fix ``site_data_dir()`` on Mac. |
| 201 - [Mac] Drop use of 'Carbon' module in favour of hardcoded paths; supports |
| 202 Python3 now. |
| 203 - [Windows] Append "Cache" to ``user_cache_dir`` on Windows by default. Use |
| 204 ``opinion=False`` option to disable this. |
| 205 - Add ``appdirs.AppDirs`` convenience class. Usage: |
| 206 |
| 207 >>> dirs = AppDirs("SuperApp", "Acme", version="1.0") |
| 208 >>> dirs.user_data_dir |
| 209 '/Users/trentm/Library/Application Support/SuperApp/1.0' |
| 210 |
| 211 - [Windows] Cherry-pick Komodo's change to downgrade paths to the Windows short |
| 212 paths if there are high bit chars. |
| 213 - [Linux] Change default ``user_cache_dir()`` on Linux to be singular, e.g. |
| 214 "~/.superapp/cache". |
| 215 - [Windows] Add ``roaming`` option to ``user_data_dir()`` (for use on Windows on
ly) |
| 216 and change the default ``user_data_dir`` behaviour to use a *non*-roaming |
| 217 profile dir (``CSIDL_LOCAL_APPDATA`` instead of ``CSIDL_APPDATA``). Why? Becau
se |
| 218 a large roaming profile can cause login speed issues. The "only syncs on |
| 219 logout" behaviour can cause surprises in appdata info. |
| 220 |
| 221 |
| 222 appdirs 1.0.1 (never released) |
| 223 ------------------------------ |
| 224 |
| 225 Started this changelog 27 July 2010. Before that this module originated in the |
| 226 `Komodo <http://www.activestate.com/komodo>`_ product as ``applib.py`` and then |
| 227 as `applib/location.py |
| 228 <http://github.com/ActiveState/applib/blob/master/applib/location.py>`_ (used by |
| 229 `PyPM <http://code.activestate.com/pypm/>`_ in `ActivePython |
| 230 <http://www.activestate.com/activepython>`_). This is basically a fork of |
| 231 applib.py 1.0.1 and applib/location.py 1.0.1. |
| 232 |
| 233 |
| 234 |
OLD | NEW |