Skip to content

Commit b1dc338

Browse files
committed
Increase minimum Python version to 3.9
Python 3.8 has been end of life for over a year. A lot of tools stopped supporting Python 3.8.
1 parent 44a3d15 commit b1dc338

File tree

7 files changed

+36
-26
lines changed

7 files changed

+36
-26
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ Also see [`examples/`](examples/) folder for code examples.
3434

3535
## Requirements
3636

37-
* Python version 3.7 or higher
37+
* Python version 3.9 or higher
3838

3939
### [PyPI wheels](https://pypi.org/project/lxns/)
4040

examples/add_bind_mount.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,10 @@ def create_tree_clone(what: str) -> ClonedTree:
2727

2828

2929
def main(pid: int, what: str, where: str) -> None:
30-
with MountNamespace.from_pid(
31-
pid
32-
) as target_mount_ns, target_mount_ns.get_user_namespace() as target_user_ns:
30+
with (
31+
MountNamespace.from_pid(pid) as target_mount_ns,
32+
target_mount_ns.get_user_namespace() as target_user_ns,
33+
):
3334
# Join target user namespace
3435
target_user_ns.setns() # This should give us CAP_SYS_ADMIN
3536
# Don't join the mount namespace until we clone the tree'

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ license = {text = "MPL-2.0"}
99
authors = [
1010
{name = "igo95862"}
1111
]
12-
requires-python = ">= 3.7"
12+
requires-python = ">= 3.9"
1313
keywords = ["linux", "namespace", "namespaces", "mount", "sandbox", "containers"]
1414
classifiers = [
1515
"Development Status :: 4 - Beta",

src/lxns/meson.build

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ endif
1010

1111
limited_api = ''
1212
if get_option('use_limited_api')
13-
limited_api = '3.7'
13+
limited_api = '3.9'
1414
endif
1515

1616
mount_api_found_open_tree = false

test/test_os.py

Lines changed: 25 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -77,34 +77,40 @@ def test_unshare_user_namespace(self) -> None:
7777
self.assertNotEqual(uid_before_test, uid_after)
7878

7979
def test_errors(self) -> None:
80-
with self.subTest("Unshare with invalid value"), self.assertRaisesRegex(
81-
OSError, "22"
80+
with (
81+
self.subTest("Unshare with invalid value"),
82+
self.assertRaisesRegex(OSError, "22"),
8283
):
8384
unshare(-1)
8485

8586
with TemporaryFile() as temp_f:
86-
with self.subTest("setns on invalid fd"), self.assertRaisesRegex(
87-
OSError, "22"
87+
with (
88+
self.subTest("setns on invalid fd"),
89+
self.assertRaisesRegex(OSError, "22"),
8890
):
8991
setns(temp_f.fileno(), 0)
9092

91-
with self.subTest("ns_get_userns on invalid fd"), self.assertRaisesRegex(
92-
OSError, "25"
93+
with (
94+
self.subTest("ns_get_userns on invalid fd"),
95+
self.assertRaisesRegex(OSError, "25"),
9396
):
9497
ns_get_userns(temp_f.fileno())
9598

96-
with self.subTest("ns_get_parent on invalid fd"), self.assertRaisesRegex(
97-
OSError, "25"
99+
with (
100+
self.subTest("ns_get_parent on invalid fd"),
101+
self.assertRaisesRegex(OSError, "25"),
98102
):
99103
ns_get_parent(temp_f.fileno())
100104

101-
with self.subTest("ns_get_nstype on invalid fd"), self.assertRaisesRegex(
102-
OSError, "25"
105+
with (
106+
self.subTest("ns_get_nstype on invalid fd"),
107+
self.assertRaisesRegex(OSError, "25"),
103108
):
104109
ns_get_nstype(temp_f.fileno())
105110

106-
with self.subTest("ns_get_owner_uid on invalid fd"), self.assertRaisesRegex(
107-
OSError, "25"
111+
with (
112+
self.subTest("ns_get_owner_uid on invalid fd"),
113+
self.assertRaisesRegex(OSError, "25"),
108114
):
109115
ns_get_owner_uid(temp_f.fileno())
110116

@@ -149,11 +155,13 @@ def test_ns_get_functions(self) -> None:
149155
stat(child_userns_file_path).st_ino,
150156
)
151157

152-
with open(child_userns_file_path) as child_userns_file, open(
153-
ns_get_parent(child_userns_file.fileno())
154-
) as child_parent_ns_file, open(
155-
ns_get_userns(child_userns_file.fileno())
156-
) as child_userns_owner_userns_file:
158+
with (
159+
open(child_userns_file_path) as child_userns_file,
160+
open(ns_get_parent(child_userns_file.fileno())) as child_parent_ns_file,
161+
open(
162+
ns_get_userns(child_userns_file.fileno())
163+
) as child_userns_owner_userns_file,
164+
):
157165
self.assertEqual(
158166
ns_get_owner_uid(child_userns_file.fileno()),
159167
getuid(),

tools/audit_wheel_wrapper.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,9 @@
99

1010

1111
def main(arch: str, wrapped_args: list[str]) -> None:
12-
with patch("sys.argv", [""] + wrapped_args), patch(
13-
"platform.machine", return_value=arch
12+
with (
13+
patch("sys.argv", [""] + wrapped_args),
14+
patch("platform.machine", return_value=arch),
1415
):
1516
auditwheel_main()
1617

tools/run_linters.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ def run_isort() -> bool:
6464

6565
def run_mypy() -> bool:
6666
return run_linter(
67-
["mypy", "--pretty", "--strict", "--python-version", "3.8", *PYTHON_SOURCES]
67+
["mypy", "--pretty", "--strict", "--python-version", "3.9", *PYTHON_SOURCES]
6868
)
6969

7070

0 commit comments

Comments
 (0)