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

gh-deploy version check issue #1879

Closed
ghost opened this issue Oct 10, 2019 · 2 comments
Closed

gh-deploy version check issue #1879

ghost opened this issue Oct 10, 2019 · 2 comments
Labels

Comments

@ghost
Copy link

@ghost ghost commented Oct 10, 2019

I'm using dev version of mkdocs, cloned from trunk. After first mkdocs gh-deploy is done, subsequent gh-deploys display the following error:

ERROR - Deployment terminated: Previous deployment was made with MkDocs version 1.1; you are attempting to deploy with an older version (1.1.dev0). Use --ignore-version to deploy anyway.

I can perform the deploy using --ignore-version, but since 1.1 is not released yet 1.1.dev0 should not be calculated as 1.1.

@waylan
Copy link
Member

@waylan waylan commented Oct 10, 2019

Thanks for the report. I can confirm that this is a bug, but only when not using official final releases. It appears that the problem is that we are ignoring the .dev0 portion of the version used for the previous deployment. At mkdocs/commands/gh_deploy.py#L61-L62 we have:

m = re.search(r'\d+(\.\d+)+', msg, re.X | re.I)
previousv = parse_version(m.group()) if m else None

Note that the regex for the "previous version" does not capture .dev0, but only 1.1 from the full version 1.1.dev0. Therefore, pkg_resources is reporting (correctly from its perspective) that 1.1 is greater than the "current version" (1.1.dev0). Of course, we should be capturing and passing in 1.1.dev0 for the "previous version," which would correctly result in the previous and current versions being equal.

To fix the issue, we need a more complete regex to capture the entire version string. All allowed version strings and the proper sort order is defined in PEP440. Presumably, the regex would capture anything allowed there. Its important to note that "pre" ("alpha," "beta," and "release candidate") and "post" releases, which could all be official releases would also exhibit this bug, so its not just the dev version and warrants a proper fix. That said, MkDocs does not make a practice of doing "pre" and "post" releases, so the priority is not as high as it might be otherwise. Of course, a PR is welcome as always.

@waylan waylan added the Bug label Oct 10, 2019
@ghost
Copy link
Author

@ghost ghost commented Oct 10, 2019

I propose the following regex for this issue. It is not fully compliant with the PEP but I think it is good enough:

re.search(r'\d+(\.\d+)+(((a|b|rc)|\.post|\.dev)\d+)*', msg, re.X | re.I)

@ghost ghost closed this as completed Oct 10, 2019
@waylan waylan reopened this Oct 10, 2019
@waylan waylan closed this as completed in 60451b7 Oct 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant