168 lines
7.8 KiB
Bash
168 lines
7.8 KiB
Bash
# Maintainer: Alexey Pavlov <alexpux@gmail.com>
|
|
# Contributor: Ray Donnelly <mingw.android@gmail.com>
|
|
|
|
_realname=setuptools
|
|
pkgbase=mingw-w64-python-${_realname}
|
|
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
|
|
pkgname=("${MINGW_PACKAGE_PREFIX}-python2-setuptools" "${MINGW_PACKAGE_PREFIX}-python3-setuptools")
|
|
pkgver=40.6.3
|
|
pkgrel=1
|
|
pkgdesc="Easily download, build, install, upgrade, and uninstall Python packages (mingw-w64)"
|
|
arch=('any')
|
|
license=('PSF')
|
|
url="https://pypi.python.org/pypi/setuptools"
|
|
depends=("${MINGW_PACKAGE_PREFIX}-python2" "${MINGW_PACKAGE_PREFIX}-python3")
|
|
source=(${_realname}-${pkgver}.tar.gz::https://github.com/pypa/setuptools/archive/v${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'
|
|
'0004-dont-execute-msvc.patch'
|
|
'0005-execv-warning-patch')
|
|
#_checkdeps=('mock' 'pytest-flake8' 'virtualenv' 'pytest-virtualenv' 'pytest'
|
|
# 'wheel' 'coverage' 'pytest-cov')
|
|
#checkdepends=("${_checkdeps[@]/#/${MINGW_PACKAGE_PREFIX}-python3-}" "${_checkdeps[@]/#/${MINGW_PACKAGE_PREFIX}-python2-}"
|
|
# "${MINGW_PACKAGE_PREFIX}-python3-paver"
|
|
# "${MINGW_PACKAGE_PREFIX}-python2-futures" 'git')
|
|
sha256sums=('ae2a0bea7c79ac14dfb313dae8896362a1f966e547cfbbfd39cd592836926614'
|
|
'd3bc778723e63bbd6e43ab3536a015c547c8c20a95c6679a952284a7a4822996'
|
|
'7bb5617c69566f5fbf1a3ee29a08179e1b41bdeabbc2998bf67615e9aa000424'
|
|
'0e556505cb70ff3a5df856e352d5e2b3cf1582c25d02fc00a2d935a28576b28c'
|
|
'2a854e21e99d6724999e2abeff08451923e9940b4092eb2b638702da17abdb73'
|
|
'c32b0d1d5030055295a3c242069732d1bf5e57dbbbfe7d4cec2cee54228d73a3')
|
|
|
|
prepare() {
|
|
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}/0004-dont-execute-msvc.patch
|
|
patch -p1 -i ${srcdir}/0005-execv-warning-patch
|
|
|
|
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
|
|
|
|
# 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
|
|
|
|
# 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' \
|
|
-i setuptools-$pkgver/setuptools/tests/test_virtualenv.py
|
|
|
|
cp -r setuptools-${pkgver} setuptools-python2-${CARCH}
|
|
cp -r setuptools-${pkgver} setuptools-python3-${CARCH}
|
|
|
|
cd "${srcdir}"/setuptools-python2-${CARCH}
|
|
sed -i -e "s|^#\!.*/usr/bin/python|#!/usr/bin/python2|" tests/manual_test.py
|
|
sed -i -e "s|^#\!.*/usr/bin/env python|#!/usr/bin/env python2|" setuptools/command/easy_install.py
|
|
|
|
cd "${srcdir}"/setuptools-python3-${CARCH}
|
|
sed -i -e "s|^#\!.*/usr/bin/python|#!/usr/bin/python3|" tests/manual_test.py
|
|
sed -i -e "s|^#\!.*/usr/bin/env python|#!/usr/bin/env python3|" setuptools/command/easy_install.py
|
|
}
|
|
|
|
build() {
|
|
# Build python 2 module
|
|
cd "${srcdir}"/setuptools-python2-${CARCH}
|
|
${MINGW_PREFIX}/bin/python2 bootstrap.py
|
|
${MINGW_PREFIX}/bin/python2 setup.py build
|
|
rm -rf build/lib/pkg_resources/_vendor
|
|
rm -rf build/lib/setuptools/_vendor
|
|
|
|
# Build python 3 module
|
|
cd "${srcdir}"/setuptools-python3-${CARCH}
|
|
${MINGW_PREFIX}/bin/python3 bootstrap.py
|
|
${MINGW_PREFIX}/bin/python3 setup.py build
|
|
rm -rf build/lib/pkg_resources/_vendor
|
|
rm -rf build/lib/setuptools/_vendor
|
|
}
|
|
|
|
#check() {
|
|
# # Workaround UTF-8 tests by setting LC_CTYPE
|
|
# export LC_CTYPE=en_US.UTF-8
|
|
|
|
# # https://github.com/pypa/setuptools/pull/810
|
|
# export PYTHONDONTWRITEBYTECODE=1
|
|
|
|
# cd "${srcdir}"/setuptools-python3-${CARCH}
|
|
# ${MINGW_PREFIX}/bin/python setup.py pytest
|
|
|
|
# cd "${srcdir}"/setuptools-python2-${CARCH}
|
|
# ${MINGW_PREFIX}/bin/python2 setup.py pytest
|
|
#}
|
|
|
|
package_python3-setuptools() {
|
|
depends=("${MINGW_PACKAGE_PREFIX}-python3>=3.3"
|
|
"${MINGW_PACKAGE_PREFIX}-python3-packaging"
|
|
"${MINGW_PACKAGE_PREFIX}-python3-pyparsing"
|
|
"${MINGW_PACKAGE_PREFIX}-python3-appdirs"
|
|
"${MINGW_PACKAGE_PREFIX}-python3-six")
|
|
optdepends=("${MINGW_PACKAGE_PREFIX}-python2-certifi: Mozilla's CA Bundle support"
|
|
"${MINGW_PACKAGE_PREFIX}-python2-wincertstore: Windows' cert store support")
|
|
install=${_realname}3-${CARCH}.install
|
|
|
|
local _mingw_prefix=$(cygpath -wm ${MINGW_PREFIX})
|
|
local _py3_base=$(${MINGW_PREFIX}/bin/python3 -c "import sys;sys.stdout.write('.'.join(map(str, sys.version_info[:2])))")
|
|
|
|
cd "${srcdir}/setuptools-python3-${CARCH}"
|
|
MSYS2_ARG_CONV_EXCL="--prefix=;--install-scripts=;--install-platlib=" \
|
|
${MINGW_PREFIX}/bin/python3 setup.py install --prefix=${MINGW_PREFIX#\/} --root="${pkgdir}" --optimize=1 --skip-build
|
|
|
|
# Move files conflicted with python2-setuptools
|
|
mv ${pkgdir}${MINGW_PREFIX}/bin/easy_install-script.py ${pkgdir}${MINGW_PREFIX}/bin/easy_install-${_py3_base}-script.py
|
|
mv ${pkgdir}${MINGW_PREFIX}/bin/easy_install.exe ${pkgdir}${MINGW_PREFIX}/bin/easy_install-${_py3_base}.exe
|
|
[[ -f ${pkgdir}${MINGW_PREFIX}/bin/easy_install.exe.manifest ]] && {
|
|
mv ${pkgdir}${MINGW_PREFIX}/bin/easy_install.exe.manifest ${pkgdir}${MINGW_PREFIX}/bin/easy_install-${_py3_base}.exe.manifest
|
|
sed -e "s|easy_install|easy_install-${_py3_base}|g" -i ${pkgdir}${MINGW_PREFIX}/bin/easy_install-${_py3_base}.exe.manifest
|
|
}
|
|
sed -e "s|${_mingw_prefix}/bin/|${MINGW_PREFIX}/bin/|g" -i ${pkgdir}${MINGW_PREFIX}/bin/easy_install-${_py3_base}-script.py
|
|
}
|
|
|
|
package_python2-setuptools() {
|
|
depends=("${MINGW_PACKAGE_PREFIX}-python2>=2.7"
|
|
"${MINGW_PACKAGE_PREFIX}-python2-packaging"
|
|
"${MINGW_PACKAGE_PREFIX}-python2-pyparsing"
|
|
"${MINGW_PACKAGE_PREFIX}-python2-appdirs"
|
|
"${MINGW_PACKAGE_PREFIX}-python2-six")
|
|
optdepends=("${MINGW_PACKAGE_PREFIX}-python2-certifi: Mozilla's CA Bundle support"
|
|
"${MINGW_PACKAGE_PREFIX}-python2-wincertstore: Windows' cert store support")
|
|
|
|
install=${_realname}2-${CARCH}.install
|
|
local _mingw_prefix=$(cygpath -wm ${MINGW_PREFIX})
|
|
local _py2_base=$(${MINGW_PREFIX}/bin/python2 -c "import sys;sys.stdout.write('.'.join(map(str, sys.version_info[:2])))")
|
|
|
|
cd "${srcdir}/setuptools-python2-${CARCH}"
|
|
MSYS2_ARG_CONV_EXCL="--prefix=;--install-scripts=;--install-platlib=" \
|
|
${MINGW_PREFIX}/bin/python2 setup.py install --prefix=${MINGW_PREFIX#\/} --root="${pkgdir}" --optimize=1 --skip-build
|
|
|
|
sed -e "s|${_mingw_prefix}/bin/|${MINGW_PREFIX}/bin/|g" -i ${pkgdir}${MINGW_PREFIX}/bin/easy_install-script.py
|
|
sed -e "s|${_mingw_prefix}/bin/|${MINGW_PREFIX}/bin/|g" -i ${pkgdir}${MINGW_PREFIX}/bin/easy_install-${_py2_base}-script.py
|
|
}
|
|
|
|
# Wrappers
|
|
package_mingw-w64-i686-python2-setuptools() {
|
|
package_python2-setuptools
|
|
}
|
|
|
|
package_mingw-w64-i686-python3-setuptools() {
|
|
package_python3-setuptools
|
|
}
|
|
|
|
package_mingw-w64-x86_64-python2-setuptools() {
|
|
package_python2-setuptools
|
|
}
|
|
|
|
package_mingw-w64-x86_64-python3-setuptools() {
|
|
package_python3-setuptools
|
|
}
|