1 |
commit: ed1c62e00843690a586ee634a8a05a6b5cc7dd18 |
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: Mon Sep 29 17:20:21 2014 +0000 |
6 |
URL: http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=ed1c62e0 |
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. They are not as easily predictable. |
12 |
|
13 |
--- |
14 |
pym/portage/emaint/main.py | 12 +++++++++--- |
15 |
pym/portage/{emaint => }/module.py | 14 +++----------- |
16 |
pym/portage/{emaint => }/progress.py | 0 |
17 |
pym/portage/sync/__init__.py | 2 +- |
18 |
pym/portage/sync/controller.py | 2 +- |
19 |
5 files changed, 14 insertions(+), 16 deletions(-) |
20 |
|
21 |
diff --git a/pym/portage/emaint/main.py b/pym/portage/emaint/main.py |
22 |
index 6292338..fea4832 100644 |
23 |
--- a/pym/portage/emaint/main.py |
24 |
+++ b/pym/portage/emaint/main.py |
25 |
@@ -9,8 +9,8 @@ import textwrap |
26 |
|
27 |
import portage |
28 |
from portage import os |
29 |
-from portage.emaint.module import Modules |
30 |
-from portage.emaint.progress import ProgressBar |
31 |
+from portage.module import Modules |
32 |
+from portage.progress import ProgressBar |
33 |
from portage.emaint.defaults import DEFAULT_OPTIONS |
34 |
from portage.util._argparse import ArgumentParser |
35 |
|
36 |
@@ -153,7 +153,13 @@ def emaint_main(myargv): |
37 |
# files (such as the world file) have sane permissions. |
38 |
os.umask(0o22) |
39 |
|
40 |
- module_controller = Modules(namepath="portage.emaint.modules") |
41 |
+ module_path = os.path.join( |
42 |
+ (os.path.dirname( |
43 |
+ os.path.realpath(__file__))), "modules" |
44 |
+ ) |
45 |
+ module_controller = Modules( |
46 |
+ path=module_path, |
47 |
+ namepath="portage.emaint.modules") |
48 |
module_names = module_controller.module_names[:] |
49 |
module_names.insert(0, "all") |
50 |
|
51 |
|
52 |
diff --git a/pym/portage/emaint/module.py b/pym/portage/module.py |
53 |
similarity index 93% |
54 |
rename from pym/portage/emaint/module.py |
55 |
rename to pym/portage/module.py |
56 |
index 07a0cb7..d961574 100644 |
57 |
--- a/pym/portage/emaint/module.py |
58 |
+++ b/pym/portage/module.py |
59 |
@@ -80,17 +80,9 @@ class Modules(object): |
60 |
defaults to the directory name of this file + '.modules' |
61 |
""" |
62 |
|
63 |
- def __init__(self, path=None, namepath=None): |
64 |
- if path: |
65 |
- self._module_path = path |
66 |
- else: |
67 |
- self._module_path = os.path.join(( |
68 |
- os.path.dirname(os.path.realpath(__file__))), "modules") |
69 |
- if namepath: |
70 |
- self._namepath = namepath |
71 |
- else: |
72 |
- self._namepath = '.'.join(os.path.dirname( |
73 |
- os.path.realpath(__file__)), "modules") |
74 |
+ def __init__(self, path, namepath): |
75 |
+ self._module_path = path |
76 |
+ self._namepath = namepath |
77 |
self._modules = self._get_all_modules() |
78 |
self.modules = ProtectedDict(self._modules) |
79 |
self.module_names = sorted(self._modules) |
80 |
|
81 |
diff --git a/pym/portage/emaint/progress.py b/pym/portage/progress.py |
82 |
similarity index 100% |
83 |
rename from pym/portage/emaint/progress.py |
84 |
rename to pym/portage/progress.py |
85 |
|
86 |
diff --git a/pym/portage/sync/__init__.py b/pym/portage/sync/__init__.py |
87 |
index b74c89e..58a1298 100644 |
88 |
--- a/pym/portage/sync/__init__.py |
89 |
+++ b/pym/portage/sync/__init__.py |
90 |
@@ -3,7 +3,7 @@ |
91 |
|
92 |
import os |
93 |
|
94 |
-from portage.emaint.module import Modules |
95 |
+from portage.module import Modules |
96 |
from portage.sync.controller import SyncManager |
97 |
from portage.sync.config_checks import check_type |
98 |
|
99 |
|
100 |
diff --git a/pym/portage/sync/controller.py b/pym/portage/sync/controller.py |
101 |
index f0d1c05..2b3dbad 100644 |
102 |
--- a/pym/portage/sync/controller.py |
103 |
+++ b/pym/portage/sync/controller.py |
104 |
@@ -10,7 +10,7 @@ import pwd |
105 |
|
106 |
import portage |
107 |
from portage import os |
108 |
-from portage.emaint.progress import ProgressBar |
109 |
+from portage.progress import ProgressBar |
110 |
#from portage.emaint.defaults import DEFAULT_OPTIONS |
111 |
#from portage.util._argparse import ArgumentParser |
112 |
from portage.util import writemsg_level |