← Back to team overview

clicompanion-devs team mailing list archive

[Merge] lp:~dcaro/clicompanion/fix-908240 into lp:clicompanion

 

David Caro has proposed merging lp:~dcaro/clicompanion/fix-908240 into lp:clicompanion.

Requested reviews:
  CLI Companion Development Team (clicompanion-devs)
Related bugs:
  Bug #908240 in CLI Companion: "Locale directory not found"
  https://bugs.launchpad.net/clicompanion/+bug/908240

For more details, see:
https://code.launchpad.net/~dcaro/clicompanion/fix-908240/+merge/86833

Added default directories from http://standards.freedesktop.org/basedir-spec/latest/ar01s03.html, when searching for the locales installation dir and a simple message and exit status when not finding it.
-- 
https://code.launchpad.net/~dcaro/clicompanion/fix-908240/+merge/86833
Your team CLI Companion Development Team is requested to review the proposed merge of lp:~dcaro/clicompanion/fix-908240 into lp:clicompanion.
=== modified file 'clicompanion'
--- clicompanion	2011-11-04 00:37:22 +0000
+++ clicompanion	2011-12-23 21:36:26 +0000
@@ -8,12 +8,21 @@
 
 from clicompanionlib.view import run
 
-if (os.path.exists ('/usr/share/clicompanion/')):
-    BASEDIR = '/usr/share/clicompanion/'
-    print "using locale in system"
-else:
+share_dirs = os.environ.get('XDG_BASE_PDATA', 
+                            '/usr/local/share:/usr/share').split(os.pathsep)
+
+BASEDIR = ''
+for path in share_dirs:
+    if (os.path.exists('%s/clicompanion/'%path)):
+        BASEDIR = '%s/clicompanion/'%path
+        print "Using locale in system"
+        break
+if not BASEDIR:
     BASEDIR = os.path.abspath(os.path.dirname(os.path.realpath(sys.argv[0])))
-    print "using locale in source code folder"
+    if (os.path.exists(BASEDIR)):
+        print "ERROR: locales dir not found."
+        sys.exit(1)
+    print "Using locale in source code folder"
 
 
 parser = OptionParser(usage="%prog [-f] [-q]", version="%prog 1.1")


Follow ups