[Secure-testing-commits] r6768 - bin
fw at alioth.debian.org
fw at alioth.debian.org
Wed Oct 3 07:44:14 UTC 2007
Author: fw
Date: 2007-10-03 07:44:14 +0000 (Wed, 03 Oct 2007)
New Revision: 6768
Modified:
bin/dsa2list
Log:
dsa2list: better detection of installation path
It's now possible to symlink the script to ~/bin and run it
from there.
Modified: bin/dsa2list
===================================================================
--- bin/dsa2list 2007-10-03 07:39:17 UTC (rev 6767)
+++ bin/dsa2list 2007-10-03 07:44:14 UTC (rev 6768)
@@ -14,15 +14,21 @@
def setup_paths():
check_file = 'lib/python/debian_support.py'
- path = os.getcwd()
- while 1:
- if os.path.exists("%s/%s" % (path, check_file)):
- sys.path = [path + '/lib/python'] + sys.path
- return path
- idx = string.rfind(path, '/')
- if idx == -1:
- raise ImportError, "could not setup paths"
- path = path[0:idx]
+ paths = [os.getcwd(), os.path.dirname(sys.argv[0])]
+ try:
+ paths.append(os.path.dirname(os.readlink(sys.argv[0])))
+ except OSError:
+ pass
+ for path in paths:
+ while 1:
+ if os.path.exists("%s/%s" % (path, check_file)):
+ sys.path = [path + '/lib/python'] + sys.path
+ return path
+ idx = string.rfind(path, '/')
+ if idx == -1:
+ break
+ path = path[0:idx]
+ raise ImportError, "could not setup paths"
os.chdir(setup_paths())
import debian_support
More information about the Secure-testing-commits
mailing list