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/lsr)
23 @type HOME_DIR: string
24 @var DATA_DIR: System data directory for this program install (e.g.
25 /usr/share/lsr)
26 @type DATA_DIR: string
27 @var TEMPLATE_DIR: Template data directory for this program install (e.g.
28 /usr/share/lsr/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 All rights reserved. This program and the accompanying materials are made
39 available under the terms of the BSD license which accompanies
40 this distribution, and is available at
41 U{http://www.opensource.org/licenses/bsd-license.php}
42 '''
43 import os
44
45
46 PROG_NAME = 'lsr'
47
48
49 PROG_VERSION = '0.5.3'
50 PROG_DATE = 'Mon Jun 4 11:35:56 UTC 2007'
51
52
53 NAME = 'Linux Screen Reader'
54 COPYRIGHT = 'Copyright (c) 2005, 2007 IBM Corporation'
55 LICENSE = 'All rights reserved. This program and the accompanying ' \
56 'materials are made available under the terms of the BSD License ' \
57 'which accompanies this distribution, and is available at' \
58 'http://www.opensource.org/licenses/bsd-license.php'
59
60
61 PREFIX = '/usr/local'
62 HOME_USER = os.path.join(os.environ['HOME'], '.'+PROG_NAME)
63 HOME_DIR = os.path.normpath(os.path.join(os.path.dirname(__file__), '..'))
64 DATA_DIR = os.path.join(PREFIX, 'share', PROG_NAME)
65 TEMPLATE_DIR = os.path.join(DATA_DIR, 'templates')
66
67
68 ICON_SIZES = [16, 24, 32, 36, 48, 64, 96]
69
71 '''
72 Initializes a path in the user's home directory, but only if the uid of the
73 current process matches that of the home directory. Use to avoid creating
74 paths during install owned by the root user when using sudo.
75
76 @param pth: Full path to initialize
77 @type pth: string
78 @return: Was the path created or not?
79 @rtype: boolean
80 '''
81 try:
82
83
84
85 if os.stat(os.environ['HOME']).st_gid == os.getgid():
86 os.makedirs(pth)
87 return True
88 except OSError:
89 pass
90 return False
91
92
93 if initUserPath(HOME_USER):
94 print 'created ~/.lsr'
95