diff contrib/check-code.py @ 30820:6a70cf94d1b5

py3: replace pycompat.getenv with encoding.environ.get pycompat.getenv returns os.getenvb on py3 which is not available on Windows. This patch replaces them with encoding.environ.get and checks to ensure no new instances of os.getenv or os.setenv are introduced.
author Pulkit Goyal <7895pulkit@gmail.com>
date Sun, 15 Jan 2017 13:17:05 +0530
parents df5d3734b3df
children 561a019c0268 fe8ded72e17c
line wrap: on
line diff
--- a/contrib/check-code.py	Sun Jan 15 16:33:15 2017 +0900
+++ b/contrib/check-code.py	Sun Jan 15 13:17:05 2017 +0530
@@ -465,9 +465,10 @@
     (r'os\.sep', "use pycompat.ossep instead (py3)"),
     (r'os\.pathsep', "use pycompat.ospathsep instead (py3)"),
     (r'os\.altsep', "use pycompat.osaltsep instead (py3)"),
-    (r'os\.getenv', "use pycompat.osgetenv instead (py3)"),
     (r'sys\.platform', "use pycompat.sysplatform instead (py3)"),
     (r'getopt\.getopt', "use pycompat.getoptb instead (py3)"),
+    (r'os\.getenv', "use encoding.environ.get instead"),
+    (r'os\.setenv', "modifying the environ dict is not preferred"),
   ],
   # warnings
   [],