archrelease: copy trunk to extra-x86_64
[arch-packages.git] / python-setuptools / trunk / PKGBUILD
blob3c2cb52de1312bb909ee9e3f7aa7fe4bc77f9d5d
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
6 pkgver=62.3.4
7 pkgrel=1
8 epoch=1
9 pkgdesc="Easily download, build, install, upgrade, and uninstall Python packages"
10 arch=('any')
11 license=('PSF')
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
29 prepare() {
30   cd setuptools-$pkgver
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 /' \
49           {} +
50   done
52   # Remove post-release tag since we are using stable tags
53   sed -e '/tag_build = .post/d' \
54       -e '/tag_date = 1/d' \
55       -i setup.cfg
57   # Fix shebang
58   sed -i -e "s|^#\!.*/usr/bin/env python|#!/usr/bin/env python3|" setuptools/command/easy_install.py
61 build() {
62   cd setuptools-$pkgver
63   python setup.py build
66 check() { (
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
73   cd setuptools-$pkgver
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
76   # 10-11: TODO
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
91 package() {
92   cd setuptools-$pkgver
93   python setup.py install --prefix=/usr --root="$pkgdir" --optimize=1 --skip-build