Gentoo Archives: gentoo-commits

From: Matt Turner <mattst88@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/catalyst:pending/mattst88 commit in: /, catalyst/
Date: Thu, 29 Oct 2020 19:05:54
Message-Id: 1603998344.2a6fd5d0c069814d38116d6f18bd898b2f40a547.mattst88@gentoo
1 commit: 2a6fd5d0c069814d38116d6f18bd898b2f40a547
2 Author: Matt Turner <mattst88 <AT> gentoo <DOT> org>
3 AuthorDate: Thu Oct 22 18:52:46 2020 +0000
4 Commit: Matt Turner <mattst88 <AT> gentoo <DOT> org>
5 CommitDate: Thu Oct 29 19:05:44 2020 +0000
6 URL: https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=2a6fd5d0
7
8 catalyst: Rewrite ismount() to use libmount
9
10 libmount is provided by util-linux, so this adds a dependency on
11 sys-apps/util-linux[python]. A later patch will make more extensive use
12 of this API.
13
14 Signed-off-by: Matt Turner <mattst88 <AT> gentoo.org>
15
16 README | 2 +-
17 catalyst/support.py | 14 +++++++-------
18 setup.py | 2 --
19 3 files changed, 8 insertions(+), 10 deletions(-)
20
21 diff --git a/README b/README
22 index 1cceb63e..594de9e1 100644
23 --- a/README
24 +++ b/README
25 @@ -17,7 +17,7 @@ simple and reproducable manner. Use at your own risk.
26 Requirements
27 =======================
28
29 -- Python 3.6 or greater
30 +- Python 3.8 or greater
31 - A generic stage3 tarball for your architecture
32 - A squashfs ebuild repository snapshot
33 - Or an ebuild git repo with sys-fs/squashfs-tools-ng and dev-vcs/git
34
35 diff --git a/catalyst/support.py b/catalyst/support.py
36 index 4458ed20..ddbd9ab9 100644
37 --- a/catalyst/support.py
38 +++ b/catalyst/support.py
39 @@ -8,6 +8,8 @@ import time
40 from pathlib import Path
41 from subprocess import Popen
42
43 +import libmount
44 +
45 from catalyst import log
46
47 BASH_BINARY = "/bin/bash"
48 @@ -182,15 +184,13 @@ def read_makeconf(mymakeconffile):
49
50 def ismount(path):
51 """Like os.path.ismount, but also support bind mounts"""
52 - if os.path.ismount(path):
53 + path = Path(path)
54 + if path.is_mount():
55 return True
56
57 - a = os.popen("mount")
58 - mylines = a.readlines()
59 - a.close()
60 - for line in mylines:
61 - mysplit = line.split()
62 - if Path(path) == Path(mysplit[2]):
63 + cxt = libmount.Context()
64 + while (fs := cxt.mtab.next_fs()) is not None:
65 + if path == Path(fs.target):
66 return True
67
68 return False
69
70 diff --git a/setup.py b/setup.py
71 index 7a97b30c..fc1ac005 100755
72 --- a/setup.py
73 +++ b/setup.py
74 @@ -101,8 +101,6 @@ _setup(
75 'Topic :: System :: Installation/Setup',
76 'Topic :: System :: Software Distribution',
77 'Programming Language :: Python :: 3',
78 - 'Programming Language :: Python :: 3.6',
79 - 'Programming Language :: Python :: 3.7',
80 'Programming Language :: Python :: 3.8',
81 ],
82 scripts=['bin/{0}'.format(_package_name)],