public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Brian Dolbec" <brian.dolbec@gmail.com>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/portage:plugin-sync commit in: pym/portage/emaint/, pym/portage/sync/, pym/portage/
Date: Thu,  4 Dec 2014 20:04:30 +0000 (UTC)	[thread overview]
Message-ID: <1417722993.0de38192afe9fc752955c595d1badd2431441269.dol-sen@gentoo> (raw)
Message-ID: <20141204200430.KW8MHUJCycJRuRDoLO2niaSKpii1qUjH14nJcGHVYFA@z> (raw)

commit:     0de38192afe9fc752955c595d1badd2431441269
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Thu Sep  4 00:13:03 2014 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Thu Dec  4 19:56:33 2014 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=0de38192

Move module.py and progress.py from emaint to portage namespace

This makes it more centrally available as it is used by more than just the emaint module.
moule.py: make path and namepace params mandatory.
They are not as easily predictable.
Clean dead code.

---
 pym/portage/emaint/main.py           | 12 +++++++++---
 pym/portage/{emaint => }/module.py   | 23 +++++------------------
 pym/portage/{emaint => }/progress.py |  0
 pym/portage/sync/__init__.py         |  2 +-
 pym/portage/sync/controller.py       |  2 +-
 5 files changed, 16 insertions(+), 23 deletions(-)

diff --git a/pym/portage/emaint/main.py b/pym/portage/emaint/main.py
index 6292338..fea4832 100644
--- a/pym/portage/emaint/main.py
+++ b/pym/portage/emaint/main.py
@@ -9,8 +9,8 @@ import textwrap
 
 import portage
 from portage import os
-from portage.emaint.module import Modules
-from portage.emaint.progress import ProgressBar
+from portage.module import Modules
+from portage.progress import ProgressBar
 from portage.emaint.defaults import DEFAULT_OPTIONS
 from portage.util._argparse import ArgumentParser
 
@@ -153,7 +153,13 @@ def emaint_main(myargv):
 	# files (such as the world file) have sane permissions.
 	os.umask(0o22)
 
-	module_controller = Modules(namepath="portage.emaint.modules")
+	module_path = os.path.join(
+		(os.path.dirname(
+		os.path.realpath(__file__))), "modules"
+		)
+	module_controller = Modules(
+		path=module_path,
+		namepath="portage.emaint.modules")
 	module_names = module_controller.module_names[:]
 	module_names.insert(0, "all")
 

diff --git a/pym/portage/emaint/module.py b/pym/portage/module.py
similarity index 87%
rename from pym/portage/emaint/module.py
rename to pym/portage/module.py
index 07a0cb7..a78bb2e 100644
--- a/pym/portage/emaint/module.py
+++ b/pym/portage/module.py
@@ -74,29 +74,16 @@ class Modules(object):
 	"""Dynamic modules system for loading and retrieving any of the
 	installed emaint modules and/or provided class's
 
-	@param path: Optional path to the "modules" directory or
-			defaults to the directory of this file + '/modules'
-	@param namepath: Optional python import path to the "modules" directory or
-			defaults to the directory name of this file + '.modules'
+	@param path: Path to the "modules" directory
+	@param namepath: Python import path to the "modules" directory
 	"""
 
-	def __init__(self, path=None, namepath=None):
-		if path:
-			self._module_path = path
-		else:
-			self._module_path = os.path.join((
-				os.path.dirname(os.path.realpath(__file__))), "modules")
-		if namepath:
-			self._namepath = namepath
-		else:
-			self._namepath = '.'.join(os.path.dirname(
-				os.path.realpath(__file__)), "modules")
+	def __init__(self, path, namepath):
+		self._module_path = path
+		self._namepath = namepath
 		self._modules = self._get_all_modules()
 		self.modules = ProtectedDict(self._modules)
 		self.module_names = sorted(self._modules)
-		#self.modules = {}
-		#for mod in self.module_names:
-			#self.module[mod] = LazyLoad(
 
 	def _get_all_modules(self):
 		"""scans the emaint modules dir for loadable modules

diff --git a/pym/portage/emaint/progress.py b/pym/portage/progress.py
similarity index 100%
rename from pym/portage/emaint/progress.py
rename to pym/portage/progress.py

diff --git a/pym/portage/sync/__init__.py b/pym/portage/sync/__init__.py
index b74c89e..58a1298 100644
--- a/pym/portage/sync/__init__.py
+++ b/pym/portage/sync/__init__.py
@@ -3,7 +3,7 @@
 
 import os
 
-from portage.emaint.module import Modules
+from portage.module import Modules
 from portage.sync.controller import SyncManager
 from portage.sync.config_checks import check_type
 

diff --git a/pym/portage/sync/controller.py b/pym/portage/sync/controller.py
index 34531e1..ddf48c8 100644
--- a/pym/portage/sync/controller.py
+++ b/pym/portage/sync/controller.py
@@ -10,7 +10,7 @@ import pwd
 
 import portage
 from portage import os
-from portage.emaint.progress import ProgressBar
+from portage.progress import ProgressBar
 #from portage.emaint.defaults import DEFAULT_OPTIONS
 #from portage.util._argparse import ArgumentParser
 from portage.util import writemsg_level


             reply	other threads:[~2014-12-04 20:04 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-04 20:16 Brian Dolbec [this message]
2014-12-04 20:04 ` [gentoo-commits] proj/portage:plugin-sync commit in: pym/portage/emaint/, pym/portage/sync/, pym/portage/ Brian Dolbec

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1417722993.0de38192afe9fc752955c595d1badd2431441269.dol-sen@gentoo \
    --to=brian.dolbec@gmail.com \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox