1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-12-20 04:02:27 +00:00

graphics/py-ueberzug: Add a new port

This commit is contained in:
Mateusz Piotrowski 2021-04-17 15:21:18 +02:00
parent 724bf7a5dc
commit 17de01af95
6 changed files with 89 additions and 0 deletions

View File

@ -898,6 +898,7 @@
SUBDIR += py-tifffile
SUBDIR += py-toyplot
SUBDIR += py-traitsui
SUBDIR += py-ueberzug
SUBDIR += py-urbanaccess
SUBDIR += py-urbansim
SUBDIR += py-utm

View File

@ -0,0 +1,36 @@
PORTNAME= ueberzug
DISTVERSION= 18.1.8
CATEGORIES= graphics python
PKGNAMEPREFIX= ${PYTHON_PKGNAMEPREFIX}
MAINTAINER= 0mp@FreeBSD.org
COMMENT= Draw images on terminals with X11 child windows
LICENSE= GPLv3+
LICENSE_FILE= ${WRKSRC}/LICENSE
RUN_DEPENDS= ${PY_PILLOW} \
${PYTHON_PKGNAMEPREFIX}attrs>=18.2.0:devel/py-attrs@${PY_FLAVOR} \
${PYTHON_PKGNAMEPREFIX}docopt>=0:devel/py-docopt@${PY_FLAVOR} \
${PYTHON_PKGNAMEPREFIX}psutil>=0:sysutils/py-psutil@${PY_FLAVOR} \
${PYTHON_PKGNAMEPREFIX}xlib>=0:x11-toolkits/py-xlib@${PY_FLAVOR}
USES= localbase python:3.6+ shebangfix xorg
USE_GITHUB= yes
GH_ACCOUNT= seebye
USE_PYTHON= autoplist concurrent distutils
USE_XORG= x11 xext
SHEBANG_GLOB= *.py *.sh
PORTEXAMPLES= fzfimg.sh mastodon.sh
OPTIONS_DEFINE= EXAMPLES
post-install:
${STRIP_CMD} ${STAGEDIR}${PYTHON_SITELIBDIR}/Xshm.so
post-install-EXAMPLES-on:
${MKDIR} ${STAGEDIR}${EXAMPLESDIR}
${INSTALL_DATA} ${WRKSRC}/examples/* ${STAGEDIR}${EXAMPLESDIR}
.include <bsd.port.mk>

View File

@ -0,0 +1,3 @@
TIMESTAMP = 1618660681
SHA256 (seebye-ueberzug-18.1.8_GH0.tar.gz) = a9fbe22e2ad59f42b148f184af808d6106ae504d9b19797385f2714a6351dbcb
SIZE (seebye-ueberzug-18.1.8_GH0.tar.gz) = 50646

View File

@ -0,0 +1,20 @@
--- ueberzug/query_windows.py.orig 2021-04-17 15:12:52 UTC
+++ ueberzug/query_windows.py
@@ -2,6 +2,7 @@ import os
import signal
import errno
+import psutil
def get_command(pid):
"""Figures out the associated command name
@@ -13,8 +14,7 @@ def get_command(pid):
Returns:
str: the associated command name
"""
- with open('/proc/{}/comm'.format(pid), 'r') as commfile:
- return '\n'.join(commfile.readlines())
+ psutil.Process(pid=pid).name()
def is_same_command(pid0, pid1):

View File

@ -0,0 +1,16 @@
--- ueberzug/xutil.py.orig 2021-04-17 13:57:48 UTC
+++ ueberzug/xutil.py
@@ -147,10 +147,9 @@ def get_first_pty(pids: list):
the first process in the passed list which owns one.
"""
for pid in pids:
- pty_candidate = '/proc/{pid}/fd/1'.format(pid=pid)
- with open(pty_candidate) as pty:
- if os.isatty(pty.fileno()):
- return pty_candidate
+ process = psutil.Process(pid=pid)
+ if process is not None and process.terminal() is not None:
+ return process.terminal()
return None

View File

@ -0,0 +1,13 @@
Überzug is a command line util which allows to draw images on terminals by
using child windows.
Advantages to w3mimgdisplay:
- no race conditions as a new window is created to display images
- expose events will be processed,
- so images will be redrawn on switch workspaces
- tmux support (excluding multi pane windows)
- terminals without the WINDOWID environment variable are supported
- chars are used as position - and size unit
- no memory leak (/ unlimited cache)
WWW: https://github.com/seebye/ueberzug