← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] ~cjwatson/launchpad-layers:turnip-still-py36 into launchpad-layers:main

 

Colin Watson has proposed merging ~cjwatson/launchpad-layers:turnip-still-py36 into launchpad-layers:main.

Commit message:
Restore Python 3.6 compatibility in turnip-base

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad-layers/+git/launchpad-layers/+merge/445371

turnip is still deployed on bionic, so its layers need to retain compatibility with Python 3.6 for now.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad-layers:turnip-still-py36 into launchpad-layers:main.
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 85f5926..9c2d3bc 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -15,7 +15,14 @@ repos:
     rev: v3.3.1
     hooks:
     -   id: pyupgrade
+        name: pyupgrade (--py38-plus)
         args: [--py38-plus]
+        exclude: ^turnip
+    -   id: pyupgrade
+        alias: pyupgrade-py36
+        name: pyupgrade (--py36-plus)
+        args: [--py36-plus]
+        files: ^turnip
 -   repo: https://github.com/psf/black
     rev: 22.12.0
     hooks:
diff --git a/turnip-base/lib/charms/turnip/base.py b/turnip-base/lib/charms/turnip/base.py
index 06e5272..7eb96c6 100644
--- a/turnip-base/lib/charms/turnip/base.py
+++ b/turnip-base/lib/charms/turnip/base.py
@@ -47,7 +47,7 @@ def run_dir():
 def data_mount_unit():
     return (
         subprocess.check_output(
-            ["systemd-escape", "--path", data_dir()], text=True
+            ["systemd-escape", "--path", data_dir()], universal_newlines=True
         ).rstrip("\n")
         + ".mount"
     )