add ability to specify rebind path

* Also update setup.py for proper bin/websockify path
This commit is contained in:
Anthony Young 2012-05-01 15:15:35 -07:00
parent 96250f8bfc
commit 841bb2f2ba
3 changed files with 10 additions and 9 deletions

View File

@ -37,6 +37,8 @@ def websockify_init():
help="SSL certificate file")
parser.add_option("--key", default=None,
help="SSL key file (if separate from cert)")
parser.add_option("--rebind_path", default="./",
help="Directory containing rebind.so")
parser.add_option("--ssl-only", action="store_true",
help="disallow non-encrypted connections")
parser.add_option("--web", default=None, metavar="DIR",

View File

@ -22,9 +22,5 @@ setup(name=name,
include_package_data=True,
install_requires=['numpy'],
zip_safe=False,
entry_points={
'console_scripts': [
'websockify = websockify:websockify_init',
]
},
scripts=['bin/websockify'],
)

View File

@ -43,16 +43,19 @@ Traffic Legend:
self.target_port = kwargs.pop('target_port')
self.wrap_cmd = kwargs.pop('wrap_cmd')
self.wrap_mode = kwargs.pop('wrap_mode')
self.rebind_path = kwargs.pop('rebind_path')
# Last 3 timestamps command was run
self.wrap_times = [0, 0, 0]
if self.wrap_cmd:
rebinder_path = ['./', os.path.dirname(sys.argv[0]), 'rebind/']
rebinder_path = [self.rebind_path,
self.rebind_path + '/rebind.so',
'./rebind.so',
os.path.dirname(sys.argv[0]) + 'rebind.so',
'rebind/rebind.so']
self.rebinder = None
for rdir in rebinder_path:
rpath = os.path.join(rdir, "rebind.so")
print rpath
for rpath in rebinder_path:
if os.path.exists(rpath):
self.rebinder = rpath
break