Skip to content

MAINT: handle case where GIT_VERSION is empty string #14548

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

Merged
merged 2 commits into from
Sep 23, 2019

Conversation

sethtroisi
Copy link
Contributor

Assert that git revision is not missing (as happened in #8512).
Parsing the bug (which is old) I don't believe this should ever assert unless in weird situations.

I'm also happy if people want to close the bug as obsolete

@seberg
Copy link
Member

seberg commented Sep 19, 2019

I doubt we should add an assert, what if someone downloads a tar and has no git. I thought we use UNKNOWN instead then?

@sethtroisi
Copy link
Contributor Author

@seberg I believe in that case GIT_REVISION is set to "Unknown" on line 116.

This case should never happen (hence it being an assert). If you don't believe this is needed we can just close #8512, if you believe #8512 might happen again that this should prevent headache when it does.

@seberg
Copy link
Member

seberg commented Sep 19, 2019

Ah OK, maybe we can raise an informative error though, since it apparently did happen?

@rgommers
Copy link
Member

If you don't believe this is needed we can just close #8512, if you believe #8512 might happen again that this should prevent headache when it does.

I don't think we should add this. It takes some corner case with unknown root cause that's inconsequential (one test failure) and turns it into a build failure. Plus it doesn't actually fix the issue. I'd much rather change it to

if not GIT_REVISION:
    # this shouldn't happen but apparently can (see gh-8512)
    FULLVERSION += '.dev0'
else:
    FULLVERSION += '.dev0+' + GIT_REVISION[:7]

@charris charris changed the title add assert in case of missing git version MAINT: Add assert that git version is available. Sep 22, 2019
@seberg
Copy link
Member

seberg commented Sep 22, 2019

Yeah, I like Ralfs suggestion. I would tend towards adding "Unknown" just the same as if there is no git repo at all. ".dev0+GitFailure" could work, but is probably overkill. @sethtroisi do you want to finish this up?

@sethtroisi
Copy link
Contributor Author

@seberg I agree with Ralf this is a corner case with unknown root cause that's inconsequential, I'd suggest just closing the bug and this pull. I've modified the pull request (because it was easy) in case you don't agree.

@rgommers rgommers merged commit 0498afe into numpy:master Sep 23, 2019
@rgommers
Copy link
Member

Merged, thanks @sethtroisi. Still an improvement I think.

@rgommers rgommers changed the title MAINT: Add assert that git version is available. MAINT: handle case where GIT_VERSION is empty string Sep 23, 2019
@sethtroisi sethtroisi deleted the git_version branch September 23, 2019 23:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants