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

Create wheel with version number not "main" #79

Merged
merged 4 commits into from Oct 31, 2022

Conversation

hugovk
Copy link
Contributor

@hugovk hugovk commented Oct 30, 2022

Fixes part two of #76.

Fetch all tags:

https://github.com/actions/checkout#Fetch-all-history-for-all-tags-and-branches

So that when setup.py runs:

# This will fail if something happens or if not in a git repository.
# This is intentional.
try:
ret = subprocess.run(
"git describe --tags --abbrev=0",
capture_output=True,
check=True,
shell=True,
)
version = ret.stdout.decode("utf-8").strip()
except:
version = "main"

We use the version in the wheel name and not "main".

@hugovk
Copy link
Contributor Author

hugovk commented Oct 30, 2022

Well, something like this, but this stil has main:

Successfully built sphinxext-opengraph-main.tar.gz and sphinxext_opengraph-main-py3-none-any.whl

Will check further.

@hugovk hugovk marked this pull request as draft October 30, 2022 14:19
@auscompgeek
Copy link
Member

See my comment on the issue, I believe it's building the wheel from the sdist outside of the git tree. The setup.py will need to be fixed to allow building/installing the sdist.

@hugovk
Copy link
Contributor Author

hugovk commented Oct 30, 2022

Righto, here's one way, use https://github.com/pypa/setuptools_scm to fetch the version from the tag instead of calling Git directly via a subcommand.

When not exactly on a tag, it gives a dev version number based on the "distance" from the tag. For example:

$ python setup.py --version
0.7.1.dev3+g0ed6287

https://github.com/pypa/setuptools_scm#default-versioning-scheme

Edit: still not quite ready!

@hugovk hugovk marked this pull request as ready for review October 30, 2022 15:14
@hugovk hugovk marked this pull request as draft October 30, 2022 15:15
@hugovk hugovk marked this pull request as ready for review October 30, 2022 16:53
@hugovk hugovk changed the title Fetch all tags to name wheel after version not 'main' Create wheel with version number not "main" Oct 30, 2022
@TheTripleV TheTripleV merged commit d6eec0d into wpilibsuite:main Oct 31, 2022
@hugovk hugovk deleted the fix-wheel-name branch October 31, 2022 07:39
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.

None yet

3 participants