/usr/lib/python2.7/dist-packages/reportbug/ui/__init__.py is in python-reportbug 6.6.3+deb8u1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 | #!/usr/bin/python -S
# -*- python -*-
# reportbug - Report a bug in the Debian distribution.
# Written by Chris Lawrence <lawrencc@debian.org>
# Copyright (C) 1999-2008 Chris Lawrence
# Copyright (C) 2008-2014 Sandro Tosi <morph@debian.org>
#
# This program is freely distributable per the following license:
#
## Permission to use, copy, modify, and distribute this software and its
## documentation for any purpose and without fee is hereby granted,
## provided that the above copyright notice appears in all copies and that
## both that copyright notice and this permission notice appear in
## supporting documentation.
##
## I DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
## IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL I
## BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY
## DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
## WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
## SOFTWARE.
__all__ = ['text_ui', 'urwid_ui', 'gtk2_ui']
UIS = {'text': 'A text-oriented console user interface',
'urwid': 'A menu-based console user interface',
'gtk2': 'A graphical (GTK+) user interface.'}
# Only the available UIs
AVAILABLE_UIS = {}
# List of already loaded ui, we can give back to requestors
__LOADED_UIS = {}
for uis in UIS.keys():
try:
# let's try to import the ui...
ui_module = __import__('reportbug.ui', fromlist=[uis+'_ui'])
# ... and check if it's really imported
ui = getattr(ui_module, uis+'_ui')
# then we can finally add it to AVAILABLE_UIS
AVAILABLE_UIS[uis] = UIS[uis]
__LOADED_UIS[uis] = ui
except:
# we can't import uis, so just skip it
pass
def getUI(ui):
"""Returns the requested UI, or default to text if not available"""
if __LOADED_UIS.has_key(ui):
print "loading %s" % ui
return __LOADED_UIS[ui]
else:
print "defaulting to text ui"
return __LOADED_UIS['text']
|