From 6af36d2d6d4b2327dbb7196bbc18a72bb4afce61 Mon Sep 17 00:00:00 2001 From: odrling Date: Fri, 22 Mar 2024 01:43:44 +0100 Subject: [PATCH] net-misc/hikari: add 1.6, drop 1.5 --- net-misc/hikari/Manifest | 2 +- net-misc/hikari/files/remove-pyperclip.patch | 98 +++++++++++++++++++ .../{hikari-1.5.ebuild => hikari-1.6.ebuild} | 13 ++- 3 files changed, 109 insertions(+), 4 deletions(-) create mode 100644 net-misc/hikari/files/remove-pyperclip.patch rename net-misc/hikari/{hikari-1.5.ebuild => hikari-1.6.ebuild} (69%) diff --git a/net-misc/hikari/Manifest b/net-misc/hikari/Manifest index 48196d0..5038234 100644 --- a/net-misc/hikari/Manifest +++ b/net-misc/hikari/Manifest @@ -1 +1 @@ -DIST hikari-1.5.tar.gz 14652 BLAKE2B a36459d7cf6373bd22f14ffe14586a0ebe4d611d9d2f8ce4c3ccfd0203c73777a68bdaf360279a4997811f45e33fa9425564b0e1472480c31800b4716d492148 SHA512 dc815dcafbd15af6037ab193fbc90ffaf6c1f41ea383d3b6ebd1398060ac2fff402422c256f237783a65919b0e88364b5baba08ebe86199360603553baea723c +DIST hikari-1.6.tar.gz 14677 BLAKE2B 386fd0fbf7cbddbdfd05f63f0447b565b3ca4fbaf4413a903d170f29069bb015ae153f16ca8ef89ba40d2c967e93c7da36145feedf79654f8f8974ac0896354f SHA512 a2a00f1c475c444d1e7a1dde48544261e679bf52053ba28c5ffeabd6316879981a342926645f1e7c14d27df22b4bc7672d40bc4d471e29b9832eb2fca7ae0df1 diff --git a/net-misc/hikari/files/remove-pyperclip.patch b/net-misc/hikari/files/remove-pyperclip.patch new file mode 100644 index 0000000..9c5fc73 --- /dev/null +++ b/net-misc/hikari/files/remove-pyperclip.patch @@ -0,0 +1,98 @@ +From eb4caa96b870e0bb3da467968b096733cd2bb1f4 Mon Sep 17 00:00:00 2001 +From: odrling +Date: Fri, 22 Mar 2024 01:39:25 +0100 +Subject: [PATCH] remove pyperclip + +mostly useful to install on headless systems +--- + hikari/hikari.py | 19 ++++--------------- + pyproject.toml | 1 - + typings/pyperclip/__init__.pyi | 1 - + 3 files changed, 4 insertions(+), 17 deletions(-) + delete mode 100644 typings/pyperclip/__init__.pyi + +diff --git a/hikari/hikari.py b/hikari/hikari.py +index 222f064..66742bd 100755 +--- a/hikari/hikari.py ++++ b/hikari/hikari.py +@@ -24,7 +24,6 @@ from pathlib import Path + from typing import Literal, Optional + + import httpx +-import pyperclip + import typer + from rich.console import Console + from rich.progress import ( +@@ -73,11 +72,8 @@ def check_hash(filename: str, file: Path): + return UploadResponse(**req.json()) + + +-def output(copy: bool, resp: UploadResponse): +- if copy: +- pyperclip.copy(resp.url) +- action = "Copied" +- elif resp.status == "exists": ++def output(resp: UploadResponse): ++ if resp.status == "exists": + action = "Found" + elif resp.status == "uploaded": + action = "Uploaded" +@@ -134,26 +130,19 @@ def upload(file: Path, + None, "--name", "-n", + help="Rename the uploaded file." + ), +- copy: bool = typer.Option( +- False, "--copy", "-c", +- help="Copy file URL to clipboard." +- ), + hash: bool = typer.Option( + True, "--hash/--no-hash", "-h/-H", + help="Check file hash before uploading." + )): + + with get_client(): +- if copy: +- pyperclip.copy("") +- + if obstruct: + filename = f"{hashlib.sha256(file.name.encode()).hexdigest()}{file.suffix}" + elif filename is None: + filename = file.name + + if hash and (resp := check_hash(filename, file)): +- return output(copy, resp) ++ return output(resp) + + with file.open('br') as f: + monitor = ProgressMonitor(filename, f) +@@ -164,7 +153,7 @@ def upload(file: Path, + + req.raise_for_status() + data = UploadResponse(**req.json()) +- output(copy, data) ++ output(data) + + + def main(): +diff --git a/pyproject.toml b/pyproject.toml +index 22398fe..88ed4ff 100644 +--- a/pyproject.toml ++++ b/pyproject.toml +@@ -7,7 +7,6 @@ name = "hikari" + dynamic = ["version"] + license = {file = "LICENSE"} + dependencies = [ +- "pyperclip", + "httpx", + "rich", + "typer", +diff --git a/typings/pyperclip/__init__.pyi b/typings/pyperclip/__init__.pyi +deleted file mode 100644 +index 86dc588..0000000 +--- a/stubs/pyperclip/__init__.pyi ++++ /dev/null +@@ -1 +0,0 @@ +-def copy(text: str) -> None: ... +-- +2.44.0 + diff --git a/net-misc/hikari/hikari-1.5.ebuild b/net-misc/hikari/hikari-1.6.ebuild similarity index 69% rename from net-misc/hikari/hikari-1.5.ebuild rename to net-misc/hikari/hikari-1.6.ebuild index 37d1575..ce7e26d 100644 --- a/net-misc/hikari/hikari-1.5.ebuild +++ b/net-misc/hikari/hikari-1.6.ebuild @@ -17,12 +17,19 @@ LICENSE="GPL-3+" SLOT="0" KEYWORDS="~amd64 ~arm64" +IUSE="X wayland" + RDEPEND=" $(python_gen_cond_dep ' - dev-python/pyperclip[${PYTHON_USEDEP}] - dev-python/requests[${PYTHON_USEDEP}] - dev-python/requests-toolbelt[${PYTHON_USEDEP}] + X? ( dev-python/pyperclip[${PYTHON_USEDEP}] ) + wayland? ( dev-python/pyperclip[${PYTHON_USEDEP}] ) + dev-python/httpx[${PYTHON_USEDEP}] dev-python/rich[${PYTHON_USEDEP}] dev-python/typer[${PYTHON_USEDEP}] ') " + +src_prepare() { + ! use X && ! use wayland && eapply "${FILESDIR}/remove-pyperclip.patch" + eapply_user +}