1 '''
2 Platform specific constants.
3
4 @var PROG_NAME: Name of this program
5 @type PROG_NAME: string
6 @var PROG_VERSION: Version of this program
7 @type PROG_VERSION: string
8 @var PROG_DATE: Date of this program's last install or packaging
9 @type PROG_DATE: string
10 @var NAME: Human readable name of this program
11 @type NAME: string
12 @var COPYRIGHT: Copyright notice for this program
13 @type COPYRIGHT: string
14 @var LICENSE: License summary for this program
15 @type LICENSE: string
16 @var PREFIX: Install prefix for this program
17 @type PREFIX: string
18 @var HOME_USER: Configuration directory for the Unix user currently running
19 this program
20 @type HOME_USER: string
21 @var HOME_DIR: Home directory for this program install (e.g.
22 /usr/lib/python2.4/site-packages/sue)
23 @type HOME_DIR: string
24 @var DATA_DIR: System data directory for this program install (e.g.
25 /usr/share/sue)
26 @type DATA_DIR: string
27 @var TEMPLATE_DIR: Template data directory for this program install (e.g.
28 /usr/share/sue/templates)
29 @type TEMPLATE_DIR: string
30 @var ICON_SIZES: Sizes for all installed program icons
31 @type ICON_SIZES: list of integer
32
33 @author: Peter Parente
34 @organization: IBM Corporation
35 @copyright: Copyright (c) 2005, 2007 IBM Corporation
36 @license: The BSD License
37
38 @author: Frank Zenker
39 @organization: IT Science Center Ruegen gGmbH, Germany
40 @copyright: Copyright (c) 2007, 2008 ITSC Ruegen
41 @license: The BSD License
42
43 All rights reserved. This program and the accompanying materials are made
44 available under the terms of the BSD license which accompanies
45 this distribution, and is available at
46 U{http://www.opensource.org/licenses/bsd-license.php}
47 '''
48 import os
49
50
51 PROG_NAME = 'sue'
52
53
54 PROG_VERSION = '0.3.0'
55 PROG_DATE = 'Wed May 28 14:27:20 UTC 2008'
56
57
58 NAME = 'Screenreader Usability Extensions'
59 COPYRIGHT = 'Copyright (c) 2007 IT Science Center gGmbH Ruegen, Germany'
60 LICENSE = 'http://www.opensource.org/licenses/bsd-license.php'
61
62
63 PREFIX = '/usr/local'
64 HOME_USER = os.path.join(os.environ['HOME'], '.'+PROG_NAME)
65 HOME_DIR = os.path.normpath(os.path.join(os.path.dirname(__file__), '..'))
66 DATA_DIR = os.path.join(PREFIX, 'share', PROG_NAME)
67 TEMPLATE_DIR = os.path.join(DATA_DIR, 'templates')
68
69
70 ICON_SIZES = [16, 24, 32, 36, 48, 64, 96]
71
73 '''
74 Initializes a path in the user's home directory, but only if the uid of the
75 current process matches that of the home directory. Use to avoid creating
76 paths during install owned by the root user when using sudo.
77
78 @param pth: Full path to initialize
79 @type pth: string
80 @return: Was the path created or not?
81 @rtype: boolean
82 '''
83 try:
84
85
86
87 if os.stat(os.environ['HOME']).st_gid == os.getgid():
88 os.makedirs(pth)
89 return True
90 except OSError:
91 pass
92 return False
93
94
95 if initUserPath(HOME_USER):
96 print 'created ~/.sue'
97