2013-09-13 13:53:29 +02:00
|
|
|
to make testing Kshitij's new tools easier, merge his code in
|
|
|
|
utils/apparmor/__init__.py - that's the only filename conflict (at
|
|
|
|
least in the 2.8 branch). If we do this, we can ship his new tools
|
|
|
|
in a testing package that can be installed on top of the 2.8.x packages
|
|
|
|
without problems
|
|
|
|
|
|
|
|
|
|
|
|
=== modified file 'utils/apparmor/__init__.py'
|
|
|
|
--- utils/apparmor/__init__.py 2012-05-08 05:37:48 +0000
|
|
|
|
+++ utils/apparmor/__init__.py 2013-09-12 15:10:50 +0000
|
|
|
|
@@ -1,9 +1,25 @@
|
|
|
|
# ------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# Copyright (C) 2011-2012 Canonical Ltd.
|
2013-10-01 17:59:24 +02:00
|
|
|
+# Copyright (C) 2013 Kshitij Gupta <kgupta8592@gmail.com>
|
2013-09-13 13:53:29 +02:00
|
|
|
#
|
|
|
|
# This program is free software; you can redistribute it and/or
|
|
|
|
# modify it under the terms of version 2 of the GNU General Public
|
|
|
|
# License published by the Free Software Foundation.
|
|
|
|
#
|
|
|
|
# ------------------------------------------------------------------
|
|
|
|
+
|
|
|
|
+import gettext
|
|
|
|
+import locale
|
|
|
|
+
|
|
|
|
+def init_localisation():
|
|
|
|
+ locale.setlocale(locale.LC_ALL, '')
|
2013-10-01 17:59:24 +02:00
|
|
|
+ #If a correct locale has been provided set filename else let an IOError be raised
|
|
|
|
+ filename = '/usr/share/locale/%s/LC_MESSAGES/apparmor-utils.mo' % locale.getlocale()[0]
|
2013-09-13 13:53:29 +02:00
|
|
|
+ try:
|
2013-10-01 17:59:24 +02:00
|
|
|
+ trans = gettext.GNUTranslations(open(filename, 'rb'))
|
|
|
|
+ except IOError:
|
2013-09-13 13:53:29 +02:00
|
|
|
+ trans = gettext.NullTranslations()
|
|
|
|
+ trans.install()
|
2013-10-01 17:59:24 +02:00
|
|
|
+
|
2013-09-13 13:53:29 +02:00
|
|
|
+init_localisation()
|
|
|
|
|