Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/scripts/dn-build
diff options
context:
space:
mode:
authorDaniel Narvaez <dwnarvaez@gmail.com>2012-11-12 12:54:26 (GMT)
committer Daniel Narvaez <dwnarvaez@gmail.com>2012-11-12 12:54:26 (GMT)
commit225625bcf34c80b3c6b7c80ca8f1360451a417b9 (patch)
tree80b0736c70983e82f6dd478e61cb8f7fefad74e6 /scripts/dn-build
parent21c7eb5927e4fa3d7585d68ae55f3d26a98422e6 (diff)
Build activities with a custom script
It should be faster and cleaner than the sugar-fructose hack. Eventually dn-build might replace jhbuild. We don't really need all that complexity.
Diffstat (limited to 'scripts/dn-build')
-rwxr-xr-xscripts/dn-build51
1 files changed, 51 insertions, 0 deletions
diff --git a/scripts/dn-build b/scripts/dn-build
new file mode 100755
index 0000000..abee345
--- /dev/null
+++ b/scripts/dn-build
@@ -0,0 +1,51 @@
+#!/usr/bin/python
+
+import json
+import os
+import sys
+import subprocess
+
+scripts_dir = os.path.abspath(os.path.dirname(__file__))
+base_dir = os.path.dirname(scripts_dir)
+install_dir = os.path.join(base_dir, "install")
+source_dir = os.path.join(base_dir, "source")
+activities_dir = os.path.join(source_dir, "activities")
+modules_dir = os.path.join(scripts_dir, "modules")
+
+def get_module_dir(module):
+ return os.path.join(activities_dir, module["name"])
+
+def pull_source(module):
+ if not os.path.exists(activities_dir):
+ os.mkdir(activities_dir)
+
+ module_dir = get_module_dir(module)
+
+ if os.path.exists(module_dir):
+ os.chdir(module_dir)
+ subprocess.check_call(["git", "pull"])
+ else:
+ os.chdir(activities_dir)
+ subprocess.check_call(["git", "clone", module["repo"], module["name"]])
+ os.chdir(module_dir)
+
+ branch = module.get("branch", "master")
+ subprocess.check_call(["git", "checkout", branch])
+
+def build(module):
+ os.chdir(get_module_dir(module))
+ subprocess.check_call(["./setup.py", "install", "--prefix", install_dir])
+
+def main():
+ modules = json.load(open(os.path.join(modules_dir, "activities.json")))
+
+ for module in modules:
+ print "\n=== Building %s ===\n" % module["name"]
+
+ try:
+ pull_source(module)
+ build(module)
+ except subprocess.CalledProcessError:
+ sys.exit(1)
+
+main()