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-more-itertools' 'python-ordered-set' 'python-packaging'
15 makedepends=('git' 'python-setuptools')
16 checkdepends=('python-jaraco.envs' 'python-jaraco.path' 'python-mock' 'python-pip'
17 'python-pytest-fixture-config' 'python-pytest-flake8' 'python-pytest-virtualenv'
18 'python-wheel' 'python-paver' 'python-pytest-cov' 'python-sphinx')
19 provides=('python-distribute')
20 replaces=('python-distribute')
21 source=("$pkgname-$pkgver.tar.gz::https://github.com/pypa/setuptools/archive/v$pkgver.tar.gz")
22 sha512sums=('3fa09841118c8e554ee5db141188d4ab19853b12e11c35891600dd0159afff35bfcdf00e51d8897c1d68879c8248c9e67dae5909028a967a63d24c0248a1f2ef')
24 export SETUPTOOLS_INSTALL_WINDOWS_SPECIFIC_FILES=0
27 rm -r setuptools-$pkgver/{pkg_resources,setuptools}/{extern,_vendor}
29 # Upstream devendoring logic is badly broken, see:
30 # https://bugs.archlinux.org/task/58670
31 # https://github.com/pypa/pip/issues/5429
32 # https://github.com/pypa/setuptools/issues/1383
33 # The simplest fix is to simply rewrite import paths to use the canonical
34 # location in the first place
35 for _module in setuptools pkg_resources '' ; do
36 find setuptools-$pkgver -name \*.py -exec sed -i \
37 -e 's/from '$_module.extern' import/import/' \
38 -e 's/from '$_module.extern'./from /' \
39 -e 's/import '$_module.extern'./import /' \
40 -e "s/__import__('$_module.extern./__import__('/" \
44 # https://github.com/pypa/setuptools/issues/2466
45 sed -i '/ignore:lib2to3 package is deprecated:DeprecationWarning/a \ ignore:Creating a LegacyVersion has been deprecated and will be removed in the next major release:DeprecationWarning' \
46 setuptools-$pkgver/pytest.ini
48 # Remove post-release tag since we are using stable tags
49 sed -e '/tag_build = .post/d' \
50 -e '/tag_date = 1/d' \
51 -i setuptools-$pkgver/setup.cfg
53 # 'Clean' installation is expected to fail since we removed bundled packages
54 sed -i '/^def test_clean_env_install/i @pytest.mark.xfail' setuptools-$pkgver/setuptools/tests/test_virtualenv.py
56 # Tests failed. Importing an unbundled new setuptools in a virtualenv does not work, but this won't
57 # affect normal virtualenv usage (which don't have to import the unbundled setuptools in *current*
59 sed -e '/^def test_pip_upgrade_from_source/i @pytest.mark.xfail' \
60 -e '/^def test_test_command_install_requirements/i @pytest.mark.xfail' \
61 -e '/^def test_no_missing_dependencies/i @pytest.mark.xfail' \
62 -i setuptools-$pkgver/setuptools/tests/test_virtualenv.py
64 cd "$srcdir"/setuptools-$pkgver
65 sed -i -e "s|^#\!.*/usr/bin/env python|#!/usr/bin/env python3|" setuptools/command/easy_install.py
74 # Workaround UTF-8 tests by setting LC_CTYPE
75 export LC_CTYPE=en_US.UTF-8
77 # https://github.com/pypa/setuptools/pull/810
78 export PYTHONDONTWRITEBYTECODE=1
81 python -m pytest --deselect setuptools/tests/test_distutils_adoption.py
86 python setup.py install --prefix=/usr --root="$pkgdir" --optimize=1 --skip-build