Handles cases where developers ""cannot"" put their initial modules in

other files.

Imports of imported attribute set are not working anymore because this
feature is hard to maintain and because this a potential source of error.

Imports are only accepted inside named modules where the system has some
control over mutual inclusion.

svn path=/nixpkgs/trunk/; revision=17144
This commit is contained in:
Nicolas Pierron 2009-09-15 00:21:39 +00:00
parent a593492d4f
commit 37ce2ca949

View File

@ -64,22 +64,20 @@ rec {
moduleClosure = initModules: args:
let
moduleImport = m: lib.addErrorContext
"Import module ${(if builtins.isAttrs m then "{...}" else m)}." (
(unifyModuleSyntax (applyIfFunction
(if builtins.isAttrs m then m else import m) args)) // {
moduleImport = m:
(unifyModuleSyntax (applyIfFunction (importIfPath m) args)) // {
# used by generic closure to avoid duplicated imports.
key = m;
paths = [ m ];
}
);
key = if isPath m then m else
/bad/developer/implies/bad/error/messages;
};
getImports = m: attrByPath ["imports"] [] m;
in
lazyGenericClosure {
startSet = map moduleImport initModules;
(lazyGenericClosure {
startSet = map moduleImport (filter isPath initModules);
operator = m: map moduleImport (getImports m);
};
}) ++ (map moduleImport (filter (m: ! isPath m) initModules));
selectDeclsAndDefs = modules:
lib.concatMap (m: