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
9 pkgdesc="Easily download, build, install, upgrade, and uninstall Python packages"
12 url="https://pypi.org/project/setuptools/"
13 depends=('python-appdirs' 'python-jaraco.text' 'python-more-itertools' 'python-nspektr'
14 'python-ordered-set' 'python-packaging' 'python-pyparsing' 'python-tomli'
15 'python-validate-pyproject')
16 makedepends=('git' 'python-setuptools')
17 checkdepends=('python-jaraco.envs' 'python-jaraco.path' 'python-mock' 'python-pip' 'python-pip-run'
18 'python-pytest-fixture-config' 'python-pytest-flake8' 'python-pytest-virtualenv'
19 'python-wheel' 'python-paver' 'python-pytest-cov' 'python-sphinx' 'python-build'
20 'python-ini2toml' 'python-tomli-w')
21 provides=('python-distribute')
22 replaces=('python-distribute')
23 source=("$pkgname-$pkgver.tar.gz::https://github.com/pypa/setuptools/archive/v$pkgver.tar.gz"
24 system-validate-pyproject.patch)
25 sha512sums=('8304363d09242bd3097c2c1c49f62c7b869886389871de34c937e08ff257a09211b5cfc087461b89ae76554c4618aec677a7f1d99490d11bc4fac84cf8b7506b'
26 '50495062093b1b6902484c384abe073896e4f45c5768741582e178014367f186831711a72a8a987e7bacafe96d871161fc07c686dd92c6886de19302f6a10b56')
28 export SETUPTOOLS_INSTALL_WINDOWS_SPECIFIC_FILES=0
33 patch -p1 -i ../system-validate-pyproject.patch
35 rm -r {pkg_resources,setuptools}/{extern,_vendor} setuptools/config/_validate_pyproject
37 # Upstream devendoring logic is badly broken, see:
38 # https://bugs.archlinux.org/task/58670
39 # https://github.com/pypa/pip/issues/5429
40 # https://github.com/pypa/setuptools/issues/1383
41 # The simplest fix is to simply rewrite import paths to use the canonical
42 # location in the first place
43 for _module in setuptools pkg_resources '' ; do
44 find . -name \*.py -exec sed -i \
45 -e 's/from '$_module.extern' import/import/' \
46 -e 's/from '$_module.extern'\./from /' \
47 -e 's/import '$_module.extern'\./import /' \
48 -e "s/__import__('$_module.extern./__import__('/" \
49 -e 's/from \.\.extern\./from /' \
53 # Remove post-release tag since we are using stable tags
54 sed -e '/tag_build = .post/d' \
55 -e '/tag_date = 1/d' \
59 sed -i -e "s|^#\!.*/usr/bin/env python|#!/usr/bin/env python3|" setuptools/command/easy_install.py
68 # Workaround UTF-8 tests by setting LC_CTYPE
69 export LC_CTYPE=en_US.UTF-8
71 # https://github.com/pypa/setuptools/pull/810
72 export PYTHONDONTWRITEBYTECODE=1
75 # 1-7: skipping all tests using "setuptools_sdist", "setuptools_wheel" (or "venv" which uses the latter)
76 # 8-9: subtle difference introduced by devendoring
78 PRE_BUILT_SETUPTOOLS_SDIST="$PWD"/build/lib python -m pytest \
79 --deselect setuptools/tests/integration/test_pip_install_sdist.py \
80 --deselect setuptools/tests/test_distutils_adoption.py \
81 --deselect setuptools/tests/test_setuptools.py::test_its_own_wheel_does_not_contain_tests \
82 --deselect setuptools/tests/test_virtualenv.py \
83 --deselect setuptools/tests/test_editable_install.py::test_editable_with_pyproject \
84 --deselect setuptools/tests/config/test_apply_pyprojecttoml.py::TestMeta::test_example_file_in_sdist \
85 --deselect setuptools/tests/config/test_apply_pyprojecttoml.py::TestMeta::test_example_file_not_in_wheel \
86 --deselect setuptools/tests/config/test_apply_pyprojecttoml.py::test_apply_pyproject_equivalent_to_setupcfg \
87 --deselect setuptools/tests/config/test_pyprojecttoml.py::test_invalid_example \
88 --deselect setuptools/tests/test_dist_info.py::TestWheelCompatibility \
89 --deselect setuptools/tests/test_dist_info.py::TestDistInfo::test_invalid_version
94 python setup.py install --prefix=/usr --root="$pkgdir" --optimize=1 --skip-build