summaryrefslogtreecommitdiff
path: root/bootstrap.py
diff options
context:
space:
mode:
authorScott <[email protected]>2022-01-10 09:45:31 -0800
committerScott <[email protected]>2022-01-10 09:45:31 -0800
commit44a7740bf6fe18673f8636658256a227e0622880 (patch)
tree39b8906f9b60dcd8b02a310a7fb32f3a0af3b92a /bootstrap.py
parent287360114f0a9d61d5dc3c3f168344df856ffbd5 (diff)
Experiment with audit events in bootstrap.
Diffstat (limited to 'bootstrap.py')
-rw-r--r--bootstrap.py31
1 files changed, 18 insertions, 13 deletions
diff --git a/bootstrap.py b/bootstrap.py
index 7ed8b40..c445aef 100644
--- a/bootstrap.py
+++ b/bootstrap.py
@@ -141,10 +141,16 @@ class ImportInterceptor(object):
return []
-# TODO: test this with python 3.8+
-def audit_import_events(event, args):
- print(event)
- print(args)
+# # TODO: test this with python 3.8+
+# def audit_import_events(event, args):
+# if event == 'import':
+# module = args[0]
+# filename = args[1]
+# sys_path = args[2]
+# sys_meta_path = args[3]
+# sys_path_hooks = args[4]
+# logger.debug(msg)
+# print(msg)
# Audit import events? Note: this runs early in the lifetime of the
@@ -158,15 +164,14 @@ def audit_import_events(event, args):
import_interceptor = None
for arg in sys.argv:
if arg == '--audit_import_events':
- if not hasattr(sys, 'frozen'):
- if (
- sys.version_info[0] == 3
- and sys.version_info[1] < 8
- ):
- import_interceptor = ImportInterceptor()
- sys.meta_path = [import_interceptor] + sys.meta_path
- else:
- sys.addaudithook(audit_import_events)
+ import_interceptor = ImportInterceptor()
+ sys.meta_path = [import_interceptor] + sys.meta_path
+ # if not hasattr(sys, 'frozen'):
+ # if (
+ # sys.version_info[0] == 3
+ # and sys.version_info[1] >= 8
+ # ):
+ # sys.addaudithook(audit_import_events)
def dump_all_objects() -> None: