def conflicts(self): """List of conflicts for the tcl module file.""" fmts = [] projection = proj.get_projection(self.conf.projections, self.spec) f = string.Formatter() for item in self.conf.conflicts: if len([x for x in f.parse(item)]) > 1: for naming_dir, conflict_dir in zip( projection.split('/'), item.split('/') ): if naming_dir != conflict_dir: message = 'conflict scheme does not match naming ' message += 'scheme [{spec}]\n\n' message += 'naming scheme : "{nformat}"\n' message += 'conflict scheme : "{cformat}"\n\n' message += '** You may want to check your ' message += '`modules.yaml` configuration file **\n' tty.error(message.format(spec=self.spec, nformat=projection, cformat=item)) raise SystemExit('Module generation aborted.') item = self.spec.format(item) fmts.append(item) # Substitute spec tokens if present return [self.spec.format(x) for x in fmts]
def use_name(self): """Returns the 'use' name of the module i.e. the name you have to type to console to use it. This implementation fits the needs of most non-hierarchical layouts. """ projection = proj.get_projection(self.conf.projections, self.spec) if not projection: projection = self.conf.default_projections['all'] name = self.spec.format(projection) # Not everybody is working on linux... parts = name.split('/') name = os.path.join(*parts) # Add optional suffixes based on constraints path_elements = [name] + self.conf.suffixes return '-'.join(path_elements)