big breaking change: renaming lib.getAttr to lib.attrByPath

getAttr was ambiguous. It's also a builtin function

fix

svn path=/nixpkgs/trunk/; revision=15692
This commit is contained in:
Marc Weber
2009-05-24 10:57:41 +00:00
parent 62620f0411
commit f7f938a1d1
65 changed files with 153 additions and 140 deletions

View File

@@ -111,7 +111,7 @@ rec {
pairMap = innerPairMap [];
# shortcut for getAttr ["name"] default attrs
# shortcut for attrByPath ["name"] default attrs
maybeAttr = name: default: attrs:
if (__hasAttr name attrs) then (__getAttr name attrs) else default;
@@ -131,14 +131,14 @@ rec {
checkFlag = attrSet: name:
if (name == "true") then true else
if (name == "false") then false else
if (elem name (getAttr ["flags"] [] attrSet)) then true else
getAttr [name] false attrSet ;
if (elem name (attrByPath ["flags"] [] attrSet)) then true else
attrByPath [name] false attrSet ;
# Input : attrSet, [ [name default] ... ], name
# Output : its value or default.
getValue = attrSet: argList: name:
( getAttr [name] (if checkFlag attrSet name then true else
( attrByPath [name] (if checkFlag attrSet name then true else
if argList == [] then null else
let x = builtins.head argList; in
if (head x) == name then