added extra/python2-packaging

This commit is contained in:
Kevin Mihelich 2022-05-05 00:43:50 +00:00
parent 1fd1988472
commit 6453fa1c5f
2 changed files with 230 additions and 0 deletions

View file

@ -0,0 +1,34 @@
# Maintainer: Felix Yan <felixonmars@archlinux.org>
# ALARM: Kevin Mihelich <kevin@archlinuxarm.org>
# - python2 variant that's still needed by packages
pkgname=python2-packaging
pkgver=20.9
pkgrel=7
pkgdesc="Core utilities for Python packages"
arch=('any')
url="https://github.com/pypa/packaging"
license=('Apache')
makedepends=('python2-setuptools' 'python2-pyparsing')
source=("https://github.com/pypa/packaging/archive/$pkgver/python-packaging-$pkgver.tar.gz"
replace-distutils-usage-with-sysconfig.patch)
sha512sums=('fb71f1036cfaacbe94fdee663af31d6ad1960f73ecc95cba87b461c2d7d2ea90085853bb4682b146492d8c48f784b60ef082e3b1259269857166b143cd9a920b'
'015ddcb799259190e3a4b97d386fb8e4cb6f76a22eed2ce97babf10116e886b82f6f3e3e74e3590dd14a8fce8e6ca5980a91205c61e29afa5dbdc387f4daa8dd')
prepare() {
cd packaging-$pkgver
patch -Np1 -i ../replace-distutils-usage-with-sysconfig.patch
}
build() {
cd packaging-$pkgver
python2 setup.py build
}
package() {
depends=('python2-pyparsing' 'python2-six')
cd packaging-$pkgver
python2 setup.py install --root "$pkgdir"
}

View file

