getVersion: first try drv.version before parsing drv.name

This commit is contained in:
Domen Kožar 2016-08-13 17:16:37 +02:00
parent a7f8787dbd
commit 661415d4eb

View File

@ -372,7 +372,12 @@ rec {
getVersion pkgs.youtube-dl
=> "2016.01.01"
*/
getVersion = x: (builtins.parseDrvName (x.name or x)).version;
getVersion = x:
let
parse = drv: (builtins.parseDrvName drv).version;
in if isString x
then parse x
else x.version or (parse x.name);
/* Extract name with version from URL. Ask for separator which is
supposed to start extension.