From f21a7d33a28f250c4bc920588190e2a206232a25 Mon Sep 17 00:00:00 2001 From: Skia Date: Tue, 28 May 2019 10:27:51 +0200 Subject: [PATCH 1/2] Add a __main__.py file for invocation as a module This file allows an easy invocation of websockify as a module, which is handy when running into shebang issues (https://github.com/pypa/virtualenv/issues/596). With this patch, `python -m websockify ...` has just the same behavior as `./run ...`. --- websockify/__main__.py | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 websockify/__main__.py diff --git a/websockify/__main__.py b/websockify/__main__.py new file mode 100644 index 0000000..8378d46 --- /dev/null +++ b/websockify/__main__.py @@ -0,0 +1,4 @@ +import websockify + +if __name__ == '__main__': + websockify.websocketproxy.websockify_init() From 4f6a82159ce42299c8666e04f4a4c3d0fe829803 Mon Sep 17 00:00:00 2001 From: Skia Date: Thu, 13 Jun 2019 17:16:55 +0200 Subject: [PATCH 2/2] run: invoke websockify through 'python -m' --- run | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/run b/run index 9ea6996..f43f10c 100755 --- a/run +++ b/run @@ -1,6 +1,7 @@ -#!/usr/bin/env python +#!/usr/bin/env sh -import websockify +BASE_DIR="$(dirname "$(realpath "$0")")" -if __name__ == '__main__': - websockify.websocketproxy.websockify_init() +cd "$BASE_DIR" + +python -m websockify $@