Gentoo Archives: gentoo-commits

From: Brian Dolbec <brian.dolbec@×××××.com>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/portage:plugin-sync commit in: pym/portage/emaint/, pym/portage/sync/, pym/portage/
Date: Tue, 30 Sep 2014 00:47:08
Message-Id: 1412037746.2c81e0af27f4e50dfadaffd7d11a91afacf6d216.dol-sen@gentoo
1 commit: 2c81e0af27f4e50dfadaffd7d11a91afacf6d216
2 Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
3 AuthorDate: Thu Sep 4 00:13:03 2014 +0000
4 Commit: Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
5 CommitDate: Tue Sep 30 00:42:26 2014 +0000
6 URL: http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=2c81e0af
7
8 Move module.py and progress.py from emaint to portage namespace
9
10 This makes it more centrally available as it is used by more than just the emaint module.
11 moule.py: make path and namepace params mandatory.
12 They are not as easily predictable.
13 Clean dead code.
14
15 ---
16 pym/portage/emaint/main.py | 12 +++++++++---
17 pym/portage/{emaint => }/module.py | 23 +++++------------------
18 pym/portage/{emaint => }/progress.py | 0
19 pym/portage/sync/__init__.py | 2 +-
20 pym/portage/sync/controller.py | 2 +-
21 5 files changed, 16 insertions(+), 23 deletions(-)
22
23 diff --git a/pym/portage/emaint/main.py b/pym/portage/emaint/main.py
24 index 6292338..fea4832 100644
25 --- a/pym/portage/emaint/main.py
26 +++ b/pym/portage/emaint/main.py
27 @@ -9,8 +9,8 @@ import textwrap
28
29 import portage
30 from portage import os
31 -from portage.emaint.module import Modules
32 -from portage.emaint.progress import ProgressBar
33 +from portage.module import Modules
34 +from portage.progress import ProgressBar
35 from portage.emaint.defaults import DEFAULT_OPTIONS
36 from portage.util._argparse import ArgumentParser
37
38 @@ -153,7 +153,13 @@ def emaint_main(myargv):
39 # files (such as the world file) have sane permissions.
40 os.umask(0o22)
41
42 - module_controller = Modules(namepath="portage.emaint.modules")
43 + module_path = os.path.join(
44 + (os.path.dirname(
45 + os.path.realpath(__file__))), "modules"
46 + )
47 + module_controller = Modules(
48 + path=module_path,
49 + namepath="portage.emaint.modules")
50 module_names = module_controller.module_names[:]
51 module_names.insert(0, "all")
52
53
54 diff --git a/pym/portage/emaint/module.py b/pym/portage/module.py
55 similarity index 87%
56 rename from pym/portage/emaint/module.py
57 rename to pym/portage/module.py
58 index 07a0cb7..a78bb2e 100644
59 --- a/pym/portage/emaint/module.py
60 +++ b/pym/portage/module.py
61 @@ -74,29 +74,16 @@ class Modules(object):
62 """Dynamic modules system for loading and retrieving any of the
63 installed emaint modules and/or provided class's
64
65 - @param path: Optional path to the "modules" directory or
66 - defaults to the directory of this file + '/modules'
67 - @param namepath: Optional python import path to the "modules" directory or
68 - defaults to the directory name of this file + '.modules'
69 + @param path: Path to the "modules" directory
70 + @param namepath: Python import path to the "modules" directory
71 """
72
73 - def __init__(self, path=None, namepath=None):
74 - if path:
75 - self._module_path = path
76 - else:
77 - self._module_path = os.path.join((
78 - os.path.dirname(os.path.realpath(__file__))), "modules")
79 - if namepath:
80 - self._namepath = namepath
81 - else:
82 - self._namepath = '.'.join(os.path.dirname(
83 - os.path.realpath(__file__)), "modules")
84 + def __init__(self, path, namepath):
85 + self._module_path = path
86 + self._namepath = namepath
87 self._modules = self._get_all_modules()
88 self.modules = ProtectedDict(self._modules)
89 self.module_names = sorted(self._modules)
90 - #self.modules = {}
91 - #for mod in self.module_names:
92 - #self.module[mod] = LazyLoad(
93
94 def _get_all_modules(self):
95 """scans the emaint modules dir for loadable modules
96
97 diff --git a/pym/portage/emaint/progress.py b/pym/portage/progress.py
98 similarity index 100%
99 rename from pym/portage/emaint/progress.py
100 rename to pym/portage/progress.py
101
102 diff --git a/pym/portage/sync/__init__.py b/pym/portage/sync/__init__.py
103 index b74c89e..58a1298 100644
104 --- a/pym/portage/sync/__init__.py
105 +++ b/pym/portage/sync/__init__.py
106 @@ -3,7 +3,7 @@
107
108 import os
109
110 -from portage.emaint.module import Modules
111 +from portage.module import Modules
112 from portage.sync.controller import SyncManager
113 from portage.sync.config_checks import check_type
114
115
116 diff --git a/pym/portage/sync/controller.py b/pym/portage/sync/controller.py
117 index f0d1c05..2b3dbad 100644
118 --- a/pym/portage/sync/controller.py
119 +++ b/pym/portage/sync/controller.py
120 @@ -10,7 +10,7 @@ import pwd
121
122 import portage
123 from portage import os
124 -from portage.emaint.progress import ProgressBar
125 +from portage.progress import ProgressBar
126 #from portage.emaint.defaults import DEFAULT_OPTIONS
127 #from portage.util._argparse import ArgumentParser
128 from portage.util import writemsg_level