mirror of
https://github.com/Mic92/nix-update.git
synced 2024-09-17 13:27:27 +03:00
Try pkg.meta.position before unsafeGetAttrPos
Fixes `nixpkgs.mpvScripts.*`, discovered while reviewing https://github.com/NixOS/nixpkgs/pull/308062
This commit is contained in:
parent
cafad8ced8
commit
63b5a4e989
@ -142,13 +142,22 @@ def eval_expression(
|
|||||||
return f"""
|
return f"""
|
||||||
let
|
let
|
||||||
{indent(dedent(let_bindings), " ")}
|
{indent(dedent(let_bindings), " ")}
|
||||||
|
positionFromMeta = pkg: let
|
||||||
|
parts = builtins.match "(.*):([0-9]+)" pkg.meta.position;
|
||||||
|
in {{
|
||||||
|
file = builtins.elemAt parts 0;
|
||||||
|
line = builtins.fromJSON (builtins.elemAt parts 1);
|
||||||
|
}};
|
||||||
|
|
||||||
raw_version_position = sanitizePosition (builtins.unsafeGetAttrPos "version" pkg);
|
raw_version_position = sanitizePosition (builtins.unsafeGetAttrPos "version" pkg);
|
||||||
|
|
||||||
position = if pkg ? isRubyGem then
|
position = if pkg ? meta.position then
|
||||||
|
sanitizePosition (positionFromMeta pkg)
|
||||||
|
else if pkg ? isRubyGem then
|
||||||
raw_version_position
|
raw_version_position
|
||||||
else if pkg ? isPhpExtension then
|
else if pkg ? isPhpExtension then
|
||||||
raw_version_position
|
raw_version_position
|
||||||
else
|
else
|
||||||
sanitizePosition (builtins.unsafeGetAttrPos "src" pkg);
|
sanitizePosition (builtins.unsafeGetAttrPos "src" pkg);
|
||||||
in {{
|
in {{
|
||||||
name = pkg.name;
|
name = pkg.name;
|
||||||
|
Loading…
Reference in New Issue
Block a user