From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id 133D71384B4 for ; Sat, 21 Nov 2015 01:34:13 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 6CCF721C024; Sat, 21 Nov 2015 01:33:52 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 3183D21C008 for ; Sat, 21 Nov 2015 01:33:51 +0000 (UTC) Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 78339340AC8 for ; Sat, 21 Nov 2015 01:33:50 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id E0A7215FB for ; Sat, 21 Nov 2015 01:33:45 +0000 (UTC) From: "Brian Dolbec" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Brian Dolbec" Message-ID: <1447904451.16f3af32eb645f3485e9e54b2bb9d128503fa9ce.dolsen@gentoo> Subject: [gentoo-commits] proj/catalyst:pending commit in: bin/ X-VCS-Repository: proj/catalyst X-VCS-Files: bin/catalyst.git X-VCS-Directories: bin/ X-VCS-Committer: dolsen X-VCS-Committer-Name: Brian Dolbec X-VCS-Revision: 16f3af32eb645f3485e9e54b2bb9d128503fa9ce X-VCS-Branch: pending Date: Sat, 21 Nov 2015 01:33:45 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: 60572e96-8c0b-46fb-9ff1-6effea5c1cad X-Archives-Hash: 99f2faa2fe3a0692fdec2cc4ee37ea03 commit: 16f3af32eb645f3485e9e54b2bb9d128503fa9ce Author: Mike Frysinger gentoo org> AuthorDate: Thu Oct 29 00:29:52 2015 +0000 Commit: Brian Dolbec gentoo org> CommitDate: Thu Nov 19 03:40:51 2015 +0000 URL: https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=16f3af32 catalyst: add a wrapper for executing directly out of git This is a smaller wrapper to set up the environment (both python and some config options) so that all the code is used from the git repo. This way you don't have to install it in order to test things. bin/catalyst.git | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/bin/catalyst.git b/bin/catalyst.git new file mode 100755 index 0000000..eb6234b --- /dev/null +++ b/bin/catalyst.git @@ -0,0 +1,52 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# Copyright 1999-2015 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +"""Run catalyst from git using local modules/scripts.""" + +from __future__ import print_function + +import os +import sys +import tempfile + +from snakeoil import process + + +def main(argv): + """The main entry point""" + source_root = os.path.dirname(os.path.dirname(os.path.realpath(__file__))) + + pympath = source_root + pythonpath = os.environ.get('PYTHONPATH') + if pythonpath is None: + pythonpath = pympath + else: + pythonpath = pympath + ':' + pythonpath + os.environ['PYTHONPATH'] = pythonpath + + with tempfile.NamedTemporaryFile(prefix='catalyst.conf.') as conf: + # Set up a config file with paths to the local tree. + conf.write( + ('sharedir=%(source_root)s\n' + 'shdir=%(source_root)s/targets\n' + 'envscript=%(source_root)s/etc/catalystrc\n' + % {'source_root': source_root}).encode('utf8') + ) + conf.flush() + argv = [ + '--config', os.path.join(source_root, 'etc', 'catalyst.conf'), + '--config', conf.name, + ] + argv + + cmd = [os.path.join(source_root, 'bin', 'catalyst')] + pid = os.fork() + if pid == 0: + os.execvp(cmd[0], cmd + argv) + (_pid, status) = os.waitpid(pid, 0) + process.exit_as_status(status) + + +if __name__ == '__main__': + main(sys.argv[1:])