Add support for PyPy wheels (#1028)
## Summary This PR adds support for PyPy wheels by changing the compatible tags based on the implementation name and version of the current interpreter. For now, we only support CPython and PyPy, and explicitly error out when given other interpreters. (Is this right? Should we just fallback to CPython tags...? Or skip the ABI-specific tags for unknown interpreters?) The logic is based on https://github.com/pypa/packaging/blob/4d8534061364e3cbfee582192ab81a095ec2db51/src/packaging/tags.py#L247. Note, however, that `packaging` uses the `EXT_SUFFIX` variable from `sysconfig`... Instead, I looked at the way that PyPy formats the tags, and recreated them based on the Python and implementation version. For example, PyPy wheels look like `cchardet-2.1.7-pp37-pypy37_pp73-win_amd64.whl` -- so that's `pp37` for PyPy with Python version 3.7, and then `pypy37_pp73` for PyPy with Python version 3.7 and PyPy version 7.3. Closes https://github.com/astral-sh/puffin/issues/1013. ## Test Plan I tested this manually, but I couldn't find macOS universal PyPy wheels... So instead I added `cchardet` to a `requirements.in`, ran `cargo run pip sync requirements.in --index-url https://pypy.kmtea.eu/simple --verbose`, and added logging to verify that the platform tags matched (even if the architecture didn't).
This commit is contained in:
@@ -15,7 +15,7 @@ pub struct PythonRequirement {
|
||||
impl PythonRequirement {
|
||||
pub fn new(interpreter: &Interpreter, markers: &MarkerEnvironment) -> Self {
|
||||
Self {
|
||||
installed: interpreter.version().clone(),
|
||||
installed: interpreter.python_version().clone(),
|
||||
target: markers.python_full_version.version.clone(),
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user