diff options
author | Michał Górny <mgorny@gentoo.org> | 2017-10-26 16:40:21 +0200 |
---|---|---|
committer | Michał Górny <mgorny@gentoo.org> | 2017-10-26 16:40:21 +0200 |
commit | de2de4de02af94eeca0d4469b800fc4340d7dcb7 (patch) | |
tree | 8f845189e21864951a8a67f0508ca5eeac045e16 | |
parent | 5460f2c432ec0baae1757917ff12e8a105bc4900 (diff) | |
download | gemato-de2de4de02af94eeca0d4469b800fc4340d7dcb7.tar.gz |
Move throw_exception() to gemato.util
-rw-r--r-- | gemato/recursiveloader.py | 10 | ||||
-rw-r--r-- | 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 |