[tor-commits] [ooni-probe/master] * Moved /bin/oonicli back to /bin/ooniprobe, and the script to start the old

isis at torproject.org isis at torproject.org
Fri Oct 12 00:23:54 UTC 2012


commit 80ee58aeffafd75f7f13180045feece471e75217
Author: Isis Lovecruft <isis at torproject.org>
Date:   Fri Oct 12 00:12:11 2012 +0000

    * Moved /bin/oonicli back to /bin/ooniprobe, and the script to start the old
      ooniprobe.py is now at /bin/old_ooniprobe. It seems less confusing that way.
---
 bin/oonicli   |   28 -----------------
 bin/ooniprobe |   94 +++++++++++++--------------------------------------------
 2 files changed, 21 insertions(+), 101 deletions(-)

diff --git a/bin/oonicli b/bin/oonicli
deleted file mode 100755
index 1e73c85..0000000
--- a/bin/oonicli
+++ /dev/null
@@ -1,28 +0,0 @@
-#!/usr/bin/env python
-# -*- encoding: utf-8 -*-
-###############################################################################
-#
-# oonicli
-# -----------------------
-#
-# Run the Twisted Trial (unittest module) based oonicli. Startup script based 
-# on twisted trial, see http://twistedmatrix.com/ .
-#
-# :authors: Arturo Filastò
-# :licence: see included LICENSE file
-# :version: 0.0.1-pre-alpha
-###############################################################################
-
-import os, sys
-import copy_reg
-
-# Hack to set the proper sys.path. Overcomes the export PYTHONPATH pain.
-sys.path[:] = map(os.path.abspath, sys.path)
-sys.path.insert(0, os.path.abspath(os.getcwd()))
-
-# This is a hack to overcome a bug in python
-from ooni.utils.hacks import patched_reduce_ex
-copy_reg._reduce_ex = patched_reduce_ex
-
-from ooni.oonicli import run
-run()
diff --git a/bin/ooniprobe b/bin/ooniprobe
index e234587..1e73c85 100755
--- a/bin/ooniprobe
+++ b/bin/ooniprobe
@@ -1,80 +1,28 @@
-#!/bin/bash
-##############################################################################
+#!/usr/bin/env python
+# -*- encoding: utf-8 -*-
+###############################################################################
 #
-# ooniprobe
-# -------------------
-# Setup environment variables and launch /ooni/ooniprobe.py without 
-# installing.
+# oonicli
+# -----------------------
 #
-#-----------------------------------------------------------------------------
-# :authors: Isis Lovecruft, Arturo Filasto
-# :license: see included LICENSE file
-# :version: 0.0.1-pre-alpha
+# Run the Twisted Trial (unittest module) based oonicli. Startup script based 
+# on twisted trial, see http://twistedmatrix.com/ .
 #
-##############################################################################
-
-OONI_EXEC="ooniprobe.py"
-#OONI_EXEC="oonicli.py"
-OONI_PROCESS_NAME=$(echo $OONI_EXEC | sed s/\.py//)
-
-OONI_SCRIPT_IS_HERE=$(dirname ${BASH_SOURCE[0]})
-OONI_BIN="$(cd $OONI_SCRIPT_IS_HERE && pwd)"
-OONI_REPO="$(cd $OONI_BIN"/.." && pwd)"
-OONI_DIR="$OONI_REPO/ooni"
-
-OONI_PATH_ALREADY_SET=false
-
-function usage() {
-    echo "$0 - A simple wrapper around ooniprobe and oonicli to set"
-    echo "up environment variables, so that it can be run without installation."
-    echo;
-    echo "Usage: $0 [oonitest || file || script] [options]"
-    echo "All options and parameters are passed directly to ooniprobe, do"
-    echo "ooniprobe.py --help to see more."
-    echo;
-}
-
-function check_pythonpath_for_ooni() {
-    pythonpaths="$(echo $PYTHONPATH | cut -d ':' -f '1-' --output-delimiter=' ')"
-    for dir in $pythonpaths; do
-        if [[ "x$dir" == "x$OONI_REPO" ]]; then
-            export OONI_PATH_ALREADY_SET=true
-        else
-            continue
-        fi
-    done
-}
+# :authors: Arturo Filastò
+# :licence: see included LICENSE file
+# :version: 0.0.1-pre-alpha
+###############################################################################
 
-function add_ooni_to_pythonpath() {
-    if test ! $OONI_PATH_ALREADY_SET ; then
-        echo "Appending $OONI_REPO to PYTHONPATH..."
-        export PYTHONPATH=$PYTHONPATH:$OONI_REPO
-    fi
-}
+import os, sys
+import copy_reg
 
-function add_exec_dir_to_stack() {
-    cwd_ending=$(echo $(pwd) | awk -F/ '{print $NF}')
-    if [[ "x$cwd_ending" == "xooni" ]]; then
-        pushd $(pwd) 2&>/dev/null       ## $(dirs -l -p -1)    
-    else
-        pushd $OONI_DIR 2&>/dev/null
-    fi
-    export OONI_RUN_PATH="$(popd)/$OONI_EXEC"
-}
+# Hack to set the proper sys.path. Overcomes the export PYTHONPATH pain.
+sys.path[:] = map(os.path.abspath, sys.path)
+sys.path.insert(0, os.path.abspath(os.getcwd()))
 
-function run_ooni_in_background() {
-    ## :param $1: 
-    ##     The full path to the script to run, i.e. $OONI_RUN_PATH.   
-    coproc $1
-}
+# This is a hack to overcome a bug in python
+from ooni.utils.hacks import patched_reduce_ex
+copy_reg._reduce_ex = patched_reduce_ex
 
-if [[ "x$#" == "x0" ]]; then
-    usage
-else 
-    check_pythonpath_for_ooni
-    add_ooni_to_pythonpath
-    add_exec_dir_to_stack
-    OONI_START_CMD="python "$OONI_DIR"/"$OONI_EXEC" $@"
-    #run_ooni_in_background $OONI_START_CMD
-    $($OONI_START_CMD)
-fi
+from ooni.oonicli import run
+run()



More information about the tor-commits mailing list