[PATCH] fixpax.py: use absolute_import and print_function

Pulkit Goyal 7895pulkit at gmail.com
Tue Mar 1 18:01:11 EST 2016


# HG changeset patch
# User Pulkit Goyal <7895pulkit at gmail.com>
# Date 1456873151 -19800
#      Wed Mar 02 04:29:11 2016 +0530
# Node ID 4ab7f6108799840638228502a4fa57ff59167ce2
# Parent  61bf5a16be1407364fea2481715a3690f211e850
fixpax.py: Added absolute_import and print_function

diff -r 61bf5a16be14 -r 4ab7f6108799 contrib/fixpax.py
--- a/contrib/fixpax.py    Wed Mar 02 04:22:46 2016 +0530
+++ b/contrib/fixpax.py    Wed Mar 02 04:29:11 2016 +0530
@@ -11,7 +11,11 @@
 *.mpkg/Contents/Packages/*.pkg/Contents/Archive.pax.gz
 """

-import sys, os, gzip
+from __future__ import absolute_import
+from __future__ import print_function
+import sys
+import os
+import gzip

 def fixpax(iname, oname):
     i = gzip.GzipFile(iname)
@@ -55,7 +59,7 @@

 if __name__ == '__main__':
     for iname in sys.argv[1:]:
-        print 'fixing file ownership in %s' % iname
+        print('fixing file ownership in %s' % iname)
         oname = sys.argv[1] + '.tmp'
         fixpax(iname, oname)
         os.rename(oname, iname)
diff -r 61bf5a16be14 -r 4ab7f6108799 tests/test-check-py3-compat.t
--- a/tests/test-check-py3-compat.t    Wed Mar 02 04:22:46 2016 +0530
+++ b/tests/test-check-py3-compat.t    Wed Mar 02 04:29:11 2016 +0530
@@ -4,8 +4,6 @@

   $ hg files 'set:(**.py)' | sed 's|\\|/|g' | xargs python
contrib/check-py3-compat.py
   contrib/debugshell.py not using absolute_import
-  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/fix_bytes.py not using absolute_import


More information about the Mercurial-devel mailing list