Merge pull request #3436 from lazka/python-tomli-bootstrap

python-tomli: rework bootstrap path
This commit is contained in:
Christoph Reiter 2022-12-18 19:26:49 +01:00 committed by GitHub
commit 329cd2a7dd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 47 deletions

View File

@ -1,28 +1,28 @@
pkgname=python-tomli pkgname=python-tomli
pkgver=2.0.1 pkgver=2.0.1
pkgrel=1 pkgrel=2
pkgdesc="A lil' TOML parser" pkgdesc="A lil' TOML parser"
url="https://github.com/hukkin/tomli" url="https://github.com/hukkin/tomli"
license=('spdx:MIT') license=('spdx:MIT')
arch=('any') arch=('any')
depends=('python') depends=('python')
source=("https://pypi.debian.net/tomli/tomli-$pkgver-py3-none-any.whl" makedepends=(
"install_wheel.py") 'python-flit-core'
sha256sums=('939de3e7a6161af0c887ef91b7d41a53e7c5a1ca976325f429cb46ea9bc30ecc' 'python-installer'
'668e64f912d6360330c403edb6100b21f6aa6dd6a7803d342fab8c35d8176ad9') )
source=("https://github.com/hukkin/tomli/archive/$pkgver/$pkgname-$pkgver.tar.gz")
sha256sums=('ad22dbc128623e0c156ffaff019f29f456eba8a5d5a05164dd34f63e560449df')
build() { build() {
mkdir dist cd "tomli-${pkgver}"
cp "tomli-$pkgver-py3-none-any.whl" dist
python -m flit_core.wheel
} }
package() { package() {
_pythonpath=`python -c "import sysconfig; print(sysconfig.get_path('platlib'))"` cd "tomli-${pkgver}"
_site_packages="${pkgdir}${_pythonpath}"
mkdir -p "$_site_packages"
python "${srcdir}/install_wheel.py" -i"${_site_packages}" dist/*.whl
python -m compileall \
-o 0 -o 1 -q -s"${pkgdir}" -p"/" "${_site_packages}"
install -Dm644 tomli*.dist-info/LICENSE -t "$pkgdir"/usr/share/licenses/$pkgname/ python -m installer --destdir="${pkgdir}" dist/*.whl
install -Dm644 LICENSE -t "$pkgdir"/usr/share/licenses/$pkgname/
} }

View File

@ -1,33 +0,0 @@
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)