From cc034825744856b9936a518cef0215d9096a8f98 Mon Sep 17 00:00:00 2001 From: Daniel Narvaez Date: Fri, 16 Nov 2012 09:07:19 +0000 Subject: Port auto-install and send-patches to the new commands scheme --- diff --git a/scripts/shell/auto-install b/commands/auto-install index 327d46d..70cfc72 100755 --- a/scripts/shell/auto-install +++ b/commands/auto-install @@ -4,21 +4,20 @@ from distutils.sysconfig import parse_makefile import os import shutil +import common + from gi.repository import Gio from gi.repository import GLib -shell_dir = os.path.abspath(os.path.dirname(__file__)) -scripts_dir = os.path.dirname(shell_dir) -root_dir = os.path.dirname(scripts_dir) -source_dir = os.path.join(root_dir, "source") -build_dir = os.path.join(root_dir, "build") +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, source_dir) - makefile_path = os.path.join(build_dir, relative_path, "Makefile") + 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: @@ -40,5 +39,7 @@ for root, dirs, files in os.walk(os.getcwd()): monitors.append(monitor) +common.setup() + main_loop = GLib.MainLoop() main_loop.run() diff --git a/scripts/shell/send-patches b/commands/send-patches index d420357..bea7f79 100755 --- a/scripts/shell/send-patches +++ b/commands/send-patches @@ -6,12 +6,11 @@ import re import subprocess import sys -GIT_CONFIG_SETUP = "sugar-build.send-patches.setup" +import common + +from devbot import config -shell_dir = os.path.abspath(os.path.dirname(__file__)) -scripts_dir = os.path.dirname(shell_dir) -root_dir = os.path.dirname(scripts_dir) -source_dir = os.path.join(root_dir, "source") +GIT_CONFIG_SETUP = "sugar-build.send-patches.setup" def get_git_config(name, is_global=False): args = ["git", "config"] @@ -89,7 +88,9 @@ def setup(): set_git_config(GIT_CONFIG_SETUP, "true") -if os.path.dirname(os.getcwd()) != source_dir: +common.setup() + +if os.path.dirname(os.getcwd()) != config.source_dir: print "The command must be run inside one of the source modules." sys.exit(1) -- cgit v0.9.1