3 # Copyright (C) 2006, 2007 Ulrik Sverdrup
5 # dragbox -- Commandline drag-and-drop tool for GNOME
7 # This program is free software; you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; either version 2 of the License, or
10 # (at your option) any later version.
12 # This program is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details.
17 # You should have received a copy of the GNU General Public License
18 # along with this program; if not, write to the Free Software
19 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
22 def find_package_path():
24 If the Dragbox package is not in the path, try to find it
26 Adapted scribes' source (http://scribes.sf.net)
27 Copyright © 2005 Lateef Alabi-Oki
30 from sys
import argv
, exit
33 package_name
= "Dragbox"
35 head
, tail
= path
.split(path
.split(path
.abspath(argv
[0]))[0])
39 libdir
= path
.join(head
, "lib")
41 if path
.exists(libdir
):
43 python_dir
= libdir
+ "/python"
44 package_lib_dir
= path
.join(python_dir
, package_name
)
46 if package_lib_dir
and path
.exists(package_lib_dir
):
52 python_dir
= libdir
+ "/python2.4/site-packages"
53 package_lib_dir
= path
.join(python_dir
, package_name
)
55 if package_lib_dir
and path
.exists(package_lib_dir
):
61 print "Could not find the Dragbox package"
62 print "Check your PYTHONPATH, _and_ file a bug"
68 from Dragbox
.main
import dragbox
71 python_dir
= find_package_path()
72 path
.insert(0, python_dir
)
73 from Dragbox
.main
import dragbox
76 if __name__
== "__main__":