@ -0,0 +1,196 @@
From 00eb2c82483914a40c50999285397141e0576873 Mon Sep 17 00:00:00 2001
From: Tzu-ping Chung <uranusjr@gmail.com>
Date: Sat, 24 Apr 2021 02:49:54 +0800
Subject: [PATCH] Replace distutils usage with sysconfig (#396)
(cherry picked from commit c8008265eac83ebf2c3b3c314a682abd4c101de2)
---
packaging/tags.py | 6 ++----
tests/test_tags.py | 33 ++++++++++++++++-----------------
2 files changed, 18 insertions(+), 21 deletions(-)
diff --git a/packaging/tags.py b/packaging/tags.py
index d637f1b..de4dc91 100644
--- a/packaging/tags.py
+++ b/packaging/tags.py
@@ -4,8 +4,6 @@
from __future__ import absolute_import
-import distutils.util
-
try:
from importlib.machinery import EXTENSION_SUFFIXES
except ImportError: # pragma: no cover
@@ -781,7 +779,7 @@ def _manylinux_tags(linux, arch):
def _linux_platforms(is_32bit=_32_BIT_INTERPRETER):
# type: (bool) -> Iterator[str]
- linux = _normalize_string(distutils.util.get_platform())
+ linux = _normalize_string(sysconfig.get_platform())
if is_32bit:
if linux == "linux_x86_64":
linux = "linux_i686"
@@ -796,7 +794,7 @@ def _linux_platforms(is_32bit=_32_BIT_INTERPRETER):
def _generic_platforms():
# type: () -> Iterator[str]
- yield _normalize_string(distutils.util.get_platform())
+ yield _normalize_string(sysconfig.get_platform())
def _platform_tags():
diff --git a/tests/test_tags.py b/tests/test_tags.py
index 6b0e5b6..3537379 100644
--- a/tests/test_tags.py
+++ b/tests/test_tags.py
@@ -11,7 +11,6 @@ try:
import ctypes
except ImportError:
ctypes = None
-import distutils.util
import os
import platform
import re
@@ -492,14 +491,14 @@ class TestManylinuxPlatform:
def test_linux_platforms_32_64bit_on_64bit_os(
self, arch, is_32bit, expected, monkeypatch
):
- monkeypatch.setattr(distutils.util, "get_platform", lambda: arch)
+ monkeypatch.setattr(sysconfig, "get_platform", lambda: arch)
monkeypatch.setattr(os, "confstr", lambda x: "glibc 2.20", raising=False)
monkeypatch.setattr(tags, "_is_manylinux_compatible", lambda *args: False)
linux_platform = list(tags._linux_platforms(is_32bit=is_32bit))[-1]
assert linux_platform == expected
def test_linux_platforms_manylinux_unsupported(self, monkeypatch):
- monkeypatch.setattr(distutils.util, "get_platform", lambda: "linux_x86_64")
+ monkeypatch.setattr(sysconfig, "get_platform", lambda: "linux_x86_64")
monkeypatch.setattr(os, "confstr", lambda x: "glibc 2.20", raising=False)
monkeypatch.setattr(tags, "_is_manylinux_compatible", lambda *args: False)
linux_platform = list(tags._linux_platforms(is_32bit=False))
@@ -509,7 +508,7 @@ class TestManylinuxPlatform:
monkeypatch.setattr(
tags, "_is_manylinux_compatible", lambda name, *args: name == "manylinux1"
)
- monkeypatch.setattr(distutils.util, "get_platform", lambda: "linux_x86_64")
+ monkeypatch.setattr(sysconfig, "get_platform", lambda: "linux_x86_64")
monkeypatch.setattr(platform, "machine", lambda: "x86_64")
monkeypatch.setattr(os, "confstr", lambda x: "glibc 2.20", raising=False)
platforms = list(tags._linux_platforms(is_32bit=False))
@@ -517,7 +516,7 @@ class TestManylinuxPlatform:
assert platforms == ["manylinux1_" + arch, "linux_" + arch]
def test_linux_platforms_manylinux2010(self, monkeypatch):
- monkeypatch.setattr(distutils.util, "get_platform", lambda: "linux_x86_64")
+ monkeypatch.setattr(sysconfig, "get_platform", lambda: "linux_x86_64")
monkeypatch.setattr(platform, "machine", lambda: "x86_64")
monkeypatch.setattr(os, "confstr", lambda x: "glibc 2.12", raising=False)
platforms = list(tags._linux_platforms(is_32bit=False))
@@ -538,7 +537,7 @@ class TestManylinuxPlatform:
assert platforms == expected
def test_linux_platforms_manylinux2014(self, monkeypatch):
- monkeypatch.setattr(distutils.util, "get_platform", lambda: "linux_x86_64")
+ monkeypatch.setattr(sysconfig, "get_platform", lambda: "linux_x86_64")
monkeypatch.setattr(platform, "machine", lambda: "x86_64")
monkeypatch.setattr(os, "confstr", lambda x: "glibc 2.17", raising=False)
platforms = list(tags._linux_platforms(is_32bit=False))
@@ -571,7 +570,7 @@ class TestManylinuxPlatform:
"_is_manylinux_compatible",
lambda name, *args: name == "manylinux2014",
)
- monkeypatch.setattr(distutils.util, "get_platform", lambda: "linux_armv7l")
+ monkeypatch.setattr(sysconfig, "get_platform", lambda: "linux_armv7l")
monkeypatch.setattr(
sys,
"executable",
@@ -583,7 +582,7 @@ class TestManylinuxPlatform:
def test_linux_platforms_manylinux2014_i386_abi(self, monkeypatch):
monkeypatch.setattr(tags, "_glibc_version_string", lambda: "2.17")
- monkeypatch.setattr(distutils.util, "get_platform", lambda: "linux_x86_64")
+ monkeypatch.setattr(sysconfig, "get_platform", lambda: "linux_x86_64")
monkeypatch.setattr(
sys,
"executable",
@@ -615,7 +614,7 @@ class TestManylinuxPlatform:
# test for a future glic 3.x version
monkeypatch.setattr(tags, "_glibc_version_string", lambda: "3.2")
monkeypatch.setattr(tags, "_is_manylinux_compatible", lambda name, *args: True)
- monkeypatch.setattr(distutils.util, "get_platform", lambda: "linux_aarch64")
+ monkeypatch.setattr(sysconfig, "get_platform", lambda: "linux_aarch64")
monkeypatch.setattr(
sys,
"executable",
@@ -633,7 +632,7 @@ class TestManylinuxPlatform:
monkeypatch.setattr(
tags, "_is_manylinux_compatible", lambda name, _: name == "manylinux2014"
)
- monkeypatch.setattr(distutils.util, "get_platform", lambda: "linux_armv6l")
+ monkeypatch.setattr(sysconfig, "get_platform", lambda: "linux_armv6l")
monkeypatch.setattr(os, "confstr", lambda x: "glibc 2.20", raising=False)
platforms = list(tags._linux_platforms(is_32bit=True))
expected = ["linux_armv6l"]
@@ -648,7 +647,7 @@ class TestManylinuxPlatform:
):
monkeypatch.setattr(tags, "_is_manylinux_compatible", lambda name, _: False)
monkeypatch.setattr(
- distutils.util, "get_platform", lambda: "linux_{}".format(machine)
+ sysconfig, "get_platform", lambda: "linux_{}".format(machine)
)
monkeypatch.setattr(
sys,
@@ -995,7 +994,7 @@ class TestGenericTags:
assert not list(tags._generic_abi())
def test_generic_platforms(self):
- platform = distutils.util.get_platform().replace("-", "_")
+ platform = sysconfig.get_platform().replace("-", "_")
platform = platform.replace(".", "_")
assert list(tags._generic_platforms()) == [platform]
@@ -1269,14 +1268,14 @@ class TestSysTags:
assert result[-1] == expected
def test_linux_platforms_manylinux2014_armv6l(self, monkeypatch, manylinux_module):
- monkeypatch.setattr(distutils.util, "get_platform", lambda: "linux_armv6l")
+ monkeypatch.setattr(sysconfig, "get_platform", lambda: "linux_armv6l")
monkeypatch.setattr(os, "confstr", lambda x: "glibc 2.20", raising=False)
platforms = list(tags._linux_platforms(is_32bit=True))
expected = ["linux_armv6l"]
assert platforms == expected
def test_skip_manylinux_2014(self, monkeypatch, manylinux_module):
- monkeypatch.setattr(distutils.util, "get_platform", lambda: "linux_ppc64")
+ monkeypatch.setattr(sysconfig, "get_platform", lambda: "linux_ppc64")
monkeypatch.setattr(tags, "_get_glibc_version", lambda: (2, 20))
monkeypatch.setattr(
manylinux_module, "manylinux2014_compatible", False, raising=False
@@ -1300,7 +1299,7 @@ class TestSysTags:
self, monkeypatch, manylinux_module, machine, abi, alt_machine
):
monkeypatch.setattr(
- distutils.util, "get_platform", lambda: "linux_{}".format(machine)
+ sysconfig, "get_platform", lambda: "linux_{}".format(machine)
)
monkeypatch.setattr(
sys,
@@ -1326,7 +1325,7 @@ class TestSysTags:
monkeypatch.setattr(tags, "_get_glibc_version", lambda: (major, minor))
monkeypatch.setattr(
- distutils.util, "get_platform", lambda: "linux_{}".format(machine)
+ sysconfig, "get_platform", lambda: "linux_{}".format(machine)
)
monkeypatch.setattr(
manylinux_module,
@@ -1349,7 +1348,7 @@ class TestSysTags:
return None
monkeypatch.setattr(tags, "_get_glibc_version", lambda: (2, 30))
- monkeypatch.setattr(distutils.util, "get_platform", lambda: "linux_x86_64")
+ monkeypatch.setattr(sysconfig, "get_platform", lambda: "linux_x86_64")
monkeypatch.setattr(
manylinux_module,
"manylinux_compatible",