comparison 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
comparison
equal deleted inserted replaced
30819:897726622877 30820:6a70cf94d1b5
463 (r'os\.name', "use pycompat.osname instead (py3)"), 463 (r'os\.name', "use pycompat.osname instead (py3)"),
464 (r'os\.getcwd', "use pycompat.getcwd instead (py3)"), 464 (r'os\.getcwd', "use pycompat.getcwd instead (py3)"),
465 (r'os\.sep', "use pycompat.ossep instead (py3)"), 465 (r'os\.sep', "use pycompat.ossep instead (py3)"),
466 (r'os\.pathsep', "use pycompat.ospathsep instead (py3)"), 466 (r'os\.pathsep', "use pycompat.ospathsep instead (py3)"),
467 (r'os\.altsep', "use pycompat.osaltsep instead (py3)"), 467 (r'os\.altsep', "use pycompat.osaltsep instead (py3)"),
468 (r'os\.getenv', "use pycompat.osgetenv instead (py3)"),
469 (r'sys\.platform', "use pycompat.sysplatform instead (py3)"), 468 (r'sys\.platform', "use pycompat.sysplatform instead (py3)"),
470 (r'getopt\.getopt', "use pycompat.getoptb instead (py3)"), 469 (r'getopt\.getopt', "use pycompat.getoptb instead (py3)"),
470 (r'os\.getenv', "use encoding.environ.get instead"),
471 (r'os\.setenv', "modifying the environ dict is not preferred"),
471 ], 472 ],
472 # warnings 473 # warnings
473 [], 474 [],
474 ] 475 ]
475 476