Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/commands/auto-install
diff options
context:
space:
mode:
authorDaniel Narvaez <dwnarvaez@gmail.com>2012-11-16 09:07:19 (GMT)
committer Daniel Narvaez <dwnarvaez@gmail.com>2012-11-16 09:07:19 (GMT)
commitcc034825744856b9936a518cef0215d9096a8f98 (patch)
treecdeeccde6ae7865073945394ba7e5ab56651f0c6 /commands/auto-install
parent6b22c805e7fc22be53088897e2a1e17acf77753a (diff)
Port auto-install and send-patches to the new commands scheme
Diffstat (limited to 'commands/auto-install')
-rwxr-xr-xcommands/auto-install45
1 files changed, 45 insertions, 0 deletions
diff --git a/commands/auto-install b/commands/auto-install
new file mode 100755
index 0000000..70cfc72
--- /dev/null
+++ b/commands/auto-install
@@ -0,0 +1,45 @@
+#!/usr/bin/python
+
+from distutils.sysconfig import parse_makefile
+import os
+import shutil
+
+import common
+
+from gi.repository import Gio
+from gi.repository import GLib
+
+from devbot import config
+
+shell_dir = os.path.abspath(os.path.dirname(__file__))
+monitors = []
+
+def install(file):
+ dir = os.path.dirname(file.get_path())
+ relative_path = os.path.relpath(dir, config.source_dir)
+ makefile_path = os.path.join(config.build_dir, relative_path, "Makefile")
+ makefile = parse_makefile(makefile_path)
+
+ for variable in makefile:
+ if variable.endswith("_PYTHON"):
+ dir_variable = "%sdir" % variable.replace("_PYTHON", "")
+ install_dir = makefile[dir_variable]
+ shutil.copy(file.get_path(), install_dir)
+
+def changed_cb(monitor, file, other_file, event_flags):
+ if event_flags == Gio.FileMonitorEvent.CHANGED:
+ if file.get_path().endswith(".py"):
+ install(file)
+
+for root, dirs, files in os.walk(os.getcwd()):
+ for dir in dirs:
+ file = Gio.File.new_for_path(os.path.join(root, dir))
+ monitor = file.monitor(Gio.FileMonitorFlags.NONE, None)
+ monitor.connect("changed", changed_cb)
+
+ monitors.append(monitor)
+
+common.setup()
+
+main_loop = GLib.MainLoop()
+main_loop.run()