Beispiel #1
0
def list_modules(directory, **kwargs):
    """Lists all of the modules, excluding __init__.py, in
       a particular directory."""
    list_directories = kwargs.setdefault('directories', True)

    for name in os.listdir(directory):
        if name == '__init__.py':
            continue

        path = new_path(directory, name)
        if list_directories and os.path.isdir(path):
            init_py = new_path(path, '__init__.py')
            if os.path.isfile(init_py):
                yield name

        elif name.endswith('.py'):
            if not any(re.search(pattern, name) for pattern in ignore_modules):
                yield re.sub('.py$', '', name)
Beispiel #2
0
 def __init__(self, prefix):
     self.prefix = prefix
     self.bin     = new_path(self.prefix, 'bin')
     self.sbin    = new_path(self.prefix, 'sbin')
     self.etc     = new_path(self.prefix, 'etc')
     self.include = new_path(self.prefix, 'include')
     self.lib     = new_path(self.prefix, 'lib')
     self.lib64   = new_path(self.prefix, 'lib64')
     self.libexec = new_path(self.prefix, 'libexec')
     self.share   = new_path(self.prefix, 'share')
     self.doc     = new_path(self.share, 'doc')
     self.info    = new_path(self.share, 'info')
     self.man     = new_path(self.share, 'man')
     self.man1    = new_path(self.man, 'man1')
     self.man2    = new_path(self.man, 'man2')
     self.man3    = new_path(self.man, 'man3')
     self.man4    = new_path(self.man, 'man4')
     self.man5    = new_path(self.man, 'man5')
     self.man6    = new_path(self.man, 'man6')
     self.man7    = new_path(self.man, 'man7')
     self.man8    = new_path(self.man, 'man8')
Beispiel #3
0
 def __new__(cls, path):
     s = super(Prefix, cls).__new__(cls, path)
     s.bin     = new_path(s, 'bin')
     s.sbin    = new_path(s, 'sbin')
     s.etc     = new_path(s, 'etc')
     s.include = new_path(s, 'include')
     s.lib     = new_path(s, 'lib')
     s.lib64   = new_path(s, 'lib64')
     s.libexec = new_path(s, 'libexec')
     s.share   = new_path(s, 'share')
     s.doc     = new_path(s.share, 'doc')
     s.info    = new_path(s.share, 'info')
     s.man     = new_path(s.share, 'man')
     s.man1    = new_path(s.man, 'man1')
     s.man2    = new_path(s.man, 'man2')
     s.man3    = new_path(s.man, 'man3')
     s.man4    = new_path(s.man, 'man4')
     s.man5    = new_path(s.man, 'man5')
     s.man6    = new_path(s.man, 'man6')
     s.man7    = new_path(s.man, 'man7')
     s.man8    = new_path(s.man, 'man8')
     return s
Beispiel #4
0
def filename_for_package_name(pkg_name):
    """Get the filename where a package name should be stored."""
    validate_package_name(pkg_name)
    return new_path(spack.packages_path, "%s.py" % pkg_name)