Merge lp:~rafalcieslak256/ubuntu-accomplishments-daemon/more-paths into lp:ubuntu-accomplishments-daemon

Proposed by Rafał Cieślak
Status: Merged
Merged at revision: 14
Proposed branch: lp:~rafalcieslak256/ubuntu-accomplishments-daemon/more-paths
Merge into: lp:ubuntu-accomplishments-daemon
Diff against target: 49 lines (+19/-6)
1 file modified
accomplishments/util/paths.py (+19/-6)
To merge this branch: bzr merge lp:~rafalcieslak256/ubuntu-accomplishments-daemon/more-paths
Reviewer Review Type Date Requested Status
Jono Bacon Pending
Review via email: mp+102177@code.launchpad.net

Description of the change

This branch introduces small additions to util/paths.py, that make it straightforward for other scripts (including viewer) to learn more about daemon's paths. This includes providing them with deamon_exec_dir, which is the path to the right daemon launcher - the one that has been installed with this API, and locale_dir - path to directory where locale .gmo files has been installed. This will work for both packaged & manually installed (to any prefix) daemon.

This is a crucial change needed to fix in #982047 "Starting the daemon from the client is broken for packages" and #983356 "gettext uses locales from wrong directory" in the Viewer.

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'accomplishments/util/paths.py'
2--- accomplishments/util/paths.py 2012-04-15 16:16:49 +0000
3+++ accomplishments/util/paths.py 2012-04-16 20:37:18 +0000
4@@ -1,11 +1,6 @@
5 import os
6
7-if __file__[0] is '/':
8- #the script run with absolute path
9- scriptpath = __file__
10-else:
11- scriptpath = os.path.join(os.getcwd(),__file__)
12-
13+scriptpath = os.path.abspath(__file__)
14 # okay, so as we have the full path, we're ready to analise it...
15
16 # start by looking 2 levels higher. This is either the branch directory,
17@@ -29,10 +24,18 @@
18 # finally, setting these significant data directories...
19 systemdata_dir = os.path.join(basepath, 'share/accomplishments-daemon')
20 media_dir = os.path.join(basepath, 'share/accomplishments-daemon/media')
21+
22 # these two may need to be set for the accomplismhents scripts, so that they
23 # can use OUR accomplishments module, using this installation.
24 module_dir1 = os.path.join(basepath, 'lib/python2.7/site-packages')
25 module_dir2 = os.path.join(basepath, 'lib/python2.7/dist-packages')
26+
27+ # that's where the daemon launcher is present
28+ daemon_exec_dir= os.path.join(basepath, 'bin')
29+
30+ # locale files directory
31+ locale_dir= os.path.join(basepath, 'share/locale')
32+
33 else:
34 # using branch root directory as the base path
35 basepath = branchpath
36@@ -43,3 +46,13 @@
37 media_dir = os.path.join(basepath, 'data/media')
38 module_dir1 = None # always using default
39 module_dir2 = None # always using default
40+
41+ # that's where the daemon launcher is present
42+ daemon_exec_dir= os.path.join(basepath, 'bin')
43+
44+ # If the application has not been installed, the .po files has not been
45+ # complied to .gmo, and thus gettext will be unable to use translated
46+ # strings. In this case it does not matter where it will look for locales,
47+ # but if it's left to default there is some small chance that they are
48+ # present int /usr/share/locale, used by an another installation.
49+ locale_dir = None

Subscribers

People subscribed via source and target branches