Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
graphics/py-ueberzug: Add a new port
- Loading branch information
Showing
6 changed files
with
89 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
20 changes: 20 additions & 0 deletions
20
graphics/py-ueberzug/files/patch-ueberzug_query__windows.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |