summaryrefslogtreecommitdiff
path: root/user
diff options
context:
space:
mode:
Diffstat (limited to 'user')
-rw-r--r--user/py3-psutil/APKBUILD30
-rw-r--r--user/py3-psutil/utmpx.patch87
2 files changed, 117 insertions, 0 deletions
diff --git a/user/py3-psutil/APKBUILD b/user/py3-psutil/APKBUILD
new file mode 100644
index 000000000..66d9da144
--- /dev/null
+++ b/user/py3-psutil/APKBUILD
@@ -0,0 +1,30 @@
+# Contributor: A. Wilcox <awilfox@adelielinux.org>
+# Maintainer: A. Wilcox <awilfox@adelielinux.org>
+pkgname=py3-psutil
+_pkgname=${pkgname#py3-}
+pkgver=5.6.2
+pkgrel=0
+pkgdesc="Process and system utilities"
+url="https://pypi.org/project/psutil/"
+arch="all"
+options="!check" # Requires itself to be installed first
+license="BSD-3-Clause"
+depends="python3"
+makedepends="python3-dev utmps-dev"
+subpackages=""
+source="https://files.pythonhosted.org/packages/source/${_pkgname:0:1}/$_pkgname/$_pkgname-$pkgver.tar.gz
+ utmpx.patch
+ "
+builddir="$srcdir/$_pkgname-$pkgver"
+
+build() {
+ LIBS="-lutmps -lskarnet" python3 setup.py build
+}
+
+package() {
+ mkdir -p "$pkgdir"
+ python3 setup.py install --prefix=/usr --root="$pkgdir"
+}
+
+sha512sums="ff41428b43c59ad948b8b4e6824943258abb30dc76cd042bdf7fe72d5aceb9bcbd2a2038a6a43d2b4c36eccae9007ef78779fe0cb5ee3caa68da9b1ba687b66d psutil-5.6.2.tar.gz
+5b0eea07856afeb0eff3268dc78bd3daf3491022e8a08c422db3eaad1b5e0da71429fe9e2e4b23f3eabf9669e7e4fb5a187c96aedbfe994692bb3e5a98fe2fc2 utmpx.patch"
diff --git a/user/py3-psutil/utmpx.patch b/user/py3-psutil/utmpx.patch
new file mode 100644
index 000000000..e7881e8f2
--- /dev/null
+++ b/user/py3-psutil/utmpx.patch
@@ -0,0 +1,87 @@
+--- psutil-5.6.2/psutil/_psutil_linux.c.old 2019-04-11 21:10:12.000000000 +0000
++++ psutil-5.6.2/psutil/_psutil_linux.c 2019-06-14 20:19:26.804374285 +0000
+@@ -14,7 +14,7 @@
+ #include <stdlib.h>
+ #include <mntent.h>
+ #include <features.h>
+-#include <utmp.h>
++#include <utmpx.h>
+ #include <sched.h>
+ #include <linux/version.h>
+ #include <sys/syscall.h>
+@@ -454,7 +454,7 @@
+ */
+ static PyObject *
+ psutil_users(PyObject *self, PyObject *args) {
+- struct utmp *ut;
++ struct utmpx *utx;
+ PyObject *py_retlist = PyList_New(0);
+ PyObject *py_tuple = NULL;
+ PyObject *py_username = NULL;
+@@ -465,20 +465,20 @@
+ if (py_retlist == NULL)
+ return NULL;
+- setutent();
++ setutxent();
+- while (NULL != (ut = getutent())) {
++ while (NULL != (utx = getutxent())) {
+ py_tuple = NULL;
+ py_user_proc = NULL;
+- if (ut->ut_type == USER_PROCESS)
++ if (utx->ut_type == USER_PROCESS)
+ py_user_proc = Py_True;
+ else
+ py_user_proc = Py_False;
+- py_username = PyUnicode_DecodeFSDefault(ut->ut_user);
++ py_username = PyUnicode_DecodeFSDefault(utx->ut_user);
+ if (! py_username)
+ goto error;
+- py_tty = PyUnicode_DecodeFSDefault(ut->ut_line);
++ py_tty = PyUnicode_DecodeFSDefault(utx->ut_line);
+ if (! py_tty)
+ goto error;
+- py_hostname = PyUnicode_DecodeFSDefault(ut->ut_host);
++ py_hostname = PyUnicode_DecodeFSDefault(utx->ut_host);
+ if (! py_hostname)
+ goto error;
+ py_tuple = Py_BuildValue(
+@@ -486,9 +486,9 @@
+ py_username, // username
+ py_tty, // tty
+ py_hostname, // hostname
+- (float)ut->ut_tv.tv_sec, // tstamp
++ (float)utx->ut_tv.tv_sec, // tstamp
+ py_user_proc, // (bool) user process
+- ut->ut_pid // process id
++ utx->ut_pid // process id
+ );
+ if (! py_tuple)
+ goto error;
+@@ -499,7 +499,7 @@
+ Py_DECREF(py_hostname);
+ Py_DECREF(py_tuple);
+ }
+- endutent();
++ endutxent();
+ return py_retlist;
+
+ error:
+@@ -508,7 +508,7 @@
+ Py_XDECREF(py_hostname);
+ Py_XDECREF(py_tuple);
+ Py_DECREF(py_retlist);
+- endutent();
++ endutxent();
+ return NULL;
+ }
+
+--- psutil-5.6.2/setup.py.old 2019-04-11 21:10:12.000000000 +0000
++++ psutil-5.6.2/setup.py 2019-06-14 20:25:29.994927919 +0000
+@@ -227,6 +227,7 @@
+ ext = Extension(
+ 'psutil._psutil_linux',
+ sources=sources + ['psutil/_psutil_linux.c'],
++ libraries=['utmps', 'skarnet'],
+ define_macros=macros)
+
+ elif SUNOS: