pypa / pypa/packaging

tags._linux_platforms breaks when _PYTHON_HOST_PLATFORM is set

Open
#259 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement packaging.tags
Dominant language
Python
Stars
751
Forks
324
Avg merge
12h 58m
Merged PRs (30d)
3

Description

When using a dirty hack to build custom platform-specific wheels for Alpine (setting _PYTHON_HOST_PLATFORM to "alpine", which distutils.util.get_platform() returns untouched), packaging.tags._linux_platforms() raises a ValueError: not enough values to unpack (expected 2, got 1) on _, arch = linux.split("_", 1). The simplest solution would be to use *_, arch = ... instead, but that could cause unexpected behavior if distutils.util.get_platform() returns "x86_64"; I'm not sure if that actually matters, though :)

We're fixing this on our side by just using "linux_alpine" for our tag instead of just "alpine", but this might want a fix here anyway since it's very dependent on the exact format of the response from get_platform().

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at packaging.tags._linux_platforms() and reproduce the failure with _PYTHON_HOST_PLATFORM set to "alpine". Inspect how the value returned by distutils.util.get_platform() is split, then verify that the chosen handling avoids the ValueError without introducing incorrect behavior for platform values such as "x86_64".

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.