Gentoo Archives: gentoo-catalyst

From: Dylan Baker <baker.dylan.c@×××××.com>
To: gentoo-catalyst@l.g.o
Cc: Dylan Baker <baker.dylan.c@×××××.com>
Subject: [gentoo-catalyst] [PATCH 2/4] Catalyst: use a more pythonic method to import modules
Date: Fri, 11 Oct 2013 17:38:56
Message-Id: 1381513107-17483-2-git-send-email-baker.dylan.c@gmail.com
In Reply to: [gentoo-catalyst] [PATCH 1/4] catalyst: Specify python2 rather than the generic python by Dylan Baker
1 Rather than appending a directory to the system path, this patch adds a
2 __init__.py file to modules, which allows python to search it, and it's
3 children for python modules. This with the import...as syntax allows for
4 a cleaner import of python modules without changing any other parts of
5 the catalyst file.
6 ---
7 catalyst | 8 ++------
8 modules/__init__.py | 0
9 2 files changed, 2 insertions(+), 6 deletions(-)
10 create mode 100644 modules/__init__.py
11
12 diff --git a/catalyst b/catalyst
13 index 11560fb..be1548f 100755
14 --- a/catalyst
15 +++ b/catalyst
16 @@ -11,12 +11,8 @@ import os, sys, imp, string, getopt
17 import pdb
18 import os.path
19
20 -__selfpath__ = os.path.abspath(os.path.dirname(__file__))
21 -
22 -sys.path.append(__selfpath__ + "/modules")
23 -
24 -import catalyst.config
25 -import catalyst.util
26 +import modules.catalyst.config as catalyst.config
27 +import modules.catalyst.util as catalyst.util
28
29 __maintainer__="Catalyst <catalyst@g.o>"
30 __version__="2.0.14"
31 diff --git a/modules/__init__.py b/modules/__init__.py
32 new file mode 100644
33 index 0000000..e69de29
34 --
35 1.8.1.5

Replies

Subject Author
[gentoo-catalyst] Re: [PATCH 2/4] Catalyst: use a more pythonic method to import modules Dylan Baker <baker.dylan.c@×××××.com>