Merge pull request #11828 from lazka/py-bootstrap
Add a bootstrap flag to tomli and wheel
This commit is contained in:
@@ -1,16 +1,24 @@
|
||||
# Maintainer: J. Peter Mugaas <jpmugaas@suddenlink.net>
|
||||
|
||||
_bootstrapping=yes
|
||||
|
||||
_realname=tomli
|
||||
pkgbase=mingw-w64-python-${_realname}
|
||||
pkgname=("${MINGW_PACKAGE_PREFIX}-python-${_realname}")
|
||||
pkgver=2.0.1
|
||||
pkgrel=3
|
||||
pkgrel=4
|
||||
pkgdesc="A lil' TOML parser (mingw-w64)"
|
||||
arch=('any')
|
||||
mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64' 'clang32' 'clangarm64')
|
||||
url='https://github.com/hukkin/tomli'
|
||||
license=('spdx:MIT')
|
||||
depends=("${MINGW_PACKAGE_PREFIX}-python")
|
||||
if [[ "${_bootstrapping}" == "no" ]]; then
|
||||
makedepends=(
|
||||
"${MINGW_PACKAGE_PREFIX}-python-build"
|
||||
"${MINGW_PACKAGE_PREFIX}-python-installer"
|
||||
"${MINGW_PACKAGE_PREFIX}-python-flit-core")
|
||||
fi
|
||||
checkdepends=("${MINGW_PACKAGE_PREFIX}-python-pytest"
|
||||
"${MINGW_PACKAGE_PREFIX}-python-dateutil")
|
||||
source=("${_realname}-$pkgver.tar.gz"::"$url/archive/$pkgver.tar.gz"
|
||||
@@ -24,10 +32,12 @@ build() {
|
||||
cp -r "${_realname}-${pkgver}" "python-build-${MSYSTEM}"
|
||||
cd "python-build-${MSYSTEM}"
|
||||
|
||||
# Don't use python-build to make bootstrapping easier
|
||||
# python -m build --wheel --skip-dependency-check --no-isolation
|
||||
mkdir dist
|
||||
cp "${srcdir}/tomli-$pkgver-py3-none-any.whl" dist
|
||||
if [[ "${_bootstrapping}" == "no" ]]; then
|
||||
python -m build --wheel --skip-dependency-check --no-isolation
|
||||
else
|
||||
mkdir dist
|
||||
cp "${srcdir}/tomli-$pkgver-py3-none-any.whl" dist
|
||||
fi
|
||||
}
|
||||
|
||||
check() {
|
||||
@@ -39,16 +49,17 @@ check() {
|
||||
package() {
|
||||
cd "${srcdir}/python-build-${MSYSTEM}"
|
||||
|
||||
# Don't use python-installer to make bootstrapping easier
|
||||
# MSYS2_ARG_CONV_EXCL="--prefix=" \
|
||||
# python -m installer --prefix=${MINGW_PREFIX} --destdir="${pkgdir}" dist/*.whl
|
||||
|
||||
_pythonpath=`python -c "import sysconfig; print(sysconfig.get_path('platlib'))"`
|
||||
_site_packages="${pkgdir}$(cygpath ${_pythonpath})"
|
||||
mkdir -p "$_site_packages"
|
||||
python "${srcdir}/install_wheel.py" -i"${_site_packages}" dist/*.whl
|
||||
MSYS2_ARG_CONV_EXCL="-p" python -m compileall \
|
||||
-o 0 -o 1 -q -s"${pkgdir}" -p"/" "${pkgdir}${MINGW_PREFIX}/lib/python"*
|
||||
if [[ "${_bootstrapping}" == "no" ]]; then
|
||||
MSYS2_ARG_CONV_EXCL="--prefix=" \
|
||||
python -m installer --prefix=${MINGW_PREFIX} --destdir="${pkgdir}" dist/*.whl
|
||||
else
|
||||
_pythonpath=`python -c "import sysconfig; print(sysconfig.get_path('platlib'))"`
|
||||
_site_packages="${pkgdir}$(cygpath ${_pythonpath})"
|
||||
mkdir -p "$_site_packages"
|
||||
python "${srcdir}/install_wheel.py" -i"${_site_packages}" dist/*.whl
|
||||
MSYS2_ARG_CONV_EXCL="-p" python -m compileall \
|
||||
-o 0 -o 1 -q -s"${pkgdir}" -p"/" "${pkgdir}${MINGW_PREFIX}/lib/python"*
|
||||
fi
|
||||
|
||||
install -Dm644 LICENSE "${pkgdir}${MINGW_PREFIX}/share/licenses/python-${_realname}/LICENSE"
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
# Maintainer: J. Peter Mugaas <jpmugaas@suddenlink.net>
|
||||
|
||||
_bootstrapping=yes
|
||||
|
||||
_pyname=wheel
|
||||
_realname=${_pyname}
|
||||
pkgbase=mingw-w64-python-${_realname}
|
||||
@@ -8,21 +10,35 @@ provides=("${MINGW_PACKAGE_PREFIX}-python3-${_realname}")
|
||||
conflicts=("${MINGW_PACKAGE_PREFIX}-python3-${_realname}")
|
||||
replaces=("${MINGW_PACKAGE_PREFIX}-python3-${_realname}")
|
||||
pkgver=0.37.1
|
||||
pkgrel=2
|
||||
pkgrel=3
|
||||
pkgdesc="A built-package format for Python (mingw-w64)"
|
||||
arch=('any')
|
||||
mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64' 'clang32' 'clangarm64')
|
||||
url="https://pypi.python.org/pypi/wheel"
|
||||
license=('spdx:MIT')
|
||||
depends=("${MINGW_PACKAGE_PREFIX}-python")
|
||||
makedepends=("${MINGW_PACKAGE_PREFIX}-python-installer")
|
||||
if [[ "${_bootstrapping}" == "no" ]]; then
|
||||
makedepends=("${MINGW_PACKAGE_PREFIX}-python-installer")
|
||||
fi
|
||||
options=('!strip')
|
||||
source=("https://files.pythonhosted.org/packages/27/d6/003e593296a85fd6ed616ed962795b2f87709c3eee2bca4f6d0fe55c6d00/wheel-${pkgver}-py2.py3-none-any.whl")
|
||||
sha256sums=('4bdcd7d840138086126cd09254dc6195fb4fc6f01c050a1d7236f2630db1d22a')
|
||||
source=("https://pypi.debian.net/wheel/wheel-${pkgver}-py2.py3-none-any.whl"
|
||||
"install_wheel.py")
|
||||
sha256sums=('4bdcd7d840138086126cd09254dc6195fb4fc6f01c050a1d7236f2630db1d22a'
|
||||
'668e64f912d6360330c403edb6100b21f6aa6dd6a7803d342fab8c35d8176ad9')
|
||||
|
||||
package() {
|
||||
MSYS2_ARG_CONV_EXCL="--prefix=" \
|
||||
python -m installer --prefix=${MINGW_PREFIX} --destdir="${pkgdir}" *.whl
|
||||
|
||||
if [[ "${_bootstrapping}" == "no" ]]; then
|
||||
MSYS2_ARG_CONV_EXCL="--prefix=" \
|
||||
python -m installer --prefix=${MINGW_PREFIX} --destdir="${pkgdir}" *.whl
|
||||
else
|
||||
_pythonpath=`python -c "import sysconfig; print(sysconfig.get_path('platlib'))"`
|
||||
_site_packages="${pkgdir}$(cygpath ${_pythonpath})"
|
||||
mkdir -p "$_site_packages"
|
||||
python "${srcdir}/install_wheel.py" -i"${_site_packages}" *.whl
|
||||
MSYS2_ARG_CONV_EXCL="-p" python -m compileall \
|
||||
-o 0 -o 1 -q -s"${pkgdir}" -p"/" "${pkgdir}${MINGW_PREFIX}/lib/python"*
|
||||
fi
|
||||
|
||||
install -Dm644 *.dist-info/LICENSE.txt "${pkgdir}${MINGW_PREFIX}/share/licenses/python-${_realname}/COPYING"
|
||||
}
|
||||
|
||||
33
mingw-w64-python-wheel/install_wheel.py
Normal file
33
mingw-w64-python-wheel/install_wheel.py
Normal file
@@ -0,0 +1,33 @@
|
||||
import argparse
|
||||
import sys
|
||||
import sysconfig
|
||||
from pathlib import Path
|
||||
from zipfile import ZipFile
|
||||
|
||||
def extract_wheel(whl_path, dest):
|
||||
print("Installing to", dest)
|
||||
with ZipFile(whl_path) as zf:
|
||||
zf.extractall(dest)
|
||||
|
||||
if __name__ == "__main__":
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument(
|
||||
'wheel',
|
||||
type=Path,
|
||||
help=f'wheel to install (.whl file)',
|
||||
)
|
||||
purelib = Path(sysconfig.get_path('purelib')).resolve()
|
||||
parser.add_argument(
|
||||
'--installdir',
|
||||
'-i',
|
||||
type=Path,
|
||||
default=purelib,
|
||||
help=f'installdir directory (defaults to {purelib})',
|
||||
)
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
if not args.installdir.is_dir():
|
||||
sys.exit(f"{args.installdir} is not a directory")
|
||||
|
||||
extract_wheel(args.wheel, args.installdir)
|
||||
Reference in New Issue
Block a user