[projects/git-slug: 68/170] Enable python plugins for hooks

glen glen at pld-linux.org
Mon Sep 21 21:44:31 CEST 2015


commit 88760955d8af8a812745499727ee1f89305ff8d2
Author: Kacper Kornet <draenog at pld-linux.org>
Date:   Thu Dec 15 04:12:37 2011 +0000

    Enable python plugins for hooks

 post-receive | 6 ++++++
 1 file changed, 6 insertions(+)
---
diff --git a/post-receive b/post-receive
index 9e1b8b4..c742246 100755
--- a/post-receive
+++ b/post-receive
@@ -1,6 +1,8 @@
 #!/usr/bin/python3 -u
 
 import fcntl
+import glob
+import imp
 import os
 import tempfile
 import sys
@@ -24,6 +26,10 @@ if (os.path.isdir('hooks/post-receive.d')):
             hook_process.stdin.write(line.encode('utf-8'))
         hook_process.communicate()
 
+for pluginfile in glob.glob('hooks/post-receive.python.d/*.py'):
+    plugin = imp.load_source(os.path.basename(pluginfile), pluginfile)
+    plugin.run(data)
+
 gitrepo = os.environ.get('GL_REPO')
 if gitrepo.startswith('packages/'):
     gitrepo = gitrepo[len('packages/'):]
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/projects/git-slug.git/commitdiff/4ed64f73960519a2f4fd04c42950b2c96ae795c5



More information about the pld-cvs-commit mailing list