Esempio n. 1
0
 def resolve_glob(self):
     """Expand any glob pattern in the files section relatively to the
     current value for source direcory."""
     files = []
     for f in self.files:
         files.extend(expand_glob(f, self.source_dir))
     return files
Esempio n. 2
0
def file_list(pkg, top_node):
    root_src = top_node.abspath()

    files = []
    for entry in pkg.extra_source_files:
        try:
            files.extend(expand_glob(entry, root_src))
        except IOError, e:
            raise InvalidPackage("Error in ExtraSourceFiles entry: %s" % e)
Esempio n. 3
0
 def test_simple(self):
     # Test simple pattern matching
     d = tempfile.mkdtemp("flopflop")
     try:
         open(op.join(d, "foo1.py"), "w").close()
         open(op.join(d, "foo2.py"), "w").close()
         f = sorted(expand_glob("*.py", d))
         self.assertEqual(f, ["foo1.py", "foo2.py"])
     finally:
         shutil.rmtree(d)
Esempio n. 4
0
 def test_simple2(self):
     # Test another pattern matching, with pattern including directory
     d = tempfile.mkdtemp("flopflop")
     try:
         os.makedirs(op.join(d, "common"))
         open(op.join(d, "common", "foo1.py"), "w").close()
         open(op.join(d, "common", "foo2.py"), "w").close()
         f = sorted(expand_glob(op.join("common", "*.py"), d))
         self.assertEqual(f, [op.join("common", "foo1.py"), op.join("common", "foo2.py")])
     finally:
         shutil.rmtree(d)
Esempio n. 5
0
 def normalize_paths(compiled_modules):
     if not compiled_modules:
         return {}
     else:
         for ext in compiled_modules.values():
             sources = []
             for s in ext.sources:
                 if isinstance(s, basestring):
                     sources.extend(expand_glob(s))
                 else:
                     print s
             if os.sep != "/":
                 sources = [unnormalize_path(s) for s in ext.sources]
             ext.sources = sources
         return compiled_modules
Esempio n. 6
0
    for p in get_packages(pkg, top_node):
        files.extend(find_package(p, top_node))

    for m in pkg.py_modules:
        m_node = top_node.find_node("%s.py" % m)
        files.append(m_node.path_from(top_node))

    extensions = get_extensions(pkg, top_node)
    libraries = get_compiled_libraries(pkg, top_node)
    for e in extensions.values() + libraries.values():
        for source in e.sources:
            node = top_node.find_node(source)
            files.append(node.path_from(top_node))
    for section in pkg.data_files.values():
        for entry in section.files:
            for f in expand_glob(entry, os.path.join(root_src, section.source_dir)):
                node = top_node.find_node(os.path.join(section.source_dir, f))
                files.append(node.path_from(top_node))

    return files

def static_representation(pkg, options={}):
    """Return the static representation of the given PackageDescription
    instance as a string."""
    indent_level = 4
    r = []

    def indented_list(head, seq, ind):
        r.append("%s%s:" % (' ' * (ind - 1) * indent_level, head))
        r.append(',\n'.join([' ' * ind * indent_level + i for i in seq]))