Skip to contentSkip to conversation

data: Drop obsolete pydoc/path code

PATCH New Richard Purdie 1 participant 2 messages Nov 27, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 data: Drop obsolete pydoc/path code

This code looks like it is from a time when the data module was executable. Nobody does that now and this usage of pydoc is long since obsolete/broken so clean up the code which doesn't do anything useful.

---
 lib/bb/data.py | 5 -----
 1 file changed, 5 deletions(-)
lib/bb/data.py +0 -5
index 430d444203..22d314d6c2 100644
@@ -28,11 +28,6 @@ the speed is more critical here.
 
 import sys, os, re
 import hashlib
-if sys.argv[0][-5:] == "pydoc":
-    path = os.path.dirname(os.path.dirname(sys.argv[1]))
-else:
-    path = os.path.dirname(os.path.dirname(sys.argv[0]))
-sys.path.insert(0, path)
 from itertools import groupby
 
 from bb import data_smart
Signature · 1 line
2.34.1
#1 lore raw

PATCH 2/2 BBHandler: Remove pointless global variable declarations

These are static regex compilations which don't change or a standard module import (bb). There is noneed to declare them as global so drop the pointless code which doesn't do anything.

---
 lib/bb/parse/parse_py/BBHandler.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
lib/bb/parse/parse_py/BBHandler.py +2 -2
index 18e6868387..584966fea1 100644
@@ -102,7 +102,7 @@ def get_statements(filename, absolute_filename, base_name):
         return statements
 
 def handle(fn, d, include):
-    global __func_start_regexp__, __inherit_regexp__, __export_func_regexp__, __addtask_regexp__, __addhandler_regexp__, __infunc__, __body__, __residue__, __classname__
+    global __infunc__, __body__, __residue__, __classname__
     __body__ = []
     __infunc__ = []
     __classname__ = ""
@@ -154,7 +154,7 @@ def handle(fn, d, include):
     return d
 
 def feeder(lineno, s, fn, root, statements, eof=False):
-    global __func_start_regexp__, __inherit_regexp__, __export_func_regexp__, __addtask_regexp__, __addhandler_regexp__, __def_regexp__, __python_func_regexp__, __inpython__, __infunc__, __body__, bb, __residue__, __classname__
+    global __inpython__, __infunc__, __body__, __residue__, __classname__
 
     # Check tabs in python functions:
     # - def py_funcname(): covered by __inpython__
Signature · 1 line
2.34.1