[libvirt PATCH 27/33] ci: helper: Add Python code hangling git clones

Erik Skultety posted 33 patches 2 years, 5 months ago
There is a newer version of this series
[libvirt PATCH 27/33] ci: helper: Add Python code hangling git clones
Posted by Erik Skultety 2 years, 5 months ago
This helper will be utilized by a future patch which will add the
lcitool container execution logic. The reason why the required_deps
decorator isn't being used here is because this is a property.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
---
 ci/helper | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/ci/helper b/ci/helper
index 780f4161f5..2a51ce1786 100755
--- a/ci/helper
+++ b/ci/helper
@@ -174,9 +174,18 @@ class Parser:
 
 
 class Application:
+    @property
+    def repo(self):
+        if self._repo is None:
+            from git import Repo
+
+            self._repo = Repo(search_parent_directories=True)
+        return self._repo
+
     def __init__(self):
         self._basedir = pathlib.Path(__file__).resolve().parent
         self._args = Parser().parse()
+        self._repo = None
 
     def _make_run(self, target):
         args = [
-- 
2.41.0
Re: [libvirt PATCH 27/33] ci: helper: Add Python code hangling git clones
Posted by Daniel P. Berrangé 2 years, 5 months ago
On Fri, Aug 25, 2023 at 07:55:35PM +0200, Erik Skultety wrote:
> This helper will be utilized by a future patch which will add the
> lcitool container execution logic. The reason why the required_deps
> decorator isn't being used here is because this is a property.
> 
> Signed-off-by: Erik Skultety <eskultet@redhat.com>
> ---
>  ci/helper | 9 +++++++++
>  1 file changed, 9 insertions(+)

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>


With regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|