Patchwork D7268: hghave: add a check for pytype, Google's Python type checker

login
register
mail settings
Submitter phabricator
Date Nov. 6, 2019, 10:57 p.m.
Message ID <differential-rev-PHID-DREV-3sxum5uxpjzehsj2lb2r-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/42821/
State Superseded
Headers show

Comments

phabricator - Nov. 6, 2019, 10:57 p.m.
durin42 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  I'm not unbiased, but I strongly prefer pytype to mypy: it does more
  inference, so we don't need as many annontations. In theory we can use
  both, but since I'm doing some tinkering with pytype I figured I'd
  just try setting it up.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D7268

AFFECTED FILES
  tests/hghave.py

CHANGE DETAILS




To: durin42, #hg-reviewers
Cc: mercurial-devel

Patch

diff --git a/tests/hghave.py b/tests/hghave.py
--- a/tests/hghave.py
+++ b/tests/hghave.py
@@ -1000,3 +1000,11 @@ 
     version = matchoutput(blackcmd, version_regex)
     sv = distutils.version.StrictVersion
     return version and sv(_strpath(version.group(1))) >= sv('19.10b0')
+
+
+@check('pytype', 'the pytype type checker')
+def has_pytype():
+    pytypecmd = 'pytype --version'
+    version = matchoutput(pytypecmd, b'[0-9a-b.]+')
+    sv = distutils.version.StrictVersion
+    return version and sv(_strpath(version.group(0))) >= sv('2019.10.17')