Commit a8b3d698 authored by Avery Pennarun's avatar Avery Pennarun

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.
parent 2d4f6a43
...@@ -5,8 +5,12 @@ from helpers import * ...@@ -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
return open(fullname, 'rb').read() for d in path:
fullname = os.path.join(d, name)
if os.path.exists(fullname):
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):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment