* [gentoo-commits] proj/layman:master commit in: etc/, layman/, layman/overlays/
@ 2015-03-27 0:11 Devan Franchini
0 siblings, 0 replies; only message in thread
From: Devan Franchini @ 2015-03-27 0:11 UTC (permalink / raw
To: gentoo-commits
commit: e594083c13392b0a539acf74d09d8762dce76d23
Author: Devan Franchini <twitch153 <AT> gentoo <DOT> org>
AuthorDate: Fri Mar 27 00:07:58 2015 +0000
Commit: Devan Franchini <twitch153 <AT> gentoo <DOT> org>
CommitDate: Fri Mar 27 00:08:01 2015 +0000
URL: https://gitweb.gentoo.org/proj/layman.git/commit/?id=e594083c
Renames protocol_order to protocol_filter
The config/cli flag name "protocol_order" has been changed to
"protocol_filter" in an attempt to provide a more suitable name for
users. The description of the option has been altered as well to provide
a more fitting elaboration on what the option actually does.
overlay.py: Calls filter_protocols from self to prevent run-time errors.
etc/layman.cfg | 8 ++++----
layman/argsparser.py | 28 +++++++++++++---------------
layman/config.py | 2 +-
layman/overlays/overlay.py | 16 ++++++++--------
4 files changed, 26 insertions(+), 28 deletions(-)
diff --git a/etc/layman.cfg b/etc/layman.cfg
index 9580d33..f289aa7 100644
--- a/etc/layman.cfg
+++ b/etc/layman.cfg
@@ -66,10 +66,10 @@ conf_type : repos.conf
#-----------------------------------------------------------
#-----------------------------------------------------------
-# Protocols used by layman and the order in which layman will
-# handle them.
-# ex.) protocol_order : git, http, https, etc,...
-# protocol_order :
+# Protocols used by layman when adding overlays or updating
+# their URLs.
+# ex.) protocol_filter : git, http, https, etc,...
+# protocol_filter :
#-----------------------------------------------------------
# URLs of the remote lists of overlays (one per line) or
diff --git a/layman/argsparser.py b/layman/argsparser.py
index eede806..f3cc8fa 100644
--- a/layman/argsparser.py
+++ b/layman/argsparser.py
@@ -265,13 +265,11 @@ class ArgsParser(BareConfig):
# Additional Options
etc_opts = self.parser.add_argument_group('<Additional options>')
- etc_opts.add_argument('--protocol_order',
+ etc_opts.add_argument('--protocol_filter',
nargs = '+',
- help = 'Sets the order in which protocols will '
- 'be handled if they are present. Will only '
- 'use the provided protocols when installing '
- 'overlays')
-
+ help = 'Sets the protocol filter that determines '
+ 'which protocols will be used when adding '
+ 'overlays or updating their source URLs.')
#-----------------------------------------------------------------
# Debug Options
@@ -359,17 +357,17 @@ class ArgsParser(BareConfig):
if storage:
return storage
- if key == 'protocol_order':
- protocol_order = []
+ if key == 'protocol_filter':
+ protocol_filter = []
if (key in self.options.keys()
and not self.options[key] is None):
- protocol_order = self.options[key]
- if self.config.has_option('MAIN', 'protocol_order'):
- protocol_order = self.config.get('MAIN', 'protocol_order')
- if protocol_order:
- if not isinstance(protocol_order, list):
- protocol_order = [e.strip() for e in protocol_order.split(',')]
- return protocol_order
+ protocol_filter = self.options[key]
+ if self.config.has_option('MAIN', 'protocol_filter'):
+ protocol_filter = self.config.get('MAIN', 'protocol_filter')
+ if protocol_filter:
+ if not isinstance(protocol_filter, list):
+ protocol_filter = [e.strip() for e in protocol_filter.split(',')]
+ return protocol_filter
if key == 'overlays':
overlays = ''
diff --git a/layman/config.py b/layman/config.py
index 926b9d5..c045320 100644
--- a/layman/config.py
+++ b/layman/config.py
@@ -96,7 +96,7 @@ class BareConfig(object):
'cache' : '%(storage)s/cache',
'local_list': '%(storage)s/overlays.xml',
'installed': '%(storage)s/installed.xml',
- 'protocol_order': [],
+ 'protocol_filter': [],
'auto_sync': 'No',
'check_official': 'Yes',
'conf_type': 'repos.conf',
diff --git a/layman/overlays/overlay.py b/layman/overlays/overlay.py
index fa728f6..1ecd509 100755
--- a/layman/overlays/overlay.py
+++ b/layman/overlays/overlay.py
@@ -71,15 +71,15 @@ class Overlay(object):
def filter_protocols(self, sources):
'''
- Filters any protocols not specified in self.config['protocol_order']
+ Filters any protocols not specified in self.config['protocol_filter']
from the overlay's sources.
'''
_sources = []
- if not self.config['protocol_order']:
+ if not self.config['protocol_filter']:
return sources
for source in sources:
- for protocol in self.config['protocol_order']:
+ for protocol in self.config['protocol_filter']:
protocol = protocol.lower()
#re.search considers "\+" as the literal "+".
if protocol == 'git+ssh':
@@ -402,11 +402,11 @@ class Overlay(object):
res = 1
first_s = True
- self.sources = filter_protocols(self.sources)
+ self.sources = self.filter_protocols(self.sources)
if not self.sources:
msg = 'Overlay.add() error: overlay "%s" does not support the'\
' given\nprotocol(s) %s and cannot be installed.'\
- % (self.name, str(self.config['protocol_order']))
+ % (self.name, str(self.config['protocol_filter']))
self.output.error(msg)
return 1
@@ -430,12 +430,12 @@ class Overlay(object):
first_src = True
result = False
- self.sources = filter_protocols(self.sources)
- available_srcs = filter_protocols(available_srcs)
+ self.sources = self.filter_protocols(self.sources)
+ available_srcs = self.filter_protocols(available_srcs)
if not self.sources or not available_srcs:
msg = 'Overlay.update() error: overlay "%s" does not support the'\
'given protocol(s) %s and cannot be updated.'\
- % (self.name, str(self.config['protocol_order']))
+ % (self.name, str(self.config['protocol_filter']))
self.output.error(msg)
return 1
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2015-03-27 0:12 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-27 0:11 [gentoo-commits] proj/layman:master commit in: etc/, layman/, layman/overlays/ Devan Franchini
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox