~ubuntu-branches/ubuntu/vivid/mago/vivid

« back to all changes in this revision

Viewing changes to mago/cmd/globals.py

  • Committer: Bazaar Package Importer
  • Author(s): Ara Pulido
  • Date: 2010-10-18 16:08:42 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20101018160842-6euef3m6mqxjlcai
Tags: 0.3-0ubuntu1
* New upstream release:
  + Added i18n support
  + Tests working on Maverick 

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
        
23
23
        return os.path.join(prefix, 'share', 'mago')
24
24
 
 
25
def _get_locale_dir():
 
26
    if os.path.exists(os.path.join(_get_grandparent_dir(__file__), 'setup.py')):
 
27
        # We are in the build directory.
 
28
        return os.path.join(_get_grandparent_dir(__file__), 'build/mo')
 
29
    else:
 
30
        # We are in an installed prefix.
 
31
        prefix = os.path.dirname(__file__)
 
32
        while not os.path.exists(os.path.join(prefix, 'share', 'locale')):
 
33
            new_prefix = os.path.dirname(prefix)
 
34
            if new_prefix == prefix:
 
35
                return _get_grandparent_dir(__file__)
 
36
            prefix = new_prefix
 
37
        
 
38
        return os.path.join(prefix, 'share', 'locale')
 
39
 
25
40
MAGO_SHARE = os.environ.get('MAGO_SHARE', _get_share_dir())
 
41
LOCALE_SHARE = _get_locale_dir()
26
42
MAGO_PATH = [os.path.curdir, MAGO_SHARE]
27
43
 
28
44
if os.environ.get('MAGO_PATH', None):