Browse Source

Add backwards compatibility with Python 3.6

Eloston 4 years ago
parent
commit
5bc1222a86
4 changed files with 8 additions and 6 deletions
  1. 1 1
      .cirrus_Dockerfile
  2. 2 2
      docs/developing.md
  3. 4 2
      utils/patches.py
  4. 1 1
      utils/tests/test_patches.py

+ 1 - 1
.cirrus_Dockerfile

@@ -1,5 +1,5 @@
 # Dockerfile for Python 3 with xz-utils (for tar.xz unpacking)
 
-FROM python:3.7-slim
+FROM python:3.6-slim
 
 RUN apt update && apt install -y xz-utils patch

+ 2 - 2
docs/developing.md

@@ -24,7 +24,7 @@ For new flags, first add a constant to `third_party/ungoogled/ungoogled_switches
 
 ## Workflow of updating to a new Chromium version
 
-Tested on Debian 9.0 (stretch). Exact instructions should work on any other Linux or macOS system with the proper dependencies.
+Tested on Debian 10 (buster). Exact instructions should work on any other Linux or macOS system with the proper dependencies.
 
 To gain a deeper understanding of this updating process, have a read through [docs/design.md](design.md).
 
@@ -33,7 +33,7 @@ To gain a deeper understanding of this updating process, have a read through [do
 * [`quilt`](http://savannah.nongnu.org/projects/quilt)
     * This is available in most (if not all) Linux distributions, and also Homebrew on macOS.
     * This utility facilitates most of the updating process, so it is important to learn how to use this. The manpage for quilt (as of early 2017) lacks an example of a workflow. There are multiple guides online, but [this guide from Debian](https://wiki.debian.org/UsingQuilt) and [the referenced guide on that page](https://raphaelhertzog.com/2012/08/08/how-to-use-quilt-to-manage-patches-in-debian-packages/) are the ones referenced in developing the current workflow.
-* Python 3.5 or newer
+* Python 3.6 or newer
 
 ### Downloading the source code
 

+ 4 - 2
utils/patches.py

@@ -64,7 +64,8 @@ def find_and_check_patch(patch_bin_path=None):
 
     # Ensure patch actually runs
     cmd = [str(patch_bin_path), '--version']
-    result = subprocess.run(cmd, capture_output=True, text=True)
+    result = subprocess.run(
+        cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True)
     if result.returncode:
         get_logger().error('"%s" returned non-zero exit code', ' '.join(cmd))
         get_logger().error('stdout:\n%s', result.stdout)
@@ -91,7 +92,8 @@ def dry_run_check(patch_path, tree_path, patch_bin_path=None):
         str(patch_path), '-d',
         str(tree_path), '--no-backup-if-mismatch', '--dry-run'
     ]
-    result = subprocess.run(cmd, capture_output=True, text=True)
+    result = subprocess.run(
+        cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True)
     return result.returncode, result.stdout, result.stderr
 
 

+ 1 - 1
utils/tests/test_patches.py

@@ -14,7 +14,7 @@ from .. import patches
 
 
 def test_find_and_check_patch():
-    patches.find_and_check_patch()
+    assert isinstance(patches.find_and_check_patch(), Path)
 
     with pytest.raises(ValueError):
         patches.find_and_check_patch(patch_bin_path=Path('/this/should/not/exist'))