~jonobacon/acire/trunk

« back to all changes in this revision

Viewing changes to acire/acireconfig.py

  • Committer: Jono Bacon
  • Date: 2009-12-29 12:07:58 UTC
  • Revision ID: jono@ubuntu.com-20091229120758-ezp270vgx2i3fkny
Initial project creation with Quickly!

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# -*- coding: utf-8 -*-
 
2
### BEGIN LICENSE
 
3
# This file is in the public domain
 
4
### END LICENSE
 
5
 
 
6
# THIS IS Acire CONFIGURATION FILE
 
7
# YOU CAN PUT THERE SOME GLOBAL VALUE
 
8
# Do not touch until you know what you're doing.
 
9
# you're warned :)
 
10
 
 
11
# where your project will head for your data (for instance, images and ui files)
 
12
# by default, this is ../data, relative your trunk layout
 
13
__acire_data_directory__ = '../data/'
 
14
 
 
15
 
 
16
import os
 
17
 
 
18
class project_path_not_found(Exception):
 
19
    pass
 
20
 
 
21
def getdatapath():
 
22
    """Retrieve acire data path
 
23
 
 
24
    This path is by default <acire_lib_path>/../data/ in trunk
 
25
    and /usr/share/acire in an installed version but this path
 
26
    is specified at installation time.
 
27
    """
 
28
 
 
29
    # get pathname absolute or relative
 
30
    if __acire_data_directory__.startswith('/'):
 
31
        pathname = __acire_data_directory__
 
32
    else:
 
33
        pathname = os.path.dirname(__file__) + '/' + __acire_data_directory__
 
34
 
 
35
    abs_data_path = os.path.abspath(pathname)
 
36
    if os.path.exists(abs_data_path):
 
37
        return abs_data_path
 
38
    else:
 
39
        raise project_path_not_found
 
40