From c8d05b2789611e28d2426e3a50e301e29d67d115 Mon Sep 17 00:00:00 2001 From: Oleg Broytman Date: Sun, 29 Jun 2014 20:58:44 +0400 Subject: [PATCH] Pass subproc parameter to the subprocess to allow different robots --- Robots/bkmk_rforking.py | 9 +++++++++ Robots/bkmk_rforking_sub.py | 6 +++--- doc/ANNOUNCE | 3 +++ doc/ChangeLog | 2 ++ 4 files changed, 17 insertions(+), 3 deletions(-) diff --git a/Robots/bkmk_rforking.py b/Robots/bkmk_rforking.py index 6ca35ef..e1b4ee2 100644 --- a/Robots/bkmk_rforking.py +++ b/Robots/bkmk_rforking.py @@ -44,8 +44,17 @@ def restart_subp(log): subp_pipe = RecordFile(check_subp) +_set_subproc = True + class robot_forking(Robot): + subproc = 'urllib' # Default subprocess + def check_url(self, bookmark): + global _set_subproc + if _set_subproc: + _set_subproc = False + os.environ['BKMK_ROBOT'] = self.subproc + if not check_subp: restart_subp(self.log) # Not restart, just start afresh diff --git a/Robots/bkmk_rforking_sub.py b/Robots/bkmk_rforking_sub.py index 73956e2..7dd1f5f 100755 --- a/Robots/bkmk_rforking_sub.py +++ b/Robots/bkmk_rforking_sub.py @@ -14,7 +14,7 @@ __all__ = [] import sys, os -lib_dir = os.path.normpath(os.path.dirname(sys.argv[0]) + os.sep + os.pardir) +lib_dir = os.path.normpath(os.path.join(os.path.dirname(sys.argv[0]), os.pardir)) sys.path.append(lib_dir) # for bkmk_objects.py try: @@ -32,8 +32,8 @@ def run(): from m_lib.flog import openlog log = openlog("check2.log") - from bkmk_rurllib import robot_urllib - robot = robot_urllib(log) + from robots import robot + robot = robot(log) while 1: bookmark = pickle.loads(bkmk_in.read_record()) diff --git a/doc/ANNOUNCE b/doc/ANNOUNCE index 8e06cdd..76f6f42 100644 --- a/doc/ANNOUNCE +++ b/doc/ANNOUNCE @@ -23,6 +23,8 @@ WHAT'S NEW in version 4.6.0 (2014-06-??) BKMK_ROBOT=forking:subproc=urllib or BKMK_STORAGE=json:filename=bookmarks_db.json. + Pass subproc parameter to the subprocess to allow different robots. + WHERE TO GET Home page: http://phdru.name/Software/Python/#bookmarks_db @@ -31,6 +33,7 @@ WHERE TO GET Requires: Python 2.5+, m_lib 2.0+. + AUTHOR Oleg Broytman diff --git a/doc/ChangeLog b/doc/ChangeLog index 8919e53..cc441e7 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -15,6 +15,8 @@ WHAT'S NEW in version 4.6.0 (2014-06-??) BKMK_ROBOT=forking:subproc=urllib or BKMK_STORAGE=json:filename=bookmarks_db.json. + Pass subproc parameter to the subprocess to allow different robots. + WHAT'S NEW in version 4.5.6 (2014-01-14) -- 2.39.5