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-virtualenv' 'python-wheel'
19 'python-paver' 'python-sphinx' 'python-build' 'python-ini2toml' 'python-tomli-w')
20 provides=('python-distribute')
21 replaces=('python-distribute')
22 source=("$pkgname-$pkgver.tar.gz::https://github.com/pypa/setuptools/archive/v$pkgver.tar.gz"
23 system-validate-pyproject.patch)
24 sha512sums=('3a94fe9e359111b17c3e2ec904485f4be86533728a55db41e9ae44df3eaa6857f5cc8607316fa986b92f59c63ad623586c783815911c809340a802850f6d3ab0'
25 '50495062093b1b6902484c384abe073896e4f45c5768741582e178014367f186831711a72a8a987e7bacafe96d871161fc07c686dd92c6886de19302f6a10b56')
27 export SETUPTOOLS_INSTALL_WINDOWS_SPECIFIC_FILES=0
32 patch -p1 -i ../system-validate-pyproject.patch
34 rm -r {pkg_resources,setuptools}/{extern,_vendor} setuptools/config/_validate_pyproject
36 # Upstream devendoring logic is badly broken, see:
37 # https://bugs.archlinux.org/task/58670
38 # https://github.com/pypa/pip/issues/5429
39 # https://github.com/pypa/setuptools/issues/1383
40 # The simplest fix is to simply rewrite import paths to use the canonical
41 # location in the first place
42 for _module in setuptools pkg_resources '' ; do
43 find . -name \*.py -exec sed -i \
44 -e 's/from '$_module.extern' import/import/' \
45 -e 's/from '$_module.extern'\./from /' \
46 -e 's/import '$_module.extern'\./import /' \
47 -e "s/__import__('$_module.extern./__import__('/" \
48 -e 's/from \.\.extern\./from /' \
52 # Remove post-release tag since we are using stable tags
53 sed -e '/tag_build = .post/d' \
54 -e '/tag_date = 1/d' \
58 sed -i -e "s|^#\!.*/usr/bin/env python|#!/usr/bin/env python3|" setuptools/command/easy_install.py
67 # Workaround UTF-8 tests by setting LC_CTYPE
68 export LC_CTYPE=en_US.UTF-8
70 # https://github.com/pypa/setuptools/pull/810
71 export PYTHONDONTWRITEBYTECODE=1
74 # 1-7: skipping all tests using "setuptools_sdist", "setuptools_wheel" (or "venv" which uses the latter)
75 # 8-9: subtle difference introduced by devendoring
77 PRE_BUILT_SETUPTOOLS_SDIST="$PWD"/build/lib python -m pytest \
78 --deselect setuptools/tests/integration/test_pip_install_sdist.py \
79 --deselect setuptools/tests/test_distutils_adoption.py \
80 --deselect setuptools/tests/test_setuptools.py::test_its_own_wheel_does_not_contain_tests \
81 --deselect setuptools/tests/test_virtualenv.py \
82 --deselect setuptools/tests/test_editable_install.py::test_editable_with_pyproject \
83 --deselect setuptools/tests/config/test_apply_pyprojecttoml.py::TestMeta::test_example_file_in_sdist \
84 --deselect setuptools/tests/config/test_apply_pyprojecttoml.py::TestMeta::test_example_file_not_in_wheel \
85 --deselect setuptools/tests/config/test_apply_pyprojecttoml.py::test_apply_pyproject_equivalent_to_setupcfg \
86 --deselect setuptools/tests/config/test_pyprojecttoml.py::test_invalid_example \
87 --deselect setuptools/tests/test_dist_info.py::TestWheelCompatibility \
88 --deselect setuptools/tests/test_dist_info.py::TestDistInfo::test_invalid_version
93 python setup.py install --prefix=/usr --root="$pkgdir" --optimize=1 --skip-build