Gentoo Archives: gentoo-commits

From: Arthur Zamarin <arthurzam@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-python/setuptools/, dev-python/setuptools/files/
Date: Sun, 31 Oct 2021 20:33:16
Message-Id: 1635712376.30135c0cba46171bb19dda992b075a8ed1c6b00c.arthurzam@gentoo
1 commit: 30135c0cba46171bb19dda992b075a8ed1c6b00c
2 Author: Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
3 AuthorDate: Sun Oct 31 20:29:39 2021 +0000
4 Commit: Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
5 CommitDate: Sun Oct 31 20:32:56 2021 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=30135c0c
7
8 dev-python/setuptools: fix pypy3.8 install location
9
10 When on pypy3.8, and package forces to use setuptools's bundled
11 distutils, it installs into "/usr/lib/python3.8" directory, which is
12 wrong.
13
14 Using this patch, we fix the install locations, so it installs
15 correctly for all targets (tested).
16
17 Closes: https://bugs.gentoo.org/821112
18 Signed-off-by: Arthur Zamarin <arthurzam <AT> gentoo.org>
19
20 .../setuptools-58.2.0-fix-pypy3.8-install.patch | 78 ++++++++++++++++++++++
21 ...s-58.2.0.ebuild => setuptools-58.2.0-r1.ebuild} | 5 ++
22 2 files changed, 83 insertions(+)
23
24 diff --git a/dev-python/setuptools/files/setuptools-58.2.0-fix-pypy3.8-install.patch b/dev-python/setuptools/files/setuptools-58.2.0-fix-pypy3.8-install.patch
25 new file mode 100644
26 index 00000000000..238bc47d332
27 --- /dev/null
28 +++ b/dev-python/setuptools/files/setuptools-58.2.0-fix-pypy3.8-install.patch
29 @@ -0,0 +1,78 @@
30 +From 987edfa3265187a47b8688119943e7d96712d859 Mon Sep 17 00:00:00 2001
31 +From: Isuru Fernando <isuruf@×××××.com>
32 +Date: Tue, 21 Sep 2021 13:45:50 -0700
33 +Subject: [PATCH] Fix PyPy3.8 install locations
34 +
35 +---
36 + setuptools/_distutils/command/install.py | 26 +++++++++++++++++---------
37 + 1 file changed, 17 insertions(+), 9 deletions(-)
38 +
39 +diff --git a/setuptools/_distutils/command/install.py b/setuptools/_distutils/command/install.py
40 +index 866e2d5..e98f049 100644
41 +--- a/setuptools/_distutils/command/install.py
42 ++++ b/setuptools/_distutils/command/install.py
43 +@@ -29,16 +29,16 @@
44 +
45 + INSTALL_SCHEMES = {
46 + 'unix_prefix': {
47 +- 'purelib': '$base/lib/python$py_version_short/site-packages',
48 +- 'platlib': '$platbase/$platlibdir/python$py_version_short/site-packages',
49 +- 'headers': '$base/include/python$py_version_short$abiflags/$dist_name',
50 ++ 'purelib': '$base/lib/$implementation_lower$py_version_short/site-packages',
51 ++ 'platlib': '$platbase/$platlibdir/$implementation_lower$py_version_short/site-packages',
52 ++ 'headers': '$base/include/$implementation_lower$py_version_short$abiflags/$dist_name',
53 + 'scripts': '$base/bin',
54 + 'data' : '$base',
55 + },
56 + 'unix_home': {
57 +- 'purelib': '$base/lib/python',
58 +- 'platlib': '$base/$platlibdir/python',
59 +- 'headers': '$base/include/python/$dist_name',
60 ++ 'purelib': '$base/lib/$implementation_lower',
61 ++ 'platlib': '$base/$platlibdir/$implementation_lower',
62 ++ 'headers': '$base/include/$implementation_lower/$dist_name',
63 + 'scripts': '$base/bin',
64 + 'data' : '$base',
65 + },
66 +@@ -64,8 +64,8 @@
67 + INSTALL_SCHEMES['nt_user'] = {
68 + 'purelib': '$usersite',
69 + 'platlib': '$usersite',
70 +- 'headers': '$userbase/Python$py_version_nodot/Include/$dist_name',
71 +- 'scripts': '$userbase/Python$py_version_nodot/Scripts',
72 ++ 'headers': '$userbase/$implementation$py_version_nodot/Include/$dist_name',
73 ++ 'scripts': '$userbase/$implementation$py_version_nodot/Scripts',
74 + 'data' : '$userbase',
75 + }
76 +
77 +@@ -73,7 +73,7 @@
78 + 'purelib': '$usersite',
79 + 'platlib': '$usersite',
80 + 'headers':
81 +- '$userbase/include/python$py_version_short$abiflags/$dist_name',
82 ++ '$userbase/include/$implementation_lower$py_version_short$abiflags/$dist_name',
83 + 'scripts': '$userbase/bin',
84 + 'data' : '$userbase',
85 + }
86 +@@ -83,6 +83,12 @@
87 + # and to SCHEME_KEYS here.
88 + SCHEME_KEYS = ('purelib', 'platlib', 'headers', 'scripts', 'data')
89 +
90 ++def _get_implementation():
91 ++ if hasattr(sys, 'pypy_version_info'):
92 ++ return 'PyPy'
93 ++ else:
94 ++ return 'Python'
95 ++
96 +
97 + class install(Command):
98 +
99 +@@ -313,6 +319,8 @@ def finalize_options(self):
100 + 'exec_prefix': exec_prefix,
101 + 'abiflags': abiflags,
102 + 'platlibdir': getattr(sys, 'platlibdir', 'lib'),
103 ++ 'implementation_lower': _get_implementation().lower(),
104 ++ 'implementation': _get_implementation(),
105 + }
106 +
107 + if HAS_USER_SITE:
108 \ No newline at end of file
109
110 diff --git a/dev-python/setuptools/setuptools-58.2.0.ebuild b/dev-python/setuptools/setuptools-58.2.0-r1.ebuild
111 similarity index 96%
112 rename from dev-python/setuptools/setuptools-58.2.0.ebuild
113 rename to dev-python/setuptools/setuptools-58.2.0-r1.ebuild
114 index 13e77de865d..2d78feac9fd 100644
115 --- a/dev-python/setuptools/setuptools-58.2.0.ebuild
116 +++ b/dev-python/setuptools/setuptools-58.2.0-r1.ebuild
117 @@ -49,6 +49,11 @@ DISTUTILS_IN_SOURCE_BUILD=1
118
119 DOCS=( {CHANGES,README}.rst )
120
121 +PATCHES=(
122 + # https://github.com/pypa/distutils/pull/58
123 + "${FILESDIR}/${P}-fix-pypy3.8-install.patch"
124 +)
125 +
126 src_prepare() {
127 # apply distutils patches to the bundled distutils
128 pushd setuptools/_distutils >/dev/null || die