From 0d580e0b195727d9efd5912f74d1de3c2b9169ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Romain=20Tarti=C3=A8re?= Date: Mon, 1 Jan 2024 12:08:01 -1000 Subject: [PATCH] Make latest version detection portable This is currently broken on FreeBSD do to the usage of GNU-grep specific grep(1) flag: `-P`. We can use a single sed(1) command with an extended regular expression to achieve the same goal, so use this instead. --- manifests/pip.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifests/pip.pp b/manifests/pip.pp index 199e7925..a7ee7a2f 100644 --- a/manifests/pip.pp +++ b/manifests/pip.pp @@ -220,7 +220,7 @@ $latest_version = join([ "${pip_install} ${legacy_resolver} ${pypi_index} ${pypi_extra_index} ${proxy_flag}", " ${install_args} ${install_editable} ${real_pkgname}==notreallyaversion 2>&1", - ' | grep -oP "\(from versions: .*\)" | sed -E "s/\(from versions: (.*?, )*(.*)\)/\2/g"', + " | sed -nE 's/.*\\(from versions: (.*, )*(.*)\\)/\\2/p'", ' | tr -d "[:space:]"', ])