Patchwork [1,of,9] contrib: ignore empty files in check-py3-compat.py

login
register
mail settings
Submitter Gregory Szorc
Date Dec. 12, 2015, 6:47 p.m.
Message ID <46821367d22ab471662c.1449946064@gps-mbp.local>
Download mbox | patch
Permalink /patch/11983/
State Accepted
Delegated to: Yuya Nishihara
Headers show

Comments

Gregory Szorc - Dec. 12, 2015, 6:47 p.m.
# HG changeset patch
# User Gregory Szorc <gregory.szorc@gmail.com>
# Date 1449944851 18000
#      Sat Dec 12 13:27:31 2015 -0500
# Node ID 46821367d22ab471662c97e1f3216d8fe553d9d5
# Parent  9902117fcf113ad4aa4d9041c949bf27dde3ac70
contrib: ignore empty files in check-py3-compat.py
Yuya Nishihara - Dec. 13, 2015, 5:58 a.m.
On Sat, 12 Dec 2015 13:47:44 -0500, Gregory Szorc wrote:
> # HG changeset patch
> # User Gregory Szorc <gregory.szorc@gmail.com>
> # Date 1449944851 18000
> #      Sat Dec 12 13:27:31 2015 -0500
> # Node ID 46821367d22ab471662c97e1f3216d8fe553d9d5
> # Parent  9902117fcf113ad4aa4d9041c949bf27dde3ac70
> contrib: ignore empty files in check-py3-compat.py

Also queued them, thanks. I'll push them to the clowncopter if the host
come back.

Patch

diff --git a/contrib/check-py3-compat.py b/contrib/check-py3-compat.py
--- a/contrib/check-py3-compat.py
+++ b/contrib/check-py3-compat.py
@@ -16,8 +16,12 @@  def check_compat(f):
     """Check Python 3 compatibility for a file."""
     with open(f, 'rb') as fh:
         content = fh.read()
 
+    # Ignore empty files.
+    if not content.strip():
+        return
+
     root = ast.parse(content)
     futures = set()
     haveprint = False
     for node in ast.walk(root):
diff --git a/tests/test-check-py3-compat.t b/tests/test-check-py3-compat.t
--- a/tests/test-check-py3-compat.t
+++ b/tests/test-check-py3-compat.t
@@ -14,9 +14,8 @@ 
   contrib/fixpax.py not using absolute_import
   contrib/fixpax.py requires print_function
   contrib/hgclient.py not using absolute_import
   contrib/hgclient.py requires print_function
-  contrib/hgfixes/__init__.py not using absolute_import
   contrib/hgfixes/fix_bytes.py not using absolute_import
   contrib/hgfixes/fix_bytesmod.py not using absolute_import
   contrib/hgfixes/fix_leftover_imports.py not using absolute_import
   contrib/import-checker.py not using absolute_import
@@ -124,9 +123,8 @@ 
   mercurial/manifest.py not using absolute_import
   mercurial/mdiff.py not using absolute_import
   mercurial/obsolete.py not using absolute_import
   mercurial/patch.py not using absolute_import
-  mercurial/pure/__init__.py not using absolute_import
   mercurial/pure/base85.py not using absolute_import
   mercurial/pure/bdiff.py not using absolute_import
   mercurial/pure/diffhelpers.py not using absolute_import
   mercurial/pure/mpatch.py not using absolute_import