jhbuild r2144 - in trunk: . jhbuild jhbuild/commands
- From: fpeters svn gnome org
- To: svn-commits-list gnome org
- Subject: jhbuild r2144 - in trunk: . jhbuild jhbuild/commands
- Date: Sun, 22 Jun 2008 13:59:24 +0000 (UTC)
Author: fpeters
Date: Sun Jun 22 13:59:24 2008
New Revision: 2144
URL: http://svn.gnome.org/viewvc/jhbuild?rev=2144&view=rev
Log:
* jhbuild/commands/base.py, jhbuild/commands/info.py,
jhbuild/commands/rdepends.py, jhbuild/moduleset.py: made module names
entered by the user insensitive to case. (closes: #538790)
Modified:
trunk/ChangeLog
trunk/jhbuild/commands/base.py
trunk/jhbuild/commands/info.py
trunk/jhbuild/commands/rdepends.py
trunk/jhbuild/moduleset.py
Modified: trunk/jhbuild/commands/base.py
==============================================================================
--- trunk/jhbuild/commands/base.py (original)
+++ trunk/jhbuild/commands/base.py Sun Jun 22 13:59:24 2008
@@ -107,7 +107,7 @@
module_set = jhbuild.moduleset.load(config)
try:
- module_list = [module_set.modules[modname] for modname in args]
+ module_list = [module_set.get_module(modname, ignore_case = True) for modname in args]
except KeyError, e:
raise FatalError(_("A module called '%s' could not be found.")
% str(e))
@@ -294,7 +294,7 @@
module_set = jhbuild.moduleset.load(config)
try:
- module_list = [module_set.modules[modname] for modname in args]
+ module_list = [module_set.get_module(modname, ignore_case = True) for modname in args]
except KeyError, e:
raise FatalError(_("A module called '%s' could not be found.")
% str(e))
@@ -335,7 +335,8 @@
if options.in_builddir:
module_set = jhbuild.moduleset.load(config)
try:
- module_list = [module_set.modules[options.in_builddir]]
+ module_list = [module_set.get_module(options.in_builddir, ignore_case = True)
+ for modname in args]
except KeyError, e:
raise FatalError(_("A module called '%s' could not be found.") % e)
Modified: trunk/jhbuild/commands/info.py
==============================================================================
--- trunk/jhbuild/commands/info.py (original)
+++ trunk/jhbuild/commands/info.py Sun Jun 22 13:59:24 2008
@@ -49,7 +49,7 @@
if args:
for modname in args:
try:
- module = module_set.modules[modname]
+ module = module_set.modules.get_module(modname, ignore_case = True)
except KeyError:
raise FatalError(_('unknown module %s') % modname)
self.show_info(module, packagedb, module_set)
Modified: trunk/jhbuild/commands/rdepends.py
==============================================================================
--- trunk/jhbuild/commands/rdepends.py (original)
+++ trunk/jhbuild/commands/rdepends.py Sun Jun 22 13:59:24 2008
@@ -45,7 +45,7 @@
if not args:
self.parser.error(_('This command requires a module parameter.'))
- modname = args[0]
+ modname = module_set.get_module(args[0], ignore_case = True).name
# get all modules but those that are a dependency of modname
dependencies_list = [x.name for x in module_set.get_module_list([modname])]
Modified: trunk/jhbuild/moduleset.py
==============================================================================
--- trunk/jhbuild/moduleset.py (original)
+++ trunk/jhbuild/moduleset.py Sun Jun 22 13:59:24 2008
@@ -37,12 +37,26 @@
__all__ = ['load', 'load_tests']
class ModuleSet:
- def __init__(self):
+ def __init__(self, config = None):
+ self.config = config
self.modules = {}
def add(self, module):
'''add a Module object to this set of modules'''
self.modules[module.name] = module
+ def get_module(self, module_name, ignore_case = False):
+ if self.modules.has_key(module_name) or not ignore_case:
+ return self.modules[module_name]
+ module_name = module_name.lower()
+ for module in self.modules.keys():
+ if module.lower() == module_name:
+ if self.config is None or not self.config.quiet_mode:
+ print >> sys.stderr, uencode(
+ _('I: fixed case of module \'%(orig)s\' to \'%(new)s\'') % {
+ 'orig': module_name, 'new': module})
+ return self.modules[module]
+ raise KeyError()
+
def get_module_list(self, seed, skip=[], tags=[], ignore_cycles = False,
include_optional_modules = False):
'''gets a list of module objects (in correct dependency order)
@@ -50,7 +64,7 @@
if seed == 'all': seed = self.modules.keys()
try:
- all_modules = [self.modules[mod] for mod in seed if mod not in skip]
+ all_modules = [self.get_module(mod, ignore_case = True) for mod in seed if mod not in skip]
except KeyError, e:
raise UsageError(_('module "%s" not found') % str(e))
@@ -221,7 +235,7 @@
modulesets = config.moduleset
else:
modulesets = [ config.moduleset ]
- ms = ModuleSet()
+ ms = ModuleSet(config = config)
for uri in modulesets:
if '/' not in uri:
uri = os.path.join(os.path.dirname(__file__), '..', 'modulesets',
@@ -231,7 +245,7 @@
def load_tests (config, uri=None):
ms = load (config, uri)
- ms_tests = ModuleSet()
+ ms_tests = ModuleSet(config = config)
for app, module in ms.modules.iteritems():
if module.__class__ == testmodule.TestModule:
ms_tests.modules[app] = module
@@ -259,7 +273,7 @@
raise FatalError(_('failed to parse %s: %s') % (filename, str(e)))
assert document.documentElement.nodeName == 'moduleset'
- moduleset = ModuleSet()
+ moduleset = ModuleSet(config = config)
moduleset_name = document.documentElement.getAttribute('name')
if not moduleset_name and uri.endswith('.modules'):
moduleset_name = os.path.basename(uri)[:-len('.modules')]
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]