summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Maw <richard.maw@codethink.co.uk>2012-07-31 13:37:12 +0000
committerRichard Maw <richard.maw@codethink.co.uk>2012-08-01 13:15:42 +0000
commitec876f9ed332b2a50a34c8834e1ca4ed4813f39a (patch)
treeef2692a6ccde7a88365613bdf6203f3b197d2e50
parent581eec98112cd00507cfce7f52cf9833d7e2107c (diff)
downloadmorph-ec876f9ed332b2a50a34c8834e1ca4ed4813f39a.tar.gz
Publicize _itertriplets and _create_source_pool
itertriplets and create_source_pool are more convenient than doing it manually, and since they need to be used by plugins, they shouldn't be private. The private name is kept as an alias so that external plugins that were poking at the internals for convenience aren't broken.
-rwxr-xr-xmorphlib/app.py25
-rw-r--r--morphlib/plugins/graphing_plugin.py2
-rw-r--r--morphlib/plugins/show_dependencies_plugin.py4
3 files changed, 22 insertions, 9 deletions
diff --git a/morphlib/app.py b/morphlib/app.py
index 06e7eba2..3402e445 100755
--- a/morphlib/app.py
+++ b/morphlib/app.py
@@ -23,6 +23,7 @@ import os
import shutil
import tempfile
import time
+import warnings
import morphlib
@@ -76,7 +77,7 @@ class BuildCommand(object):
self.app.status(msg='Build starts', chatty=True)
- for repo_name, ref, filename in self.app._itertriplets(args):
+ for repo_name, ref, filename in self.app.itertriplets(args):
self.app.status(msg='Building %(repo_name)s %(ref)s %(filename)s',
repo_name=repo_name, ref=ref, filename=filename)
order = self.compute_build_order(repo_name, ref, filename)
@@ -148,7 +149,7 @@ class BuildCommand(object):
self.app.status(msg='Figuring out the right build order')
self.app.status(msg='Creating source pool', chatty=True)
- srcpool = self.app._create_source_pool(
+ srcpool = self.app.create_source_pool(
self.lrc, self.rrc, (repo_name, ref, filename))
self.app.status(msg='Creating artifact resolver', chatty=True)
@@ -480,7 +481,7 @@ class Morph(cliapp.Application):
self.system_kind_builder_factory = \
morphlib.builder2.SystemKindBuilderFactory()
- def _itertriplets(self, args):
+ def itertriplets(self, args):
'''Generate repo, ref, filename triples from args.'''
if (len(args) % 3) != 0:
@@ -491,7 +492,13 @@ class Morph(cliapp.Application):
yield args[0], args[1], args[2]
args = args[3:]
- def _create_source_pool(self, lrc, rrc, triplet):
+ def _itertriplets(self, *args):
+ warnings.warn('_itertriplets is deprecated, '
+ 'use itertriplets instead', stacklevel=1,
+ category=DeprecationWarning)
+ return self.itertriplets(*args)
+
+ def create_source_pool(self, lrc, rrc, triplet):
pool = morphlib.sourcepool.SourcePool()
def add_to_pool(reponame, ref, filename, absref, morphology):
@@ -504,6 +511,12 @@ class Morph(cliapp.Application):
visit=add_to_pool)
return pool
+ def _create_source_pool(self, *args):
+ warnings.warn('_create_source_pool is deprecated, '
+ 'use create_source_pool instead', stacklevel=1,
+ category=DeprecationWarning)
+ return self.create_source_pool(*args)
+
def cmd_build(self, args):
'''Build a binary from a morphology.
@@ -608,7 +621,7 @@ class Morph(cliapp.Application):
for submod in submodules:
subs_to_process.add((submod.url, submod.commit))
- self._traverse_morphs(self._itertriplets(args), cache, None,
+ self._traverse_morphs(self.itertriplets(args), cache, None,
update=True, visit=visit)
done = set()
@@ -671,7 +684,7 @@ class Morph(cliapp.Application):
source.filename == filename)
def get_artifact(repo_name, ref, filename):
- srcpool = self._create_source_pool(
+ srcpool = self.create_source_pool(
lrc, rrc, (repo_name, ref, filename))
ar = morphlib.artifactresolver.ArtifactResolver()
artifacts = ar.resolve_artifacts(srcpool)
diff --git a/morphlib/plugins/graphing_plugin.py b/morphlib/plugins/graphing_plugin.py
index ed949da1..5e25bd5c 100644
--- a/morphlib/plugins/graphing_plugin.py
+++ b/morphlib/plugins/graphing_plugin.py
@@ -31,7 +31,7 @@ class GraphingPlugin(cliapp.Plugin):
pass
def graph_build_depends(self, args):
- for repo_name, ref, filename in self.app._itertriplets(args):
+ for repo_name, ref, filename in self.app.itertriplets(args):
self.app.status(msg='Creating build order for '
'%(repo_name)s %(ref)s %(filename)s',
repo_name=repo_name, ref=ref, filename=filename)
diff --git a/morphlib/plugins/show_dependencies_plugin.py b/morphlib/plugins/show_dependencies_plugin.py
index ff78e392..e214a92f 100644
--- a/morphlib/plugins/show_dependencies_plugin.py
+++ b/morphlib/plugins/show_dependencies_plugin.py
@@ -48,8 +48,8 @@ class ShowDependenciesPlugin(cliapp.Plugin):
rrc = None
# traverse the morphs to list all the sources
- for repo, ref, filename in self.app._itertriplets(args):
- pool = self.app._create_source_pool(
+ for repo, ref, filename in self.app.itertriplets(args):
+ pool = self.app.create_source_pool(
lrc, rrc, (repo, ref, filename))
resolver = morphlib.artifactresolver.ArtifactResolver()