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

Generated constraints.txt eats the first c letter of packages #3247

Closed
gforcada opened this issue Mar 20, 2024 · 2 comments · Fixed by #3250
Closed

Generated constraints.txt eats the first c letter of packages #3247

gforcada opened this issue Mar 20, 2024 · 2 comments · Fixed by #3250

Comments

@gforcada
Copy link

gforcada commented Mar 20, 2024

Issue

We use constrain_package_deps = true and to our surprise, our dependencies that are in our constraints.txt that start with the letter c, that letter gets removed.

Environment

Provide at least:

  • OS: linux

Minimal example

Use these files to reproduce it:

[tox]
min_version = 4.14.1
envlist =
    test

[testenv:test]
allowlist_externals = echo
skip_install = true
constrain_package_deps = true
deps =
    zope.interface
    -c constraints.txt
commands =
    echo 1

Download locally: https://dist.plone.org/release/6.0.7/requirements.txt

wget https://dist.plone.org/release/6.0.7/requirements.txt

And run tox:

tox -e test

After tox fails (on purpose), look at the generated .tox/test/constraints.txt and you will see that there is no collective.XXX version pins but rather ollective.XXX version pins.

@gforcada
Copy link
Author

gforcada commented Mar 20, 2024

Actually, if one uses

deps =
   zope.interface
   -c https://dist.plone.org/release/6.0.7/constraints.txt

The same happens 😕

jugmac00 added a commit to jugmac00/tox that referenced this issue Mar 24, 2024
`lstrip` takes a set, not a string, so `.lstrip("-c ")` did not work as
intended.

Until we only support Python 3.9 or higher, we need to use a custom
function to remove a prefix. With Python 3.9+ we can use the builtin
`.removeprefix`.

This fixes tox-dev#3247.
jugmac00 added a commit to jugmac00/tox that referenced this issue Mar 24, 2024
`lstrip` takes a set, not a string, so `.lstrip("-c ")` did not work as
intended.

Until we only support Python 3.9 or higher, we need to use a custom
function to remove a prefix. With Python 3.9+ we can use the builtin
`.removeprefix`.

This fixes tox-dev#3247.
jugmac00 added a commit to jugmac00/tox that referenced this issue Mar 24, 2024
`lstrip` takes a set, not a string, so `.lstrip("-c ")` did not work as
intended.

Until we only support Python 3.9 or higher, we need to use a custom
function to remove a prefix. With Python 3.9+ we can use the builtin
`.removeprefix`.

This fixes tox-dev#3247.
@jugmac00
Copy link
Member

@gforcada Thanks for the bug report!

I was able to reproduce it and identify the issue. I have created a PR which hopefully gets reviewed by @masenf as both he worked on that feature and @gaborbernat is off for a bit.

gaborbernat added a commit that referenced this issue Mar 24, 2024
`lstrip` takes a set, not a string, so `.lstrip("-c ")` did not work as
intended.

Until we only support Python 3.9 or higher, we need to use a custom
function to remove a prefix. With Python 3.9+ we can use the builtin
`.removeprefix`.

This fixes #3247.

Co-authored-by: Bernát Gábor <gaborjbernat@gmail.com>
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 a pull request may close this issue.

2 participants