public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] proj/portage:plugin-sync commit in: pym/portage/sync/, pym/_emerge/
@ 2014-03-15  8:01 Brian Dolbec
  0 siblings, 0 replies; 6+ messages in thread
From: Brian Dolbec @ 2014-03-15  8:01 UTC (permalink / raw
  To: gentoo-commits

commit:     7c593f727587313b5ffe9c70d7a432b2f0487a21
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sat Mar 15 07:55:30 2014 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Sat Mar 15 07:55:30 2014 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=7c593f72

portage/sync: Move the Modules  and SyncManager initialization code to sync/__init__.py

This creates a central place to store a single instance of the SyncManager.
It also makes the module names available for use in repository/config.py for repos.conf checks.

---
 pym/_emerge/actions.py         |  8 ++++----
 pym/portage/sync/__init__.py   | 34 ++++++++++++++++++++++++++++++++++
 pym/portage/sync/controller.py |  8 +-------
 3 files changed, 39 insertions(+), 11 deletions(-)

diff --git a/pym/_emerge/actions.py b/pym/_emerge/actions.py
index 6f4de04..f76a3dc 100644
--- a/pym/_emerge/actions.py
+++ b/pym/_emerge/actions.py
@@ -62,7 +62,9 @@ from portage.util._async.run_main_scheduler import run_main_scheduler
 from portage.util._async.SchedulerInterface import SchedulerInterface
 from portage.util._eventloop.global_event_loop import global_event_loop
 from portage._global_updates import _global_updates
-from portage.sync.controller import SyncManager
+from portage.sync import get_syncer
+from portage.sync.getaddrinfo_validate import getaddrinfo_validate
+from portage.sync.old_tree_timestamp import old_tree_timestamp_warn
 from portage.metadata import action_metadata
 
 from _emerge.clear_caches import clear_caches
@@ -81,8 +83,6 @@ from _emerge.Scheduler import Scheduler
 from _emerge.search import search
 from _emerge.SetArg import SetArg
 from _emerge.show_invalid_depstring_notice import show_invalid_depstring_notice
-from portage.sync.getaddrinfo_validate import getaddrinfo_validate
-from portage.sync.old_tree_timestamp import old_tree_timestamp_warn
 from _emerge.unmerge import unmerge
 from _emerge.UnmergeDepPriority import UnmergeDepPriority
 from _emerge.UseFlagDisplay import pkg_use_display
@@ -1875,7 +1875,7 @@ def action_sync(emerge_config, trees=DeprecationWarning,
 	else:
 		selected_repos.extend(emerge_config.target_config.settings.repositories)
 
-	sync_manager = SyncManager(emerge_config.target_config.settings, emergelog)
+	sync_manager = get_syncer(emerge_config.target_config.settings, emergelog)
 	retvals = []
 	for repo in selected_repos:
 		if repo.sync_type is not None:

diff --git a/pym/portage/sync/__init__.py b/pym/portage/sync/__init__.py
index 21a391a..65498ec 100644
--- a/pym/portage/sync/__init__.py
+++ b/pym/portage/sync/__init__.py
@@ -1,2 +1,36 @@
 # Copyright 2010 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
+
+import os
+
+from portage.emaint.module import Modules
+from portage.sync.controller import SyncManager
+
+sync_manager = None
+
+path = os.path.join(os.path.dirname(__file__), "modules")
+# initial development debug info
+print("module path:", path)
+
+module_controller = Modules(path=path, namepath="portage.sync.modules")
+
+# initial development debug info
+print(module_controller.module_names)
+module_names = module_controller.module_names[:]
+
+
+def get_syncer(settings=None, logger=None):
+	global sync_manager
+	if sync_manager and not settings and not logger:
+		return sync_manager
+	if settings is None:
+		from _emerge.actions import load_emerge_config
+		emerge_config = load_emerge_config()
+		settings = emerge_config.target_config.settings
+	if logger is None:
+		from _emerge.emergelog import emergelog as logger
+	sync_manager = SyncManager(settings, logger)
+	return sync_manager
+
+
+

diff --git a/pym/portage/sync/controller.py b/pym/portage/sync/controller.py
index a4b2ab8..e53d173 100644
--- a/pym/portage/sync/controller.py
+++ b/pym/portage/sync/controller.py
@@ -10,7 +10,6 @@ import pwd
 
 import portage
 from portage import os
-from portage.emaint.module import Modules
 from portage.emaint.progress import ProgressBar
 #from portage.emaint.defaults import DEFAULT_OPTIONS
 #from portage.util._argparse import ArgumentParser
@@ -85,13 +84,8 @@ class SyncManager(object):
 		# files have sane permissions.
 		os.umask(0o22)
 
-		path = os.path.join(os.path.dirname(__file__), "modules")
-		print("module path:", path)
-		self.module_controller = Modules(path=path,
-			namepath="portage.sync.modules")
-		print(self.module_controller.module_names)
+		self.module_controller = portage.sync.module_controller
 		self.module_names = self.module_controller.module_names[:]
-		#self.module_names.insert(0, "all")
 
 
 	def get_modules(self, mod):


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [gentoo-commits] proj/portage:plugin-sync commit in: pym/portage/sync/, pym/_emerge/
@ 2014-04-22  2:36 Brian Dolbec
  0 siblings, 0 replies; 6+ messages in thread
From: Brian Dolbec @ 2014-04-22  2:36 UTC (permalink / raw
  To: gentoo-commits

commit:     91582e361306971cd1a2f96036350ebd9df67460
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sat Mar 15 07:55:30 2014 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Sat Mar 29 22:46:20 2014 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=91582e36

portage/sync: Move the Modules  and SyncManager initialization code to sync/__init__.py

This creates a central place to store a single instance of the SyncManager.
It also makes the module names available for use in repository/config.py for repos.conf checks.

---
 pym/_emerge/actions.py         |  8 ++++----
 pym/portage/sync/__init__.py   | 34 ++++++++++++++++++++++++++++++++++
 pym/portage/sync/controller.py |  8 +-------
 3 files changed, 39 insertions(+), 11 deletions(-)

diff --git a/pym/_emerge/actions.py b/pym/_emerge/actions.py
index 18cc0cc..ccfe2e7 100644
--- a/pym/_emerge/actions.py
+++ b/pym/_emerge/actions.py
@@ -62,7 +62,9 @@ from portage.util._async.run_main_scheduler import run_main_scheduler
 from portage.util._async.SchedulerInterface import SchedulerInterface
 from portage.util._eventloop.global_event_loop import global_event_loop
 from portage._global_updates import _global_updates
-from portage.sync.controller import SyncManager
+from portage.sync import get_syncer
+from portage.sync.getaddrinfo_validate import getaddrinfo_validate
+from portage.sync.old_tree_timestamp import old_tree_timestamp_warn
 from portage.metadata import action_metadata
 
 from _emerge.clear_caches import clear_caches
@@ -81,8 +83,6 @@ from _emerge.Scheduler import Scheduler
 from _emerge.search import search
 from _emerge.SetArg import SetArg
 from _emerge.show_invalid_depstring_notice import show_invalid_depstring_notice
-from portage.sync.getaddrinfo_validate import getaddrinfo_validate
-from portage.sync.old_tree_timestamp import old_tree_timestamp_warn
 from _emerge.unmerge import unmerge
 from _emerge.UnmergeDepPriority import UnmergeDepPriority
 from _emerge.UseFlagDisplay import pkg_use_display
@@ -1874,7 +1874,7 @@ def action_sync(emerge_config, trees=DeprecationWarning,
 	else:
 		selected_repos.extend(emerge_config.target_config.settings.repositories)
 
-	sync_manager = SyncManager(emerge_config.target_config.settings, emergelog)
+	sync_manager = get_syncer(emerge_config.target_config.settings, emergelog)
 	retvals = []
 	for repo in selected_repos:
 		if repo.sync_type is not None:

diff --git a/pym/portage/sync/__init__.py b/pym/portage/sync/__init__.py
index 21a391a..65498ec 100644
--- a/pym/portage/sync/__init__.py
+++ b/pym/portage/sync/__init__.py
@@ -1,2 +1,36 @@
 # Copyright 2010 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
+
+import os
+
+from portage.emaint.module import Modules
+from portage.sync.controller import SyncManager
+
+sync_manager = None
+
+path = os.path.join(os.path.dirname(__file__), "modules")
+# initial development debug info
+print("module path:", path)
+
+module_controller = Modules(path=path, namepath="portage.sync.modules")
+
+# initial development debug info
+print(module_controller.module_names)
+module_names = module_controller.module_names[:]
+
+
+def get_syncer(settings=None, logger=None):
+	global sync_manager
+	if sync_manager and not settings and not logger:
+		return sync_manager
+	if settings is None:
+		from _emerge.actions import load_emerge_config
+		emerge_config = load_emerge_config()
+		settings = emerge_config.target_config.settings
+	if logger is None:
+		from _emerge.emergelog import emergelog as logger
+	sync_manager = SyncManager(settings, logger)
+	return sync_manager
+
+
+

diff --git a/pym/portage/sync/controller.py b/pym/portage/sync/controller.py
index a4b2ab8..e53d173 100644
--- a/pym/portage/sync/controller.py
+++ b/pym/portage/sync/controller.py
@@ -10,7 +10,6 @@ import pwd
 
 import portage
 from portage import os
-from portage.emaint.module import Modules
 from portage.emaint.progress import ProgressBar
 #from portage.emaint.defaults import DEFAULT_OPTIONS
 #from portage.util._argparse import ArgumentParser
@@ -85,13 +84,8 @@ class SyncManager(object):
 		# files have sane permissions.
 		os.umask(0o22)
 
-		path = os.path.join(os.path.dirname(__file__), "modules")
-		print("module path:", path)
-		self.module_controller = Modules(path=path,
-			namepath="portage.sync.modules")
-		print(self.module_controller.module_names)
+		self.module_controller = portage.sync.module_controller
 		self.module_names = self.module_controller.module_names[:]
-		#self.module_names.insert(0, "all")
 
 
 	def get_modules(self, mod):


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [gentoo-commits] proj/portage:plugin-sync commit in: pym/portage/sync/, pym/_emerge/
@ 2014-05-02 23:13 Brian Dolbec
  0 siblings, 0 replies; 6+ messages in thread
From: Brian Dolbec @ 2014-05-02 23:13 UTC (permalink / raw
  To: gentoo-commits

commit:     d08eefa8b3de0a39d801665ac1612a73bbc419f3
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sat Mar 15 07:55:30 2014 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Fri May  2 23:09:16 2014 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=d08eefa8

portage/sync: Move the Modules, SyncManager initialization code

Move it to sync/__init__.py
This creates a central place to store a single instance of the SyncManager.
It also makes the module names available for use in repository/config.py for repos.conf checks.

---
 pym/_emerge/actions.py         |  8 ++++----
 pym/portage/sync/__init__.py   | 34 ++++++++++++++++++++++++++++++++++
 pym/portage/sync/controller.py |  8 +-------
 3 files changed, 39 insertions(+), 11 deletions(-)

diff --git a/pym/_emerge/actions.py b/pym/_emerge/actions.py
index 3edbdbe..e375fc1 100644
--- a/pym/_emerge/actions.py
+++ b/pym/_emerge/actions.py
@@ -62,7 +62,9 @@ from portage.util._async.run_main_scheduler import run_main_scheduler
 from portage.util._async.SchedulerInterface import SchedulerInterface
 from portage.util._eventloop.global_event_loop import global_event_loop
 from portage._global_updates import _global_updates
-from portage.sync.controller import SyncManager
+from portage.sync import get_syncer
+from portage.sync.getaddrinfo_validate import getaddrinfo_validate
+from portage.sync.old_tree_timestamp import old_tree_timestamp_warn
 from portage.metadata import action_metadata
 
 from _emerge.clear_caches import clear_caches
@@ -81,8 +83,6 @@ from _emerge.Scheduler import Scheduler
 from _emerge.search import search
 from _emerge.SetArg import SetArg
 from _emerge.show_invalid_depstring_notice import show_invalid_depstring_notice
-from portage.sync.getaddrinfo_validate import getaddrinfo_validate
-from portage.sync.old_tree_timestamp import old_tree_timestamp_warn
 from _emerge.unmerge import unmerge
 from _emerge.UnmergeDepPriority import UnmergeDepPriority
 from _emerge.UseFlagDisplay import pkg_use_display
@@ -1874,7 +1874,7 @@ def action_sync(emerge_config, trees=DeprecationWarning,
 	else:
 		selected_repos.extend(emerge_config.target_config.settings.repositories)
 
-	sync_manager = SyncManager(emerge_config.target_config.settings, emergelog)
+	sync_manager = get_syncer(emerge_config.target_config.settings, emergelog)
 	retvals = []
 	for repo in selected_repos:
 		if repo.sync_type is not None:

diff --git a/pym/portage/sync/__init__.py b/pym/portage/sync/__init__.py
index 21a391a..65498ec 100644
--- a/pym/portage/sync/__init__.py
+++ b/pym/portage/sync/__init__.py
@@ -1,2 +1,36 @@
 # Copyright 2010 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
+
+import os
+
+from portage.emaint.module import Modules
+from portage.sync.controller import SyncManager
+
+sync_manager = None
+
+path = os.path.join(os.path.dirname(__file__), "modules")
+# initial development debug info
+print("module path:", path)
+
+module_controller = Modules(path=path, namepath="portage.sync.modules")
+
+# initial development debug info
+print(module_controller.module_names)
+module_names = module_controller.module_names[:]
+
+
+def get_syncer(settings=None, logger=None):
+	global sync_manager
+	if sync_manager and not settings and not logger:
+		return sync_manager
+	if settings is None:
+		from _emerge.actions import load_emerge_config
+		emerge_config = load_emerge_config()
+		settings = emerge_config.target_config.settings
+	if logger is None:
+		from _emerge.emergelog import emergelog as logger
+	sync_manager = SyncManager(settings, logger)
+	return sync_manager
+
+
+

diff --git a/pym/portage/sync/controller.py b/pym/portage/sync/controller.py
index af85904..a71cb96 100644
--- a/pym/portage/sync/controller.py
+++ b/pym/portage/sync/controller.py
@@ -10,7 +10,6 @@ import pwd
 
 import portage
 from portage import os
-from portage.emaint.module import Modules
 from portage.emaint.progress import ProgressBar
 #from portage.emaint.defaults import DEFAULT_OPTIONS
 #from portage.util._argparse import ArgumentParser
@@ -84,13 +83,8 @@ class SyncManager(object):
 		# files have sane permissions.
 		os.umask(0o22)
 
-		path = os.path.join(os.path.dirname(__file__), "modules")
-		print("module path:", path)
-		self.module_controller = Modules(path=path,
-			namepath="portage.sync.modules")
-		print(self.module_controller.module_names)
+		self.module_controller = portage.sync.module_controller
 		self.module_names = self.module_controller.module_names[:]
-		#self.module_names.insert(0, "all")
 
 
 	def get_modules(self, mod):


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [gentoo-commits] proj/portage:plugin-sync commit in: pym/portage/sync/, pym/_emerge/
@ 2014-06-16 15:46 Brian Dolbec
  0 siblings, 0 replies; 6+ messages in thread
From: Brian Dolbec @ 2014-06-16 15:46 UTC (permalink / raw
  To: gentoo-commits

commit:     76058e29bde535f3e5f47a590ed7d82976fa25ef
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sat Mar 15 07:55:30 2014 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Mon Jun 16 15:36:56 2014 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=76058e29

portage/sync: Move the Modules, SyncManager initialization code

Move it to sync/__init__.py
This creates a central place to store a single instance of the SyncManager.
It also makes the module names available for use in repository/config.py for repos.conf checks.

---
 pym/_emerge/actions.py         |  8 ++++----
 pym/portage/sync/__init__.py   | 34 ++++++++++++++++++++++++++++++++++
 pym/portage/sync/controller.py |  8 +-------
 3 files changed, 39 insertions(+), 11 deletions(-)

diff --git a/pym/_emerge/actions.py b/pym/_emerge/actions.py
index 509278e..ee4b1db 100644
--- a/pym/_emerge/actions.py
+++ b/pym/_emerge/actions.py
@@ -62,7 +62,9 @@ from portage.util._async.run_main_scheduler import run_main_scheduler
 from portage.util._async.SchedulerInterface import SchedulerInterface
 from portage.util._eventloop.global_event_loop import global_event_loop
 from portage._global_updates import _global_updates
-from portage.sync.controller import SyncManager
+from portage.sync import get_syncer
+from portage.sync.getaddrinfo_validate import getaddrinfo_validate
+from portage.sync.old_tree_timestamp import old_tree_timestamp_warn
 from portage.metadata import action_metadata
 
 from _emerge.clear_caches import clear_caches
@@ -81,8 +83,6 @@ from _emerge.Scheduler import Scheduler
 from _emerge.search import search
 from _emerge.SetArg import SetArg
 from _emerge.show_invalid_depstring_notice import show_invalid_depstring_notice
-from portage.sync.getaddrinfo_validate import getaddrinfo_validate
-from portage.sync.old_tree_timestamp import old_tree_timestamp_warn
 from _emerge.unmerge import unmerge
 from _emerge.UnmergeDepPriority import UnmergeDepPriority
 from _emerge.UseFlagDisplay import pkg_use_display
@@ -1876,7 +1876,7 @@ def action_sync(emerge_config, trees=DeprecationWarning,
 	else:
 		selected_repos.extend(emerge_config.target_config.settings.repositories)
 
-	sync_manager = SyncManager(emerge_config.target_config.settings, emergelog)
+	sync_manager = get_syncer(emerge_config.target_config.settings, emergelog)
 	retvals = []
 	for repo in selected_repos:
 		if repo.sync_type is not None:

diff --git a/pym/portage/sync/__init__.py b/pym/portage/sync/__init__.py
index 21a391a..65498ec 100644
--- a/pym/portage/sync/__init__.py
+++ b/pym/portage/sync/__init__.py
@@ -1,2 +1,36 @@
 # Copyright 2010 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
+
+import os
+
+from portage.emaint.module import Modules
+from portage.sync.controller import SyncManager
+
+sync_manager = None
+
+path = os.path.join(os.path.dirname(__file__), "modules")
+# initial development debug info
+print("module path:", path)
+
+module_controller = Modules(path=path, namepath="portage.sync.modules")
+
+# initial development debug info
+print(module_controller.module_names)
+module_names = module_controller.module_names[:]
+
+
+def get_syncer(settings=None, logger=None):
+	global sync_manager
+	if sync_manager and not settings and not logger:
+		return sync_manager
+	if settings is None:
+		from _emerge.actions import load_emerge_config
+		emerge_config = load_emerge_config()
+		settings = emerge_config.target_config.settings
+	if logger is None:
+		from _emerge.emergelog import emergelog as logger
+	sync_manager = SyncManager(settings, logger)
+	return sync_manager
+
+
+

diff --git a/pym/portage/sync/controller.py b/pym/portage/sync/controller.py
index 9e8c930..5d2a8f5 100644
--- a/pym/portage/sync/controller.py
+++ b/pym/portage/sync/controller.py
@@ -10,7 +10,6 @@ import pwd
 
 import portage
 from portage import os
-from portage.emaint.module import Modules
 from portage.emaint.progress import ProgressBar
 #from portage.emaint.defaults import DEFAULT_OPTIONS
 #from portage.util._argparse import ArgumentParser
@@ -84,13 +83,8 @@ class SyncManager(object):
 		# files have sane permissions.
 		os.umask(0o22)
 
-		path = os.path.join(os.path.dirname(__file__), "modules")
-		print("module path:", path)
-		self.module_controller = Modules(path=path,
-			namepath="portage.sync.modules")
-		print(self.module_controller.module_names)
+		self.module_controller = portage.sync.module_controller
 		self.module_names = self.module_controller.module_names[:]
-		#self.module_names.insert(0, "all")
 
 
 	def get_modules(self, mod):


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [gentoo-commits] proj/portage:plugin-sync commit in: pym/portage/sync/, pym/_emerge/
@ 2014-06-16 22:45 Brian Dolbec
  0 siblings, 0 replies; 6+ messages in thread
From: Brian Dolbec @ 2014-06-16 22:45 UTC (permalink / raw
  To: gentoo-commits

commit:     dc0c89892e1a9331df96ca4b3cebaa133f60e3f3
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sat Mar 15 07:55:30 2014 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Mon Jun 16 22:43:10 2014 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=dc0c8989

portage/sync: Move the Modules, SyncManager initialization code

Move it to sync/__init__.py
This creates a central place to store a single instance of the SyncManager.
It also makes the module names available for use in repository/config.py for repos.conf checks.

---
 pym/_emerge/actions.py         |  8 ++++----
 pym/portage/sync/__init__.py   | 34 ++++++++++++++++++++++++++++++++++
 pym/portage/sync/controller.py |  8 +-------
 3 files changed, 39 insertions(+), 11 deletions(-)

diff --git a/pym/_emerge/actions.py b/pym/_emerge/actions.py
index 509278e..ee4b1db 100644
--- a/pym/_emerge/actions.py
+++ b/pym/_emerge/actions.py
@@ -62,7 +62,9 @@ from portage.util._async.run_main_scheduler import run_main_scheduler
 from portage.util._async.SchedulerInterface import SchedulerInterface
 from portage.util._eventloop.global_event_loop import global_event_loop
 from portage._global_updates import _global_updates
-from portage.sync.controller import SyncManager
+from portage.sync import get_syncer
+from portage.sync.getaddrinfo_validate import getaddrinfo_validate
+from portage.sync.old_tree_timestamp import old_tree_timestamp_warn
 from portage.metadata import action_metadata
 
 from _emerge.clear_caches import clear_caches
@@ -81,8 +83,6 @@ from _emerge.Scheduler import Scheduler
 from _emerge.search import search
 from _emerge.SetArg import SetArg
 from _emerge.show_invalid_depstring_notice import show_invalid_depstring_notice
-from portage.sync.getaddrinfo_validate import getaddrinfo_validate
-from portage.sync.old_tree_timestamp import old_tree_timestamp_warn
 from _emerge.unmerge import unmerge
 from _emerge.UnmergeDepPriority import UnmergeDepPriority
 from _emerge.UseFlagDisplay import pkg_use_display
@@ -1876,7 +1876,7 @@ def action_sync(emerge_config, trees=DeprecationWarning,
 	else:
 		selected_repos.extend(emerge_config.target_config.settings.repositories)
 
-	sync_manager = SyncManager(emerge_config.target_config.settings, emergelog)
+	sync_manager = get_syncer(emerge_config.target_config.settings, emergelog)
 	retvals = []
 	for repo in selected_repos:
 		if repo.sync_type is not None:

diff --git a/pym/portage/sync/__init__.py b/pym/portage/sync/__init__.py
index 21a391a..65498ec 100644
--- a/pym/portage/sync/__init__.py
+++ b/pym/portage/sync/__init__.py
@@ -1,2 +1,36 @@
 # Copyright 2010 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
+
+import os
+
+from portage.emaint.module import Modules
+from portage.sync.controller import SyncManager
+
+sync_manager = None
+
+path = os.path.join(os.path.dirname(__file__), "modules")
+# initial development debug info
+print("module path:", path)
+
+module_controller = Modules(path=path, namepath="portage.sync.modules")
+
+# initial development debug info
+print(module_controller.module_names)
+module_names = module_controller.module_names[:]
+
+
+def get_syncer(settings=None, logger=None):
+	global sync_manager
+	if sync_manager and not settings and not logger:
+		return sync_manager
+	if settings is None:
+		from _emerge.actions import load_emerge_config
+		emerge_config = load_emerge_config()
+		settings = emerge_config.target_config.settings
+	if logger is None:
+		from _emerge.emergelog import emergelog as logger
+	sync_manager = SyncManager(settings, logger)
+	return sync_manager
+
+
+

diff --git a/pym/portage/sync/controller.py b/pym/portage/sync/controller.py
index 9e8c930..5d2a8f5 100644
--- a/pym/portage/sync/controller.py
+++ b/pym/portage/sync/controller.py
@@ -10,7 +10,6 @@ import pwd
 
 import portage
 from portage import os
-from portage.emaint.module import Modules
 from portage.emaint.progress import ProgressBar
 #from portage.emaint.defaults import DEFAULT_OPTIONS
 #from portage.util._argparse import ArgumentParser
@@ -84,13 +83,8 @@ class SyncManager(object):
 		# files have sane permissions.
 		os.umask(0o22)
 
-		path = os.path.join(os.path.dirname(__file__), "modules")
-		print("module path:", path)
-		self.module_controller = Modules(path=path,
-			namepath="portage.sync.modules")
-		print(self.module_controller.module_names)
+		self.module_controller = portage.sync.module_controller
 		self.module_names = self.module_controller.module_names[:]
-		#self.module_names.insert(0, "all")
 
 
 	def get_modules(self, mod):


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [gentoo-commits] proj/portage:plugin-sync commit in: pym/portage/sync/, pym/_emerge/
@ 2014-09-03 23:36 Brian Dolbec
  0 siblings, 0 replies; 6+ messages in thread
From: Brian Dolbec @ 2014-09-03 23:36 UTC (permalink / raw
  To: gentoo-commits

commit:     4dec82d3f1149892f71fbda06725d821ae6fc996
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sat Mar 15 07:55:30 2014 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Wed Sep  3 23:34:52 2014 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=4dec82d3

portage/sync: Move the Modules, SyncManager initialization code

Move it to sync/__init__.py
This creates a central place to store a single instance of the SyncManager.
It also makes the module names available for use in repository/config.py for repos.conf checks.

---
 pym/_emerge/actions.py         |  8 ++++----
 pym/portage/sync/__init__.py   | 34 ++++++++++++++++++++++++++++++++++
 pym/portage/sync/controller.py |  8 +-------
 3 files changed, 39 insertions(+), 11 deletions(-)

diff --git a/pym/_emerge/actions.py b/pym/_emerge/actions.py
index 0bf3d66..92d1bc6 100644
--- a/pym/_emerge/actions.py
+++ b/pym/_emerge/actions.py
@@ -62,7 +62,9 @@ from portage.util._async.run_main_scheduler import run_main_scheduler
 from portage.util._async.SchedulerInterface import SchedulerInterface
 from portage.util._eventloop.global_event_loop import global_event_loop
 from portage._global_updates import _global_updates
-from portage.sync.controller import SyncManager
+from portage.sync import get_syncer
+from portage.sync.getaddrinfo_validate import getaddrinfo_validate
+from portage.sync.old_tree_timestamp import old_tree_timestamp_warn
 from portage.metadata import action_metadata
 
 from _emerge.clear_caches import clear_caches
@@ -81,8 +83,6 @@ from _emerge.Scheduler import Scheduler
 from _emerge.search import search
 from _emerge.SetArg import SetArg
 from _emerge.show_invalid_depstring_notice import show_invalid_depstring_notice
-from portage.sync.getaddrinfo_validate import getaddrinfo_validate
-from portage.sync.old_tree_timestamp import old_tree_timestamp_warn
 from _emerge.unmerge import unmerge
 from _emerge.UnmergeDepPriority import UnmergeDepPriority
 from _emerge.UseFlagDisplay import pkg_use_display
@@ -1878,7 +1878,7 @@ def action_sync(emerge_config, trees=DeprecationWarning,
 	else:
 		selected_repos.extend(emerge_config.target_config.settings.repositories)
 
-	sync_manager = SyncManager(emerge_config.target_config.settings, emergelog)
+	sync_manager = get_syncer(emerge_config.target_config.settings, emergelog)
 	retvals = []
 	for repo in selected_repos:
 		if repo.sync_type is not None:

diff --git a/pym/portage/sync/__init__.py b/pym/portage/sync/__init__.py
index 21a391a..65498ec 100644
--- a/pym/portage/sync/__init__.py
+++ b/pym/portage/sync/__init__.py
@@ -1,2 +1,36 @@
 # Copyright 2010 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
+
+import os
+
+from portage.emaint.module import Modules
+from portage.sync.controller import SyncManager
+
+sync_manager = None
+
+path = os.path.join(os.path.dirname(__file__), "modules")
+# initial development debug info
+print("module path:", path)
+
+module_controller = Modules(path=path, namepath="portage.sync.modules")
+
+# initial development debug info
+print(module_controller.module_names)
+module_names = module_controller.module_names[:]
+
+
+def get_syncer(settings=None, logger=None):
+	global sync_manager
+	if sync_manager and not settings and not logger:
+		return sync_manager
+	if settings is None:
+		from _emerge.actions import load_emerge_config
+		emerge_config = load_emerge_config()
+		settings = emerge_config.target_config.settings
+	if logger is None:
+		from _emerge.emergelog import emergelog as logger
+	sync_manager = SyncManager(settings, logger)
+	return sync_manager
+
+
+

diff --git a/pym/portage/sync/controller.py b/pym/portage/sync/controller.py
index 9e8c930..5d2a8f5 100644
--- a/pym/portage/sync/controller.py
+++ b/pym/portage/sync/controller.py
@@ -10,7 +10,6 @@ import pwd
 
 import portage
 from portage import os
-from portage.emaint.module import Modules
 from portage.emaint.progress import ProgressBar
 #from portage.emaint.defaults import DEFAULT_OPTIONS
 #from portage.util._argparse import ArgumentParser
@@ -84,13 +83,8 @@ class SyncManager(object):
 		# files have sane permissions.
 		os.umask(0o22)
 
-		path = os.path.join(os.path.dirname(__file__), "modules")
-		print("module path:", path)
-		self.module_controller = Modules(path=path,
-			namepath="portage.sync.modules")
-		print(self.module_controller.module_names)
+		self.module_controller = portage.sync.module_controller
 		self.module_names = self.module_controller.module_names[:]
-		#self.module_names.insert(0, "all")
 
 
 	def get_modules(self, mod):


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2014-09-03 23:36 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-09-03 23:36 [gentoo-commits] proj/portage:plugin-sync commit in: pym/portage/sync/, pym/_emerge/ Brian Dolbec
  -- strict thread matches above, loose matches on Subject: below --
2014-06-16 22:45 Brian Dolbec
2014-06-16 15:46 Brian Dolbec
2014-05-02 23:13 Brian Dolbec
2014-04-22  2:36 Brian Dolbec
2014-03-15  8:01 Brian Dolbec

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox