You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

254 lines
8.6 KiB

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