aboutsummaryrefslogtreecommitdiff
path: root/tools/edit_monitor/edit_monitor.py
diff options
context:
space:
mode:
authormosimchah <mosimchah@gmail.com>2025-12-02 09:26:21 -0500
committermosimchah <mosimchah@gmail.com>2025-12-02 09:26:21 -0500
commit278dd9b39c5a3de6320e17d3dd1d10bf447bcc49 (patch)
tree333c700c958401ad1ef3446d93eee54dac639cfa /tools/edit_monitor/edit_monitor.py
parent9b9f43f3305e3304678676813d1fd5945a5f40bf (diff)
parent00fcf469ba572bbce3f7c81fb346cccdbfa04219 (diff)
Merge branch 'lineage-23.1' of https://github.com/LineageOS/android_build into HEADw16.1
* 'lineage-23.1' of https://github.com/LineageOS/android_build: (415 commits) Exclude perf-setup-sh from userdebug builds Reapply "Drop legacy vboot support." Revert "build: Enable super image build rules depending on single super block device" Version bump to BP3A.250905.014 [core/build_id.mk] Version bump to BP3A.250905.013 [core/build_id.mk] Version bump to BP3A.250905.012 [core/build_id.mk] Version bump to BP3A.250905.011 [core/build_id.mk] Version bump to BP3A.250905.007.W1 [core/build_id.mk] Version bump to BP3A.250905.005.X5 [core/build_id.mk] Add apexd.mainline_patch_level_2 to PRODUCT_PACKAGES Version bump to BP3A.250905.009 [core/build_id.mk] Version bump to BP3A.250905.008 [core/build_id.mk] Version bump to BP3A.250905.005.X4 [core/build_id.mk] Version bump to BP3A.250905.005.Y1 [core/build_id.mk] Version bump to BP3A.250905.007 [core/build_id.mk] Version bump to BP3A.250905.005.X3 [core/build_id.mk] Version bump to BP3A.250905.005.X2 [core/build_id.mk] Version bump to BP3A.250905.005.X1 [core/build_id.mk] Version bump to BP3A.250905.006 [core/build_id.mk] Version bump to BP3A.250905.005 [core/build_id.mk] ... Change-Id: I84161b0f013eb40002a433053b9383240274e9ea
Diffstat (limited to 'tools/edit_monitor/edit_monitor.py')
-rw-r--r--tools/edit_monitor/edit_monitor.py28
1 files changed, 23 insertions, 5 deletions
diff --git a/tools/edit_monitor/edit_monitor.py b/tools/edit_monitor/edit_monitor.py
index ab528e870f..3a3db332ad 100644
--- a/tools/edit_monitor/edit_monitor.py
+++ b/tools/edit_monitor/edit_monitor.py
@@ -46,7 +46,6 @@ class ClearcutEventHandler(PatternMatchingEventHandler):
is_dry_run: bool = False,
cclient: clearcut_client.Clearcut | None = None,
):
-
super().__init__(patterns=["*"], ignore_directories=True)
self.root_monitoring_path = path
self.flush_interval_sec = flush_interval_sec
@@ -74,6 +73,10 @@ class ClearcutEventHandler(PatternMatchingEventHandler):
def on_modified(self, event: FileSystemEvent):
self._log_edit_event(event, edit_event_pb2.EditEvent.MODIFY)
+ def dispatch(self, event: FileSystemEvent) -> None:
+ if event.event_type in ("moved", "created", "deleted", "modified"):
+ super().dispatch(event)
+
def flushall(self):
logging.info("flushing all pending events.")
if self._scheduled_log_thread:
@@ -110,7 +113,7 @@ class ClearcutEventHandler(PatternMatchingEventHandler):
)
event_proto.single_edit_event.CopyFrom(
edit_event_pb2.EditEvent.SingleEditEvent(
- file_path=event.src_path, edit_type=edit_type
+ edit_type=edit_type
)
)
with self._pending_events_lock:
@@ -199,11 +202,26 @@ def start(
conn: the sender of the pipe to communicate with the deamon manager.
"""
event_handler = ClearcutEventHandler(
- path, flush_interval_sec, single_events_size_threshold, is_dry_run, cclient)
+ path,
+ flush_interval_sec,
+ single_events_size_threshold,
+ is_dry_run,
+ cclient,
+ )
observer = Observer()
- logging.info("Starting observer on path %s.", path)
- observer.schedule(event_handler, path, recursive=True)
+ out_dir = os.environ.get("OUT_DIR", "out")
+ sub_dirs = [
+ os.path.join(path, name)
+ for name in os.listdir(path)
+ if name != out_dir
+ and not name.startswith(".")
+ and os.path.isdir(os.path.join(path, name))
+ ]
+ for sub_dir_name in sub_dirs:
+ logging.info("Starting observer on path %s.", sub_dir_name)
+ observer.schedule(event_handler, sub_dir_name, recursive=True)
+
observer.start()
logging.info("Observer started.")
if pipe_sender: