aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMateusz Piotrowski <0mp@FreeBSD.org>2021-04-17 13:21:18 +0000
committerMateusz Piotrowski <0mp@FreeBSD.org>2021-04-17 15:17:21 +0000
commit17de01af95c01bd7cfd513a67c1c0b1494c5ea58 (patch)
treedc721d6eea732be69e95217a27f658f4f9e321ad
parent724bf7a5dc3421fc65234b2cb2597e6783241f69 (diff)
downloadports-17de01af95c01bd7cfd513a67c1c0b1494c5ea58.tar.gz
ports-17de01af95c01bd7cfd513a67c1c0b1494c5ea58.zip
graphics/py-ueberzug: Add a new port
-rw-r--r--graphics/Makefile1
-rw-r--r--graphics/py-ueberzug/Makefile36
-rw-r--r--graphics/py-ueberzug/distinfo3
-rw-r--r--graphics/py-ueberzug/files/patch-ueberzug_query__windows.py20
-rw-r--r--graphics/py-ueberzug/files/patch-ueberzug_xutil.py16
-rw-r--r--graphics/py-ueberzug/pkg-descr13
6 files changed, 89 insertions, 0 deletions
diff --git a/graphics/Makefile b/graphics/Makefile
index 8f4a7b7dffbb..1e3551c59937 100644
--- a/graphics/Makefile
+++ b/graphics/Makefile
@@ -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
diff --git a/graphics/py-ueberzug/Makefile b/graphics/py-ueberzug/Makefile
new file mode 100644
index 000000000000..979f7fa5fb8f
--- /dev/null
+++ b/graphics/py-ueberzug/Makefile
@@ -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>
diff --git a/graphics/py-ueberzug/distinfo b/graphics/py-ueberzug/distinfo
new file mode 100644
index 000000000000..5335d9bdeaac
--- /dev/null
+++ b/graphics/py-ueberzug/distinfo
@@ -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
diff --git a/graphics/py-ueberzug/files/patch-ueberzug_query__windows.py b/graphics/py-ueberzug/files/patch-ueberzug_query__windows.py
new file mode 100644
index 000000000000..2264c3b20cc7
--- /dev/null
+++ b/graphics/py-ueberzug/files/patch-ueberzug_query__windows.py
@@ -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):
diff --git a/graphics/py-ueberzug/files/patch-ueberzug_xutil.py b/graphics/py-ueberzug/files/patch-ueberzug_xutil.py
new file mode 100644
index 000000000000..98108dbf2a38
--- /dev/null
+++ b/graphics/py-ueberzug/files/patch-ueberzug_xutil.py
@@ -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
+
diff --git a/graphics/py-ueberzug/pkg-descr b/graphics/py-ueberzug/pkg-descr
new file mode 100644
index 000000000000..8d862dd0b2e7
--- /dev/null
+++ b/graphics/py-ueberzug/pkg-descr
@@ -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