commit be700c03fe0b09d95cec08640f1cb78ddd7f7f54 Author: Isis Lovecruft isis@torproject.org Date: Tue Nov 5 08:47:45 2013 +0000
Remove subCommand handling code from scripts/bridgedb.
Also, minimize imports in scripts/bridgedb to precisely what is needed, so as not to risk errors caused by something being imported too early. --- scripts/bridgedb | 32 ++++++++++---------------------- 1 file changed, 10 insertions(+), 22 deletions(-)
diff --git a/scripts/bridgedb b/scripts/bridgedb index e121bd2..7afbed9 100644 --- a/scripts/bridgedb +++ b/scripts/bridgedb @@ -11,33 +11,21 @@
from __future__ import print_function
-import bridgedb -import os +import os.path import sys
-from bridgedb import runner -from bridgedb.parse import options +from os import getcwd
+from bridgedb.Main import run +from bridgedb.parse.options import parseOptions
-option = options.parseOptions() + +option = parseOptions()
if option.subCommand is not None: # Hack to set the PYTHONPATH: sys.path[:] = map(os.path.abspath, sys.path) - sys.path.insert(0, os.path.abspath(os.getcwd())) - sys.path.insert(0, os.path.abspath(os.path.join(os.getcwd(), '../lib'))) - - if 'descriptors' in option.subOptions: - runner.generateDescriptors(option) - - if option.subCommand == 'test': - if option.subOptions['trial']: - runner.runTrial(option.subOptions) - if option.subOptions['unittests']: - runner.runTests(option.subOptions) - sys.exit() - -# If no suboption was given, just run bridgedb: -else: - from bridgedb import Main - Main.run(option) + sys.path.insert(0, os.path.abspath(getcwd())) + sys.path.insert(0, os.path.abspath(os.path.join(getcwd(), '../lib'))) + +run(option)
tor-commits@lists.torproject.org