From de2de4de02af94eeca0d4469b800fc4340d7dcb7 Mon Sep 17 00:00:00 2001 From: Michał Górny Date: Thu, 26 Oct 2017 16:40:21 +0200 Subject: Move throw_exception() to gemato.util --- gemato/recursiveloader.py | 10 +--------- gemato/util.py | 8 ++++++++ 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/gemato/recursiveloader.py b/gemato/recursiveloader.py index 1b4fd14..dac43d7 100644 --- a/gemato/recursiveloader.py +++ b/gemato/recursiveloader.py @@ -11,14 +11,6 @@ import gemato.util import gemato.verify -def throw_exception(e): - """ - Raise the given exception. Needed for onerror= argument - to os.walk(). - """ - raise e - - class ManifestRecursiveLoader(object): """ A class encapsulating a tree covered by multiple Manifests. @@ -223,7 +215,7 @@ class ManifestRecursiveLoader(object): entry_dict = self.get_file_entry_dict(path) it = os.walk(os.path.join(self.root_directory, path), - onerror=throw_exception, + onerror=gemato.util.throw_exception, followlinks=True) for dirpath, dirnames, filenames in it: diff --git a/gemato/util.py b/gemato/util.py index e136c5c..0f790ce 100644 --- a/gemato/util.py +++ b/gemato/util.py @@ -19,3 +19,11 @@ def path_inside_dir(path, directory): """ return ((directory == "" and path != "") or path.rstrip("/").startswith(directory.rstrip("/") + "/")) + + +def throw_exception(e): + """ + Raise the given exception. Needed for onerror= argument + to os.walk(). Useful for other callbacks. + """ + raise e -- cgit v1.2.3