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

Exactly sitting on a tag fails #4

Closed
henryiii opened this issue Jul 8, 2021 · 4 comments · Fixed by #5
Closed

Exactly sitting on a tag fails #4

henryiii opened this issue Jul 8, 2021 · 4 comments · Fixed by #5
Labels
bug Something isn't working

Comments

@henryiii
Copy link
Collaborator

henryiii commented Jul 8, 2021

This line breaks when this matches a tag exactly (which it usually should do if you are building wheels and SDists for publication?)

'git', 'describe', '--tags'

$ git describe --tags
v0.1.0

You want --long to force the commits since tag and current hash. Or you should check to see if -'s are present, then assume it's exactly a release then.

$ git describe --tags --long
v0.1.0-0-g165f120

Example failure from a nox run using scikit-hep/cookie:

nox -s 'dist(trampolim)'
nox > Running session dist(trampolim)
nox > Creating virtual environment (virtualenv) using python3.9 in .nox/dist-trampolim
nox > python -m pip install cookiecutter build twine
nox > cd .nox/dist-trampolim/tmp
nox > cookiecutter --no-input /Users/henryschreiner/git/scikit-hep/cookie --config-file=input.yml
nox > cd cookie-trampolim
nox > git init -q
nox > git add .
nox > git commit -qm feat: initial version
nox > git tag v0.1.0
nox > python -m build
nox > Command python -m build failed with exit code 1:
Found existing installation: setuptools 57.0.0
Uninstalling setuptools-57.0.0:
  Successfully uninstalled setuptools-57.0.0
Collecting trampolim~=0.0.3
  Using cached trampolim-0.0.3-py3-none-any.whl (13 kB)
Collecting packaging
  Using cached packaging-21.0-py3-none-any.whl (40 kB)
Collecting toml
  Using cached toml-0.10.2-py2.py3-none-any.whl (16 kB)
Collecting pyparsing>=2.0.2
  Using cached pyparsing-2.4.7-py2.py3-none-any.whl (67 kB)
Installing collected packages: pyparsing, toml, packaging, trampolim
Successfully installed packaging-21.0 pyparsing-2.4.7 toml-0.10.2 trampolim-0.0.3
Traceback (most recent call last):
  File "/Users/henryschreiner/git/scikit-hep/cookie/.nox/dist-trampolim/lib/python3.9/site-packages/pep517/in_process/_in_process.py", line 280, in <module>
    main()
  File "/Users/henryschreiner/git/scikit-hep/cookie/.nox/dist-trampolim/lib/python3.9/site-packages/pep517/in_process/_in_process.py", line 263, in main
    json_out['return_val'] = hook(**hook_input['kwargs'])
  File "/Users/henryschreiner/git/scikit-hep/cookie/.nox/dist-trampolim/lib/python3.9/site-packages/pep517/in_process/_in_process.py", line 236, in build_sdist
    return backend.build_sdist(sdist_directory, config_settings)
  File "/private/tmp/build-env-cgul0fht/lib/python3.9/site-packages/trampolim/__init__.py", line 44, in build_sdist
    project = trampolim._build.Project()
  File "/private/tmp/build-env-cgul0fht/lib/python3.9/site-packages/trampolim/_build.py", line 117, in __init__
    self.version  # calculate version
  File "/usr/local/Cellar/python@3.9/3.9.6/Frameworks/Python.framework/Versions/3.9/lib/python3.9/functools.py", line 969, in __get__
    val = self.func(instance)
  File "/private/tmp/build-env-cgul0fht/lib/python3.9/site-packages/trampolim/_build.py", line 289, in version
    tag, r, commit = subprocess.check_output([
ValueError: not enough values to unpack (expected 3, got 1)

ERROR Backend subproccess exited when trying to invoke build_sdist

This works correctly in setuptools_scm.

@FFY00
Copy link
Owner

FFY00 commented Jul 13, 2021

Thank you for looking into the issue and thank you for the PR. I am a bit thorn between the proposed fix and fixing the parsing. I'd probably like the tarball and github tag to generate the same version.

@henryiii
Copy link
Collaborator Author

Feel free to fix as you see fit. I’m rather assuming here that the git hash and revision count are removed later if the count is 0 (that might depend on how you handle dirty working trees).

@FFY00 FFY00 added the bug Something isn't working label Sep 20, 2021
@FFY00
Copy link
Owner

FFY00 commented Sep 20, 2021

As pointed out in #5 (comment), I will pull setuptools_scm as a dependency, which should fix this.

@henryiii
Copy link
Collaborator Author

Okay, let me know when there's a fix. :)

@FFY00 FFY00 closed this as completed in #5 Oct 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants