Ran idioms filter on code
[zeroinstall.git] / zeroinstall / __init__.py
blobb416711f3a5eb1ad8dbfd92232d9066520cc1845
1 """
2 The Python implementation of the Zero Install injector is divided into five sub-packages:
4 - L{zeroinstall.cmd} contains one module for each 0install sub-command (providing the shell-scripting interface)
5 - L{zeroinstall.injector} contains most of the interesting stuff for managing feeds, keys and downloads and for selecting versions
6 - L{zeroinstall.zerostore} contains low-level code for handling the implementation cache (where unpacked packages are stored)
7 - L{zeroinstall.gtkui} contains code for making GTK user-interfaces
8 - L{zeroinstall.support} contains helper code (not really specific to Zero Install)
10 @copyright: (C) 2010, Thomas Leonard
11 @see: U{http://0install.net}
13 @var _: a function for translating strings using the zero-install domain (for use internally by Zero Install)
14 """
16 version = '1.0'
18 import gettext
19 from os.path import dirname, join
21 try:
22 localedir = None
23 translation = gettext.translation('zero-install', fallback = False)
24 except:
25 localedir = join(dirname(dirname(__file__)), 'share', 'locale')
26 translation = gettext.translation('zero-install',
27 localedir = localedir,
28 fallback = True)
29 _ = translation.ugettext
31 class SafeException(Exception):
32 """An exception that can be reported to the user without a stack trace.
33 The command-line interface's C{--verbose} option will display the full stack trace."""
35 class NeedDownload(SafeException):
36 """Thrown if we tried to start a download and downloading is
37 disabled."""
38 def __init__(self, url):
39 Exception.__init__(self, _("Would download '%s'") % url)