Gentoo Archives: gentoo-catalyst

From: Dylan Baker <baker.dylan.c@×××××.com>
To: gentoo-catalyst@l.g.o
Subject: [gentoo-catalyst] Re: [PATCH 2/4] Catalyst: use a more pythonic method to import modules
Date: Fri, 11 Oct 2013 18:00:51
Message-Id: 5694571.TRnE19jLVX@moiraine
In Reply to: [gentoo-catalyst] [PATCH 2/4] Catalyst: use a more pythonic method to import modules by Dylan Baker
1 On Friday, October 11, 2013 10:38:25 AM Dylan Baker wrote:
2 > Rather than appending a directory to the system path, this patch adds a
3 > __init__.py file to modules, which allows python to search it, and it's
4 > children for python modules. This with the import...as syntax allows for
5 > a cleaner import of python modules without changing any other parts of
6 > the catalyst file.
7 > ---
8 > catalyst | 8 ++------
9 > modules/__init__.py | 0
10 > 2 files changed, 2 insertions(+), 6 deletions(-)
11 > create mode 100644 modules/__init__.py
12 >
13 > diff --git a/catalyst b/catalyst
14 > index 11560fb..be1548f 100755
15 > --- a/catalyst
16 > +++ b/catalyst
17 > @@ -11,12 +11,8 @@ import os, sys, imp, string, getopt
18 > import pdb
19 > import os.path
20 >
21 > -__selfpath__ = os.path.abspath(os.path.dirname(__file__))
22 > -
23 > -sys.path.append(__selfpath__ + "/modules")
24 > -
25 > -import catalyst.config
26 > -import catalyst.util
27 > +import modules.catalyst.config as catalyst.config
28 > +import modules.catalyst.util as catalyst.util
29 >
30 > __maintainer__="Catalyst <catalyst@g.o>"
31 > __version__="2.0.14"
32 > diff --git a/modules/__init__.py b/modules/__init__.py
33 > new file mode 100644
34 > index 0000000..e69de29
35
36 Have you ever wondered why you had patches sitting in a branch for months
37 without sending them to the list? It's probably because one in the middle
38 doesn't work :(. That happens to be this one.
39
40 Expect a v2 with this patch fixed.

Attachments

File name MIME type
signature.asc application/pgp-signature