1 # Maintainer: Angel Velasquez <angvp@archlinux.org>
2 # Maintainer: Felix Yan <felixonmars@archlinux.org>
3 # Contributor: Eli Schwartz <eschwartz@archlinux.org>
5 pkgname=python-setuptools
7 _commit=f11f8b16e28ef2e21c1f454d8925b2c512d32d37
10 pkgdesc="Easily download, build, install, upgrade, and uninstall Python packages"
13 url="https://pypi.org/project/setuptools/"
14 depends=('python-jaraco.text' 'python-more-itertools' 'python-ordered-set' 'python-packaging'
15 'python-platformdirs' 'python-tomli' 'python-validate-pyproject')
16 makedepends=('git' 'python-setuptools')
17 checkdepends=('python-jaraco.envs' 'python-jaraco.path' 'python-pip' 'python-pip-run'
18 'python-pytest-fixture-config' 'python-pytest-virtualenv' 'python-wheel'
19 'python-pytest-enabler' 'python-pytest-mypy' 'python-pytest-timeout' 'python-sphinx'
20 'python-build' 'python-ini2toml' 'python-tomli-w')
21 provides=('python-distribute')
22 replaces=('python-distribute')
23 source=("git+https://github.com/pypa/setuptools.git#commit=$_commit"
24 system-validate-pyproject.patch
27 '390fea2c575a0042054f51d33e629b04a48f832f0a4a2dd07d34e23cdf330c382dba0f54bfb7c8a6a253bb248a4940f2a789672f715e4dc2aeb395fa185cae7a'
28 '9c5d80c753e78bf613572fb789a234984087d0ce96d0bad22b5ed731d83c77bf6d8acfa65c78f6c78f9063be7819c2b58988fdf8e7fc89b55339f94a87b3b21f')
30 export SETUPTOOLS_INSTALL_WINDOWS_SPECIFIC_FILES=0
35 patch -p1 -i ../system-validate-pyproject.patch
37 rm -r {pkg_resources,setuptools}/{extern,_vendor} setuptools/config/_validate_pyproject
39 # Upstream devendoring logic is badly broken, see:
40 # https://bugs.archlinux.org/task/58670
41 # https://github.com/pypa/pip/issues/5429
42 # https://github.com/pypa/setuptools/issues/1383
43 # The simplest fix is to simply rewrite import paths to use the canonical
44 # location in the first place
45 for _module in setuptools pkg_resources '' ; do
46 find . -name \*.py -exec sed -i \
47 -e 's/from '$_module.extern' import/import/' \
48 -e 's/from '$_module.extern'\./from /' \
49 -e 's/import '$_module.extern'\./import /' \
50 -e "s/__import__('$_module.extern./__import__('/" \
51 -e 's/from \.\.extern\./from /' \
55 # Add the devendored dependencies into metadata of setuptools
56 patch -p1 -i ../add-dependency.patch
58 # Fix tests invoking python-build
59 sed -e 's/"-m", "build", "--wheel"/"-m", "build", "--wheel", "--no-isolation"/' \
60 -e 's/"-m", "build", "--sdist"/"-m", "build", "--sdist", "--no-isolation"/' \
61 -i setuptools/tests/fixtures.py
63 # Remove post-release tag since we are using stable tags
64 sed -e '/tag_build = .post/d' \
65 -e '/tag_date = 1/d' \
69 sed -i -e "s|^#\!.*/usr/bin/env python|#!/usr/bin/env python3|" setuptools/command/easy_install.py
78 # Workaround UTF-8 tests by setting LC_CTYPE
79 export LC_CTYPE=en_US.UTF-8
81 # https://github.com/pypa/setuptools/pull/810
82 export PYTHONDONTWRITEBYTECODE=1
85 # 1,4: subtle difference introduced by devendoring
86 # 2: pip failures related to devendoring,
88 PYTHONPATH="$PWD"/build/lib python -m pytest \
89 --deselect setuptools/tests/config/test_apply_pyprojecttoml.py::test_apply_pyproject_equivalent_to_setupcfg \
90 --deselect setuptools/tests/test_virtualenv.py \
91 --deselect setuptools/tests/test_editable_install.py::test_editable_with_prefix \
92 --deselect setuptools/_normalization.py::setuptools._normalization.safe_version
97 python setup.py install --prefix=/usr --root="$pkgdir" --optimize=1 --skip-build