summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorFlorian Weimer <fw@deneb.enyo.de>2007-10-03 07:44:14 +0000
committerFlorian Weimer <fw@deneb.enyo.de>2007-10-03 07:44:14 +0000
commit8bd4361e2add48e770dc42f3ff84db256b3a6b72 (patch)
treea138efe1afb7309ce691a49e52c820ac7591683e /bin
parent808e233e6c397c7cfa904ac909369c755aff872d (diff)
dsa2list: better detection of installation path
It's now possible to symlink the script to ~/bin and run it from there. git-svn-id: svn+ssh://svn.debian.org/svn/secure-testing@6768 e39458fd-73e7-0310-bf30-c45bca0a0e42
Diffstat (limited to 'bin')
-rwxr-xr-xbin/dsa2list24
1 files changed, 15 insertions, 9 deletions
diff --git a/bin/dsa2list b/bin/dsa2list
index e121b248dc..ad531ad95c 100755
--- a/bin/dsa2list
+++ b/bin/dsa2list
@@ -14,15 +14,21 @@ import urllib2
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

© 2014-2024 Faster IT GmbH | imprint | privacy policy