|
215 | 215 | }
|
216 | 216 |
|
217 | 217 | # Unfortunately this is the smartest way of getting the latest available package version with pip as of now
|
218 |
| - # Note: we DO need to repeat ourselves with "from version" in both grep and sed as on some systems pip returns |
219 |
| - # more than one line with paretheses. |
220 |
| - $latest_version = join([ |
221 |
| - "${pip_install} ${legacy_resolver} ${pypi_index} ${pypi_extra_index} ${proxy_flag}", |
222 |
| - " ${install_args} ${install_editable} '${real_pkgname}==9!0dev0+x' 2>&1", |
223 |
| - " | sed -nE 's/.*\\(from versions: (.*, )*(.*)\\)/\\2/p'", |
224 |
| - ' | tr -d "[:space:]"', |
225 |
| - ]) |
| 218 | + if $install_args and $install_args =~ /--pre/ { |
| 219 | + $latest_version = join([ |
| 220 | + "${pip_install} ${legacy_resolver} ${pypi_index} ${pypi_extra_index} ${proxy_flag}", |
| 221 | + " ${install_args} ${install_editable} ${real_pkgname}==9!0dev0+x 2>&1", |
| 222 | + " | sed -nE 's/.*\\(from versions: (.*, )*(.*)\\)/\\2/p'", |
| 223 | + ' | tr -d "[:space:]"', |
| 224 | + ]) |
| 225 | + } else { |
| 226 | + $latest_version = join([ |
| 227 | + "${pip_install} ${legacy_resolver} ${pypi_index} ${pypi_extra_index} ${proxy_flag}", |
| 228 | + " ${install_args} ${install_editable} ${real_pkgname}==9!0dev0+x 2>&1", |
| 229 | + " | sed -nE 's/.*\\(from versions: ([^\\)]*)\\)/\\1/p'", |
| 230 | + ' | awk \'BEGIN {RS=", "} {if ($0 !~ /(a|b|rc|dev)/) {gsub(/\n/,"");stable[arraylen++]=$0}} END {print stable[arraylen-1] }\'', |
| 231 | + ]) |
| 232 | + } |
226 | 233 |
|
227 | 234 | # Packages with underscores in their names are listed with dashes in their place in `pip freeze` output
|
228 | 235 | $pkgname_with_dashes = regsubst($real_pkgname, '_', '-', 'G')
|
|
0 commit comments