setuptools: stop de-vendoring, lots of cleanup
Run some tests, even though most dependencies are missing.
This commit is contained in:
@@ -9,29 +9,25 @@ conflicts=("${MINGW_PACKAGE_PREFIX}-python3-${_realname}"
|
||||
"${MINGW_PACKAGE_PREFIX}-python2-setuptools<42.0.2")
|
||||
replaces=("${MINGW_PACKAGE_PREFIX}-python3-${_realname}")
|
||||
pkgver=54.1.0
|
||||
pkgrel=1
|
||||
pkgrel=2
|
||||
pkgdesc="Easily download, build, install, upgrade, and uninstall Python packages (mingw-w64)"
|
||||
arch=('any')
|
||||
license=('PSF')
|
||||
url="https://pypi.org/pypi/setuptools"
|
||||
depends=("${MINGW_PACKAGE_PREFIX}-python-packaging"
|
||||
"${MINGW_PACKAGE_PREFIX}-python-appdirs"
|
||||
"${MINGW_PACKAGE_PREFIX}-python-pyparsing"
|
||||
"${MINGW_PACKAGE_PREFIX}-python-ordered-set")
|
||||
depends=("${MINGW_PACKAGE_PREFIX}-python")
|
||||
optdepends=("${MINGW_PACKAGE_PREFIX}-python-certifi: Mozilla's CA Bundle support"
|
||||
"${MINGW_PACKAGE_PREFIX}-python-wincertstore: Windows' cert store support")
|
||||
makedepends=("${MINGW_PACKAGE_PREFIX}-python-certifi"
|
||||
"${MINGW_PACKAGE_PREFIX}-python-wincertstore")
|
||||
makedepends=("${MINGW_PACKAGE_PREFIX}-gcc"
|
||||
"mingw-w64-cross-gcc")
|
||||
source=(${_realname}-${pkgver}.tar.gz::https://pypi.org/packages/source/${_realname::1}/${_realname}/${_realname}-${pkgver}.tar.gz
|
||||
'0001-mingw-python-fix.patch'
|
||||
'0002-Allow-usr-bin-env-in-script.patch'
|
||||
'0003-MinGW-w64-Look-in-same-dir-as-script-for-exe.patch'
|
||||
'0005-execv-warning.patch')
|
||||
#_checkdeps=('mock' 'pytest-flake8' 'virtualenv' 'pytest-virtualenv' 'pytest'
|
||||
# 'wheel' 'coverage' 'pytest-cov')
|
||||
#checkdepends=("${_checkdeps[@]/#/${MINGW_PACKAGE_PREFIX}-python3-}"
|
||||
# "${MINGW_PACKAGE_PREFIX}-python3-paver"
|
||||
# 'git')
|
||||
checkdepends=("${MINGW_PACKAGE_PREFIX}-python-pytest"
|
||||
"${MINGW_PACKAGE_PREFIX}-python-wheel"
|
||||
"${MINGW_PACKAGE_PREFIX}-python-mock"
|
||||
"${MINGW_PACKAGE_PREFIX}-python-virtualenv")
|
||||
sha256sums=('36bc07925c77dd6e30c64c91c2d080212a46910aa79073990c11d4c48a006240'
|
||||
'7b196884ac0151801f9638dabbf9a789fa9070a3b07a4c9e625c5523e8d47387'
|
||||
'fa54581e3dddb9f4edd332dedbc101f48939a9ca5878e13cf9cf9b3408bc8c22'
|
||||
@@ -39,77 +35,56 @@ sha256sums=('36bc07925c77dd6e30c64c91c2d080212a46910aa79073990c11d4c48a006240'
|
||||
'a356b0663f67a296624d1b178b42437b380b48a4bbe05a560d3bf29e93a4c623')
|
||||
|
||||
prepare() {
|
||||
export SETUPTOOLS_INSTALL_WINDOWS_SPECIFIC_FILES=1
|
||||
cd "${srcdir}/setuptools-${pkgver}"
|
||||
|
||||
patch -p1 -i ${srcdir}/0001-mingw-python-fix.patch
|
||||
patch -p1 -i ${srcdir}/0002-Allow-usr-bin-env-in-script.patch
|
||||
patch -p1 -i ${srcdir}/0003-MinGW-w64-Look-in-same-dir-as-script-for-exe.patch
|
||||
patch -p1 -i ${srcdir}/0005-execv-warning.patch
|
||||
|
||||
rm setuptools/{gui,cli}{-32,-64,}.exe
|
||||
local _gui_args="-DGUI=1 -mwindows -O2"
|
||||
local _cli_args="-DGUI=0 -O2"
|
||||
if check_option "strip" "y"; then
|
||||
_gui_args+=" -s"
|
||||
_cli_args+=" -s"
|
||||
fi
|
||||
if [[ "${MINGW_CHOST}" == "i686-w64-mingw32" ]]; then
|
||||
gcc $_cli_args -o setuptools/cli-32.exe launcher.c
|
||||
gcc $_gui_args -o setuptools/gui-32.exe launcher.c
|
||||
/opt/bin/x86_64-w64-mingw32-gcc.exe $_cli_args -o setuptools/cli-64.exe launcher.c
|
||||
/opt/bin/x86_64-w64-mingw32-gcc.exe $_gui_args -o setuptools/gui-64.exe launcher.c
|
||||
else
|
||||
/opt/bin/i686-w64-mingw32-gcc.exe $_cli_args -o setuptools/cli-32.exe launcher.c
|
||||
/opt/bin/i686-w64-mingw32-gcc.exe $_gui_args -s -o setuptools/gui-32.exe launcher.c
|
||||
gcc $_cli_args -o setuptools/cli-64.exe launcher.c
|
||||
gcc $_gui_args -o setuptools/gui-64.exe launcher.c
|
||||
fi
|
||||
cp setuptools/cli-32.exe setuptools/cli.exe
|
||||
cp setuptools/gui-32.exe setuptools/gui.exe
|
||||
|
||||
cd "${srcdir}"
|
||||
|
||||
# Compile our own MSYS2-layout and /usr/bin/env capable {cli,gui}{-32,-64}.exe to replace the precompiled binaries.
|
||||
# .. when arm is ready, add it to this.
|
||||
PATH=/mingw32/bin:$PATH gcc -DGUI=0 -O -s -o setuptools-${pkgver}/setuptools/cli-32.exe setuptools-${pkgver}/launcher.c
|
||||
PATH=/mingw32/bin:$PATH gcc -DGUI=1 -mwindows -O -s -o setuptools-${pkgver}/setuptools/gui-32.exe setuptools-${pkgver}/launcher.c
|
||||
PATH=/mingw64/bin:$PATH gcc -DGUI=0 -O -s -o setuptools-${pkgver}/setuptools/cli-64.exe setuptools-${pkgver}/launcher.c
|
||||
PATH=/mingw64/bin:$PATH gcc -DGUI=1 -mwindows -O -s -o setuptools-${pkgver}/setuptools/gui-64.exe setuptools-${pkgver}/launcher.c
|
||||
|
||||
rm -r setuptools-${pkgver}/{pkg_resources,setuptools}/{extern,_vendor}
|
||||
|
||||
# Upstream devendoring logic is badly broken, see:
|
||||
# https://bugs.archlinux.org/task/58670
|
||||
# https://github.com/pypa/pip/issues/5429
|
||||
# https://github.com/pypa/setuptools/issues/1383
|
||||
# The simplest fix is to simply rewrite import paths to use the canonical
|
||||
# location in the first place
|
||||
for _module in setuptools pkg_resources '' ; do
|
||||
find setuptools-${pkgver}/${_module} -name \*.py -exec sed -i \
|
||||
-e 's/from '${_module}.extern' import/import/' \
|
||||
-e 's/from '${_module}.extern'./from /' \
|
||||
-e 's/import '${_module}.extern'./import /' \
|
||||
-e "s/__import__('$_module.extern./__import__('/" \
|
||||
{} +
|
||||
done
|
||||
|
||||
# Remove post-release tag since we are using stable tags
|
||||
# sed -e '/tag_build = .post/d' \
|
||||
# -e '/tag_date = 1/d' \
|
||||
# -i setuptools-${pkgver}/setup.cfg
|
||||
|
||||
# 'Clean' installation is expected to fail since we removed bundled packages
|
||||
#sed -i '/^def test_clean_env_install/i import pytest\n\n@pytest.mark.xfail' setuptools-${pkgver}/setuptools/tests/test_virtualenv.py
|
||||
|
||||
# Tests failed. Importing an unbundled new setuptools in a virtualenv does not work, but this won't
|
||||
# affect normal virtualenv usage (which don't have to import the unbundled setuptools in *current*
|
||||
# dir.
|
||||
sed -e '/^def test_pip_upgrade_from_source/i @pytest.mark.xfail' \
|
||||
-e '/^def test_test_command_install_requirements/i @pytest.mark.xfail' \
|
||||
-e '/^def test_no_missing_dependencies/i @pytest.mark.xfail' \
|
||||
-i setuptools-${pkgver}/setuptools/tests/test_virtualenv.py
|
||||
|
||||
cp -r setuptools-${pkgver} setuptools-python-${CARCH}
|
||||
}
|
||||
|
||||
build() {
|
||||
# Build python module
|
||||
cd "${srcdir}"/setuptools-python-${CARCH}
|
||||
|
||||
${MINGW_PREFIX}/bin/python setup.py build
|
||||
}
|
||||
|
||||
#check() {
|
||||
# # Workaround UTF-8 tests by setting LC_CTYPE
|
||||
# export LC_CTYPE=en_US.UTF-8
|
||||
check() {
|
||||
cd "${srcdir}"/setuptools-python-${CARCH}
|
||||
|
||||
# # https://github.com/pypa/setuptools/pull/810
|
||||
# export PYTHONDONTWRITEBYTECODE=1
|
||||
|
||||
# cd "${srcdir}"/setuptools-python-${CARCH}
|
||||
# ${MINGW_PREFIX}/bin/python -m pytest --deselect setuptools/tests/test_distutils_adoption.py
|
||||
#}
|
||||
${MINGW_PREFIX}/bin/python -m pytest pkg_resources || true
|
||||
${MINGW_PREFIX}/bin/python -m pytest setuptools || true
|
||||
}
|
||||
|
||||
package() {
|
||||
cd "${srcdir}/setuptools-python-${CARCH}"
|
||||
|
||||
MSYS2_ARG_CONV_EXCL="--prefix=;--install-scripts=;--install-platlib=" \
|
||||
${MINGW_PREFIX}/bin/python setup.py install --prefix=${MINGW_PREFIX#\/} --root="${pkgdir}" --optimize=1 --skip-build
|
||||
${MINGW_PREFIX}/bin/python setup.py install --prefix=${MINGW_PREFIX} --root="${pkgdir}" --optimize=1 --skip-build
|
||||
|
||||
install -Dm644 ${srcdir}/${_realname}-${pkgver}/LICENSE ${pkgdir}${MINGW_PREFIX}/share/licenses/${_realname}/LICENSE
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user