From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <gentoo-catalyst+bounces-2761-garchives=archives.gentoo.org@lists.gentoo.org>
Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80])
	by finch.gentoo.org (Postfix) with ESMTP id 0333D1381F3
	for <garchives@archives.gentoo.org>; Fri, 11 Oct 2013 17:38:56 +0000 (UTC)
Received: from pigeon.gentoo.org (localhost [127.0.0.1])
	by pigeon.gentoo.org (Postfix) with SMTP id 81644E0966;
	Fri, 11 Oct 2013 17:38:55 +0000 (UTC)
Received: from mail-pd0-f172.google.com (mail-pd0-f172.google.com [209.85.192.172])
	(using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits))
	(No client certificate requested)
	by pigeon.gentoo.org (Postfix) with ESMTPS id 01186E0966
	for <gentoo-catalyst@lists.gentoo.org>; Fri, 11 Oct 2013 17:38:54 +0000 (UTC)
Received: by mail-pd0-f172.google.com with SMTP id z10so4563920pdj.3
        for <gentoo-catalyst@lists.gentoo.org>; Fri, 11 Oct 2013 10:38:53 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20120113;
        h=from:to:cc:subject:date:message-id:in-reply-to:references;
        bh=WvtzxdabblZuJb/hq4ygf8aS/T+XhTlxZmo/1JAjZFA=;
        b=oZhBppJDv+6VNqaq32aS7fLoAZFQmOaWGicun/gZf5sx23WWyQY0gxz+DcLMocLdJB
         cly1w/reQUUHon1/+z4YDtO1CW550YxpSqK8FrD57Ygr/NjxEdiVcU705jy3zkl4uMnW
         p17Adi/95tlHuWoS9DJz2TmB9RFBepsH6O5jlhiMlx5FImkUe3w6foYgG2+P3GRXiDqK
         ax7S1XkHA8ft8QUqSyEPbquAQr7RgTJzF7PH/z8CJBWaBCWW0/aLVI3m9z15/JxU1qka
         WZbNfCprAYO8llRNQzqsrGF2AbdxVlqr+MH39NxZ7JtGchjV3REHJgvZ0M+CsN+Q+z1j
         vVkg==
X-Received: by 10.67.22.67 with SMTP id hq3mr22986881pad.132.1381513133784;
        Fri, 11 Oct 2013 10:38:53 -0700 (PDT)
Received: from localhost.localdomain (75-92-167-159.war.clearwire-wmx.net. [75.92.167.159])
        by mx.google.com with ESMTPSA id gg10sm61128484pbc.46.1969.12.31.16.00.00
        (version=TLSv1.2 cipher=RC4-SHA bits=128/128);
        Fri, 11 Oct 2013 10:38:53 -0700 (PDT)
From: Dylan Baker <baker.dylan.c@gmail.com>
To: gentoo-catalyst@lists.gentoo.org
Cc: Dylan Baker <baker.dylan.c@gmail.com>
Subject: [gentoo-catalyst] [PATCH 2/4] Catalyst: use a more pythonic method to import modules
Date: Fri, 11 Oct 2013 10:38:25 -0700
Message-Id: <1381513107-17483-2-git-send-email-baker.dylan.c@gmail.com>
X-Mailer: git-send-email 1.8.1.5
In-Reply-To: <1381513107-17483-1-git-send-email-baker.dylan.c@gmail.com>
References: <1381513107-17483-1-git-send-email-baker.dylan.c@gmail.com>
Precedence: bulk
List-Post: <mailto:gentoo-catalyst@lists.gentoo.org>
List-Help: <mailto:gentoo-catalyst+help@lists.gentoo.org>
List-Unsubscribe: <mailto:gentoo-catalyst+unsubscribe@lists.gentoo.org>
List-Subscribe: <mailto:gentoo-catalyst+subscribe@lists.gentoo.org>
List-Id: Gentoo Linux mail <gentoo-catalyst.gentoo.org>
X-BeenThere: gentoo-catalyst@lists.gentoo.org
Reply-to: gentoo-catalyst@lists.gentoo.org
X-Archives-Salt: d30f54ac-7447-4e97-b603-687a67ca05cb
X-Archives-Hash: 6c8c28592a13be7ef7b68a04d37fd67a

Rather than appending a directory to the system path, this patch adds a
__init__.py file to modules, which allows python to search it, and it's
children for python modules. This with the import...as syntax allows for
a cleaner import of python modules without changing any other parts of
the catalyst file.
---
 catalyst            | 8 ++------
 modules/__init__.py | 0
 2 files changed, 2 insertions(+), 6 deletions(-)
 create mode 100644 modules/__init__.py

diff --git a/catalyst b/catalyst
index 11560fb..be1548f 100755
--- a/catalyst
+++ b/catalyst
@@ -11,12 +11,8 @@ import os, sys, imp, string, getopt
 import pdb
 import os.path
 
-__selfpath__ = os.path.abspath(os.path.dirname(__file__))
-
-sys.path.append(__selfpath__ + "/modules")
-
-import catalyst.config
-import catalyst.util
+import modules.catalyst.config as catalyst.config
+import modules.catalyst.util as catalyst.util
 
 __maintainer__="Catalyst <catalyst@gentoo.org>"
 __version__="2.0.14"
diff --git a/modules/__init__.py b/modules/__init__.py
new file mode 100644
index 0000000..e69de29
-- 
1.8.1.5