Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: 3.x-dev can install a 3.y version #417

Merged
merged 2 commits into from
Jun 8, 2022
Merged

Conversation

mayeut
Copy link
Contributor

@mayeut mayeut commented Jun 5, 2022

Description:
Rework desugarDevVersion so that 3.x-dev cannot end up with 3.y/4.x installed.
It still does not do what one would expect (include pre-release even if there's a stable release - would require actions/toolkit#709 to be fixed) but it was already the case & python-versions does not build pre-releases for minor versions once a stable release exists, so it does not matter much (but going with mitigates rather than fix below).

Related issue:
mitigates #416

Check list:

  • Mark if documentation changes are required.
  • Mark if tests were added or updated to cover the changes.

@mayeut mayeut requested a review from a team June 5, 2022 11:46
@vsafonkin
Copy link

Hi @mayeut, could you please update README note about -dev syntax?

- Use `-dev` instead of a patch number (e.g., `3.11-dev`) to install the latest release of a patch version, *alpha and beta releases included

@mayeut
Copy link
Contributor Author

mayeut commented Jun 6, 2022

could you please update README note about -dev syntax?

@vsafonkin,
what should it be changed to ? the implementation is just being fixed, should not change the doc. unless you want to account for the fact that alpha and beta are not included once a stable version exists in which case:

- Use `-dev` instead of a patch number (e.g., `3.11-dev`) to install the latest release of a patch version, *alpha and beta releases included if no stable version exists*

@vsafonkin
Copy link

@mayeut, I mean to install the latest release of a minor version -> to install the latest release of a patch version replacing

@mayeut
Copy link
Contributor Author

mayeut commented Jun 6, 2022

It was clear for me with minor, I find it unclear with your proposal. How about:
to install the latest release of a minor version -> to install the latest patch version release for a given minor version

If what the patch is doing is unclear using 3.10-dev as an example:

import * as semver from 'semver';

function check(version: string, range: string) {
  const statified = semver.satisfies(version, range);
  const expected = semver.satisfies(version, "~3.10.0-0", {includePrerelease: true});
  if (expected !== statified) {
    console.error(`FAIL: ${version} statifies ${range} returned ${statified}, expected ${expected}`)
  }
  else {
    console.log(`PASS: ${version} statifies ${range} returned ${statified}, expected ${expected}`)
  }
}

for (const range of [">= 3.10.0-a0", "~3.10.0-0"]) {
  for (const version of ["3.9.9", "3.10.0-alpha.1", "3.10.0", "3.10.1-alpha.1", "3.10.1", "3.11.0-alpha.1", "3.11.0"]) {
    check(version, range);
  }
}

before PR (>= 3.10.0-a0):

PASS: 3.9.9 statifies >= 3.10.0-a0 returned false, expected false 
PASS: 3.10.0-alpha.1 statifies >= 3.10.0-a0 returned true, expected true 
PASS: 3.10.0 statifies >= 3.10.0-a0 returned true, expected true 
FAIL: 3.10.1-alpha.1 statifies >= 3.10.0-a0 returned false, expected true
PASS: 3.10.1 statifies >= 3.10.0-a0 returned true, expected true 
PASS: 3.11.0-alpha.1 statifies >= 3.10.0-a0 returned false, expected false 
FAIL: 3.11.0 statifies >= 3.10.0-a0 returned true, expected false

with the PR (~3.10.0-0):

PASS: 3.9.9 statifies ~3.10.0-0 returned false, expected false 
PASS: 3.10.0-alpha.1 statifies ~3.10.0-0 returned true, expected true 
PASS: 3.10.0 statifies ~3.10.0-0 returned true, expected true 
FAIL: 3.10.1-alpha.1 statifies ~3.10.0-0 returned false, expected true
PASS: 3.10.1 statifies ~3.10.0-0 returned true, expected true 
PASS: 3.11.0-alpha.1 statifies ~3.10.0-0 returned false, expected false 
PASS: 3.11.0 statifies ~3.10.0-0 returned false, expected false

@vsafonkin
Copy link

@mayeut, great, thank you!

@vsafonkin vsafonkin merged commit d09bd5e into actions:main Jun 8, 2022
@mayeut mayeut deleted the fix-dev branch June 8, 2022 20:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants