[Pkg-privacy-commits] [obfsproxy] 156/353: Move compatibility hack to the registred entry point

Ximin Luo infinity0 at moszumanska.debian.org
Sat Aug 22 13:01:53 UTC 2015


This is an automated email from the git hooks/post-receive script.

infinity0 pushed a commit to branch master
in repository obfsproxy.

commit 16a1fc92291eeb90cfb060f2d3d60b244dc7b78a
Author: Jérémy Bobbio <lunar at debian.org>
Date:   Thu Apr 11 09:36:54 2013 +0000

    Move compatibility hack to the registred entry point
    
    The /usr/bin/obfsproxy file is actually written by setuptools and runs the
    registred entry point. That is where we need to put the compatibility hack with
    C-obfsproxy, otherwise it will simply disappear.
---
 bin/obfsproxy            | 12 ------------
 obfsproxy/pyobfsproxy.py | 13 +++++++++++++
 2 files changed, 13 insertions(+), 12 deletions(-)

diff --git a/bin/obfsproxy b/bin/obfsproxy
index cc67781..a716b18 100755
--- a/bin/obfsproxy
+++ b/bin/obfsproxy
@@ -8,18 +8,6 @@ path_to_project_root = os.path.abspath(os.path.join(dir_of_executable, '..'))
 
 sys.path.insert(0, path_to_project_root)
 
-# Pyobfsproxy's CLI uses "managed" whereas C-obfsproxy uses
-# "--managed" to configure managed-mode. Python obfsproxy can't
-# recognize "--managed" because it uses argparse subparsers and
-# http://bugs.python.org/issue9253 is not yet solved. This is a crazy
-# hack to maintain CLI compatibility between the two versions. we
-# basically inplace replace "--managed" with "managed" in the argument
-# list.
-if len(sys.argv) > 1 and '--managed' in sys.argv:
-    for n, arg in enumerate(sys.argv):
-        if arg == '--managed':
-            sys.argv[n] = 'managed'
-
 from obfsproxy.pyobfsproxy import run
 run()
 
diff --git a/obfsproxy/pyobfsproxy.py b/obfsproxy/pyobfsproxy.py
index 92663d5..05214bb 100755
--- a/obfsproxy/pyobfsproxy.py
+++ b/obfsproxy/pyobfsproxy.py
@@ -134,6 +134,19 @@ def pyobfsproxy():
 
 def run():
     """Fake entry-point so that we can log unhandled exceptions."""
+
+    # Pyobfsproxy's CLI uses "managed" whereas C-obfsproxy uses
+    # "--managed" to configure managed-mode. Python obfsproxy can't
+    # recognize "--managed" because it uses argparse subparsers and
+    # http://bugs.python.org/issue9253 is not yet solved. This is a crazy
+    # hack to maintain CLI compatibility between the two versions. we
+    # basically inplace replace "--managed" with "managed" in the argument
+    # list.
+    if len(sys.argv) > 1 and '--managed' in sys.argv:
+        for n, arg in enumerate(sys.argv):
+            if arg == '--managed':
+                sys.argv[n] = 'managed'
+
     try:
         pyobfsproxy()
     except Exception, e:

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-privacy/packages/obfsproxy.git



More information about the Pkg-privacy-commits mailing list