read dependency/conflict/architecture metadata from "info"
authorTimo Savola <tsavola@movial.fi>
Tue, 5 Aug 2008 08:59:19 +0000 (11:59 +0300)
committerTimo Savola <tsavola@movial.fi>
Tue, 5 Aug 2008 08:59:19 +0000 (11:59 +0300)
the package name is taken directly from the component name.  the
multi-package/custom-package-name support is now a special case: if
*.package files are present, "info" won't be used.

matrix/components.py

index e31165f..cc11c0c 100644 (file)
@@ -119,24 +119,30 @@ def to_seq(value):
        return value
 
 def init_packages(c, targets, packages):
+       # custom/multiple packages
        for path in glob(os.path.join(c.meta.path, '*.package')):
                name = os.path.basename(path)[:-8]
+               add_package(c, packages, name, path)
 
-               pkg = parse_package(name, c, path)
-               if not pkg:
-                       continue
-
-               c.packages[name] = pkg
-               packages[name] = pkg
-
-               if config.debug:
-                       print 'Component', c.name, 'provides', name
+       if not c.packages:
+               # default package
+               path = os.path.join(c.meta.path, 'info')
+               if os.path.exists(path):
+                       add_package(c, packages, c.name, path)
+       elif config.debug:
+               print 'Component', c.name, 'provides:', ' '.join(c.packages)
 
        if c.packages:
                targets.append(c.name)
        elif config.debug:
                print 'Component', c.name, 'does not provide any packages'
 
+def add_package(c, packages, name, path):
+       pkg = parse_package(name, c, path)
+       if pkg:
+               c.packages[name] = pkg
+               packages[name] = pkg
+
 def parse_package(name, component, path):
        pkg = Package(name, component)
        execfile(path, pkg.__dict__, pkg.__dict__)