mirror of
https://github.com/sshuttle/sshuttle.git
synced 2025-04-24 03:08:56 +02:00
ssh.py: try harder to find required *.py files.
Search the entire python sys.path, not just the directory that argv[0] is in. That way if you symlink the sshuttle binary into (for example) ~/bin, it'll be able to work correctly.
This commit is contained in:
parent
2d4f6a4308
commit
a8b3d69856
6
ssh.py
6
ssh.py
@ -5,8 +5,12 @@ from helpers import *
|
|||||||
|
|
||||||
def readfile(name):
|
def readfile(name):
|
||||||
basedir = os.path.dirname(os.path.abspath(sys.argv[0]))
|
basedir = os.path.dirname(os.path.abspath(sys.argv[0]))
|
||||||
fullname = os.path.join(basedir, name)
|
path = [basedir] + sys.path
|
||||||
|
for d in path:
|
||||||
|
fullname = os.path.join(d, name)
|
||||||
|
if os.path.exists(fullname):
|
||||||
return open(fullname, 'rb').read()
|
return open(fullname, 'rb').read()
|
||||||
|
raise Exception("can't find file %r in any of %r" % (name, path))
|
||||||
|
|
||||||
|
|
||||||
def empackage(z, filename):
|
def empackage(z, filename):
|
||||||
|
Loading…
Reference in New Issue
Block a user