Merge pull request #286117 from alois31/lib-deprecations
lib: make deprecation warnings consistent
This commit is contained in:
commit
63373eba60
5 changed files with 12 additions and 11 deletions
|
@ -3,7 +3,7 @@
|
|||
|
||||
let
|
||||
inherit (builtins) head tail length;
|
||||
inherit (lib.trivial) id mergeAttrs;
|
||||
inherit (lib.trivial) id mergeAttrs warn;
|
||||
inherit (lib.strings) concatStringsSep concatMapStringsSep escapeNixIdentifier sanitizeDerivationName;
|
||||
inherit (lib.lists) foldr foldl' concatMap concatLists elemAt all partition groupBy take foldl;
|
||||
in
|
||||
|
@ -1197,9 +1197,10 @@ rec {
|
|||
(x // y) // mask;
|
||||
|
||||
# DEPRECATED
|
||||
zipWithNames = zipAttrsWithNames;
|
||||
zipWithNames = warn
|
||||
"lib.zipWithNames is a deprecated alias of lib.zipAttrsWithNames." zipAttrsWithNames;
|
||||
|
||||
# DEPRECATED
|
||||
zip = builtins.trace
|
||||
"lib.zip is deprecated, use lib.zipAttrsWith instead" zipAttrsWith;
|
||||
zip = warn
|
||||
"lib.zip is a deprecated alias of lib.zipAttrsWith." zipAttrsWith;
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
{ lib }:
|
||||
let
|
||||
inherit (lib.strings) toInt;
|
||||
inherit (lib.trivial) compare min id;
|
||||
inherit (lib.trivial) compare min id warn;
|
||||
inherit (lib.attrsets) mapAttrs;
|
||||
inherit (lib.lists) sort;
|
||||
in
|
||||
|
@ -848,8 +848,8 @@ rec {
|
|||
crossLists (x:y: "${toString x}${toString y}") [[1 2] [3 4]]
|
||||
=> [ "13" "14" "23" "24" ]
|
||||
*/
|
||||
crossLists = builtins.trace
|
||||
"lib.crossLists is deprecated, use lib.cartesianProductOfSets instead"
|
||||
crossLists = warn
|
||||
"lib.crossLists is deprecated, use lib.cartesianProductOfSets instead."
|
||||
(f: foldl (fs: args: concatMap (f: map f args) fs) [f]);
|
||||
|
||||
|
||||
|
|
|
@ -379,7 +379,7 @@ rec {
|
|||
if ! isString text then throw "literalExpression expects a string."
|
||||
else { _type = "literalExpression"; inherit text; };
|
||||
|
||||
literalExample = lib.warn "literalExample is deprecated, use literalExpression instead, or use literalMD for a non-Nix description." literalExpression;
|
||||
literalExample = lib.warn "lib.literalExample is deprecated, use lib.literalExpression instead, or use lib.literalMD for a non-Nix description." literalExpression;
|
||||
|
||||
/* Transition marker for documentation that's already migrated to markdown
|
||||
syntax. This is a no-op and no longer needed.
|
||||
|
|
|
@ -561,7 +561,7 @@ rec {
|
|||
[""" "'" "<" ">" "&"];
|
||||
|
||||
# warning added 12-12-2022
|
||||
replaceChars = lib.warn "replaceChars is a deprecated alias of replaceStrings, replace usages of it with replaceStrings." builtins.replaceStrings;
|
||||
replaceChars = lib.warn "lib.replaceChars is a deprecated alias of lib.replaceStrings." builtins.replaceStrings;
|
||||
|
||||
# Case conversion utilities.
|
||||
lowerChars = stringToCharacters "abcdefghijklmnopqrstuvwxyz";
|
||||
|
@ -1133,7 +1133,7 @@ rec {
|
|||
"/prefix/nix-profiles-library-paths.patch"
|
||||
"/prefix/compose-search-path.patch" ]
|
||||
*/
|
||||
readPathsFromFile = lib.warn "lib.readPathsFromFile is deprecated, use a list instead"
|
||||
readPathsFromFile = lib.warn "lib.readPathsFromFile is deprecated, use a list instead."
|
||||
(rootPath: file:
|
||||
let
|
||||
lines = lib.splitString "\n" (readFile file);
|
||||
|
|
|
@ -230,7 +230,7 @@ in {
|
|||
else if lib.pathExists revisionFile then lib.fileContents revisionFile
|
||||
else default;
|
||||
|
||||
nixpkgsVersion = builtins.trace "`lib.nixpkgsVersion` is deprecated, use `lib.version` instead!" version;
|
||||
nixpkgsVersion = warn "lib.nixpkgsVersion is a deprecated alias of lib.version." version;
|
||||
|
||||
/* Determine whether the function is being called from inside a Nix
|
||||
shell.
|
||||
|
|
Loading…
Reference in a new issue