/stdhome

To get this branch, use:
bzr branch http://bzr.ed.am/stdhome
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!@PYTHON@
#
# stdhome
#
# Copyright (C) 2013 Tim Marston <tim@edm.am>
#
# This file is part of stdhome (hereafter referred to as "this program").
# See http://ed.am/dev/stdhome for more information.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.


# @PACKAGE_NAME@ version @PACKAGE_VERSION@@bzr_info@

if __name__ == "__main__":

	import sys
	from os.path import abspath, exists, join

	# add regular site-package directories (for debian)
	for path in sys.path:
		if path.endswith('dist-packages'):
			sys.path.append( path[:-13] + 'site-packages' )

	# check for a development source directory and use that if it's there
	PACKAGE_DIR = join( abspath( sys.path[ 0 ] ), "..", "lib" )
	if exists( join( PACKAGE_DIR, "stdhome", "the.py" ) ):
		print( "!!! using development packages !!!", file=sys.stderr )
		sys.path.insert( 0, PACKAGE_DIR )
	else:
		del PACKAGE_DIR

	# start main program
	from stdhome import the
	from stdhome.program import Program
	the.program = Program( "@PACKAGE_VERSION@@bzr_info@" )
	the.program.run()