diff options
author | Matt Turner <mattst88@gentoo.org> | 2020-10-22 11:52:46 -0700 |
---|---|---|
committer | Matt Turner <mattst88@gentoo.org> | 2020-10-30 18:40:52 -0400 |
commit | efe2e4fa789550473734269f27a4029df208a2b2 (patch) | |
tree | e96164099b0dfa30eef28f1cbdcd228482d081ed | |
parent | catalyst: Replace pathcompare() (diff) | |
download | catalyst-efe2e4fa789550473734269f27a4029df208a2b2.tar.gz catalyst-efe2e4fa789550473734269f27a4029df208a2b2.tar.bz2 catalyst-efe2e4fa789550473734269f27a4029df208a2b2.zip |
catalyst: Rewrite ismount() to use libmount
libmount is provided by util-linux, so this adds a dependency on
sys-apps/util-linux[python]. A later patch will make more extensive use
of this API.
Signed-off-by: Matt Turner <mattst88@gentoo.org>
-rw-r--r-- | README | 2 | ||||
-rw-r--r-- | catalyst/support.py | 14 | ||||
-rwxr-xr-x | setup.py | 2 |
3 files changed, 8 insertions, 10 deletions
@@ -17,7 +17,7 @@ simple and reproducable manner. Use at your own risk. Requirements ======================= -- Python 3.6 or greater +- Python 3.8 or greater - A generic stage3 tarball for your architecture - A squashfs ebuild repository snapshot - Or an ebuild git repo with sys-fs/squashfs-tools-ng and dev-vcs/git diff --git a/catalyst/support.py b/catalyst/support.py index 4458ed20..ddbd9ab9 100644 --- a/catalyst/support.py +++ b/catalyst/support.py @@ -8,6 +8,8 @@ import time from pathlib import Path from subprocess import Popen +import libmount + from catalyst import log BASH_BINARY = "/bin/bash" @@ -182,15 +184,13 @@ def read_makeconf(mymakeconffile): def ismount(path): """Like os.path.ismount, but also support bind mounts""" - if os.path.ismount(path): + path = Path(path) + if path.is_mount(): return True - a = os.popen("mount") - mylines = a.readlines() - a.close() - for line in mylines: - mysplit = line.split() - if Path(path) == Path(mysplit[2]): + cxt = libmount.Context() + while (fs := cxt.mtab.next_fs()) is not None: + if path == Path(fs.target): return True return False @@ -101,8 +101,6 @@ _setup( 'Topic :: System :: Installation/Setup', 'Topic :: System :: Software Distribution', 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.6', - 'Programming Language :: Python :: 3.7', 'Programming Language :: Python :: 3.8', ], scripts=['bin/{0}'.format(_package_name)], |