aboutsummaryrefslogtreecommitdiff
path: root/testing
diff options
context:
space:
mode:
authorLeo <thinkabit.ukim@gmail.com>2020-05-31 12:18:40 -0300
committerLeo <thinkabit.ukim@gmail.com>2020-06-04 13:45:40 -0300
commitcc2efd9566a6b5686007424d9b3f45390ed9a67a (patch)
tree3bc7bcdeaf34b9ce244a242aa6596416d05661a4 /testing
parent6e38efeea34e8cae0acb6f91e86e1652c0bf65bd (diff)
downloadalpine_aports-cc2efd9566a6b5686007424d9b3f45390ed9a67a.tar.bz2
alpine_aports-cc2efd9566a6b5686007424d9b3f45390ed9a67a.tar.xz
alpine_aports-cc2efd9566a6b5686007424d9b3f45390ed9a67a.zip
community/flit: move from testing
Diffstat (limited to 'testing')
-rw-r--r--testing/flit/APKBUILD37
-rwxr-xr-xtesting/flit/install-wheel-scripts.py64
2 files changed, 0 insertions, 101 deletions
diff --git a/testing/flit/APKBUILD b/testing/flit/APKBUILD
deleted file mode 100644
index e3261660f1..0000000000
--- a/testing/flit/APKBUILD
+++ /dev/null
@@ -1,37 +0,0 @@
1# Contributor: Leo <thinkabit.ukim@gmail.com>
2# Maintainer: Leo <thinkabit.ukim@gmail.com>
3pkgname=flit
4pkgver=2.3.0
5pkgrel=0
6pkgdesc="Simple packaging tool for simple Python packages"
7options="!check"
8url="https://flit.readthedocs.io"
9arch="noarch"
10license="BSD-3-Clause"
11depends="
12 python3
13 py3-docutils
14 py3-pytoml
15 py3-requests
16 "
17makedepends="unzip"
18_wheel_cli="flit-$pkgver-py3-none-any.whl"
19_wheel_core="flit_core-$pkgver-py2.py3-none-any.whl"
20source="https://files.pythonhosted.org/packages/py3/f/flit/$_wheel_cli
21 https://files.pythonhosted.org/packages/py2.py3/f/flit_core/$_wheel_core
22 install-wheel-scripts.py
23 "
24builddir="$srcdir"
25
26package() {
27 local site="$pkgdir"/usr/lib/"$(readlink /usr/bin/python3)"/site-packages
28 mkdir -p "$site"
29 unzip "$_wheel_core" -d "$site"
30 unzip "$_wheel_cli" -d "$site"
31 "$srcdir"/install-wheel-scripts.py --prefix="$pkgdir"/usr "$_wheel_cli"
32 chmod 644 "$site"/*.dist-info/*
33}
34
35sha512sums="5586f7b0687d0f35e8a1eb90c051f7a104260081954ad2aa02b3b2bc36fe1c8ceab59a41244ebe953b568a6c63093897b3a5532e98e866bf751e534f55c541f8 flit-2.3.0-py3-none-any.whl
36bb7acbfa41759bb7d15c6d8029184aaa6531ce34ea23204ceb616c6752bf3ade6df44a9acc72db424000e9e7e1fff72a4d1dfd087216ec0df689568a134ba46c flit_core-2.3.0-py2.py3-none-any.whl
3796a9eeebec7b362dec9e19309386a28df3243b5b8d84643de8d043a12ae174ca7b111b67a0a335ed0fa1069690b990ef66de5670326e225251ad3bbfef9e3b1e install-wheel-scripts.py"
diff --git a/testing/flit/install-wheel-scripts.py b/testing/flit/install-wheel-scripts.py
deleted file mode 100755
index c60ffb8dfa..0000000000
--- a/testing/flit/install-wheel-scripts.py
+++ /dev/null
@@ -1,64 +0,0 @@
1#!/usr/bin/env python3
2
3import argparse
4from pathlib import Path
5from configparser import ConfigParser
6from zipfile import ZipFile
7
8
9parser = argparse.ArgumentParser(description="Install wheel scripts.")
10parser.add_argument("wheel", type=Path, help="Wheel file")
11parser.add_argument(
12 "--prefix",
13 type=Path,
14 default=Path("/usr/local/"),
15 help="Installation prefix (/usr/, ~/.local, …)",
16)
17
18
19def get_console_scripts(whl):
20 with ZipFile(whl) as archive:
21 n = next(
22 iter(
23 n
24 for n in archive.namelist()
25 if n.endswith(".dist-info/entry_points.txt")
26 ),
27 None,
28 )
29 if n is None:
30 return {}
31 ini = archive.read(n).decode("utf-8")
32 parser = ConfigParser()
33 parser.optionxform = str # case sensitive
34 parser.read_string(ini)
35 return dict(parser["console_scripts"]) if "console_scripts" in parser else {}
36
37
38def main():
39 args = parser.parse_args()
40
41 scripts = get_console_scripts(args.wheel)
42 for name, defn in scripts.items():
43 defn, *_ = defn.split(";") # extra condition
44 mod, fun = defn.split(":")
45 if mod.endswith(".__main__"):
46 mod = mod[: -len(".__main__")]
47 code = f"""\
48#!/bin/sh
49exec /usr/bin/python3 -m {mod} "$@"
50"""
51 else:
52 code = f"""\
53#!/usr/bin/python3
54from {mod} import {fun}
55{fun}()
56"""
57 bin_path = args.prefix / "bin" / name
58 bin_path.parent.mkdir(parents=True, exist_ok=True)
59 bin_path.write_text(code)
60 bin_path.chmod(0o755)
61
62
63if __name__ == "__main__":
64 main()