commit: f45e2bb561f2f5d16bdf8f6cd31cc393d2794f92 Author: Zac Medico <zmedico <AT> gentoo <DOT> org> AuthorDate: Wed Oct 4 04:06:49 2023 +0000 Commit: Zac Medico <zmedico <AT> gentoo <DOT> org> CommitDate: Wed Oct 4 04:11:14 2023 +0000 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=f45e2bb5
SyncfsProcess: Migrate to ForkProcess target parameter Bug: https://bugs.gentoo.org/915099 Signed-off-by: Zac Medico <zmedico <AT> gentoo.org> lib/portage/dbapi/_SyncfsProcess.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/lib/portage/dbapi/_SyncfsProcess.py b/lib/portage/dbapi/_SyncfsProcess.py index 6beeac8dd4..ddc2240071 100644 --- a/lib/portage/dbapi/_SyncfsProcess.py +++ b/lib/portage/dbapi/_SyncfsProcess.py @@ -1,6 +1,8 @@ -# Copyright 2012 Gentoo Foundation +# Copyright 2012-2023 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 +import functools + from portage import os from portage.util._ctypes import find_library, LoadLibrary from portage.util._async.ForkProcess import ForkProcess @@ -16,6 +18,10 @@ class SyncfsProcess(ForkProcess): __slots__ = ("paths",) + def _start(self): + self.target = functools.partial(self._target, self._get_syncfs, self.paths) + super()._start() + @staticmethod def _get_syncfs(): filename = find_library("c") @@ -29,12 +35,13 @@ class SyncfsProcess(ForkProcess): return None - def _run(self): + @staticmethod + def _target(get_syncfs, paths): syncfs_failed = False - syncfs = self._get_syncfs() + syncfs = get_syncfs() if syncfs is not None: - for path in self.paths: + for path in paths: try: fd = os.open(path, os.O_RDONLY) except OSError:
