D5088: hghave: add pyXY features for Python version numbers

2019-01-29 Thread indygreg (Gregory Szorc)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG1a6a01a21d6a: hghave: add pyXY features for Python version 
numbers (authored by indygreg, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5088?vs=13509&id=13552

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

AFFECTED FILES
  tests/hghave.py

CHANGE DETAILS

diff --git a/tests/hghave.py b/tests/hghave.py
--- a/tests/hghave.py
+++ b/tests/hghave.py
@@ -646,6 +646,13 @@
 # chg disables demandimport intentionally for performance wins.
 return ((not has_chg()) and os.environ.get('HGDEMANDIMPORT') != 'disable')
 
+@checkvers("py", "Python >= %s", (2.7, 3.5, 3.6, 3.7, 3.8, 3.9))
+def has_python_range(v):
+major, minor = v.split('.')[0:2]
+py_major, py_minor = sys.version_info.major, sys.version_info.minor
+
+return (py_major, py_minor) >= (int(major), int(minor))
+
 @check("py3", "running with Python 3.x")
 def has_py3():
 return 3 == sys.version_info[0]



To: indygreg, #hg-reviewers
Cc: durin42, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D5088: hghave: add pyXY features for Python version numbers

2019-01-29 Thread durin42 (Augie Fackler)
durin42 added a comment.


  I still don't love this, but I'm landing it to make forward progress on 3.7. 
:/

REPOSITORY
  rHG Mercurial

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

To: indygreg, #hg-reviewers
Cc: durin42, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D5088: hghave: add pyXY features for Python version numbers

2019-01-26 Thread indygreg (Gregory Szorc)
indygreg updated this revision to Diff 13509.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5088?vs=12096&id=13509

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

AFFECTED FILES
  tests/hghave.py

CHANGE DETAILS

diff --git a/tests/hghave.py b/tests/hghave.py
--- a/tests/hghave.py
+++ b/tests/hghave.py
@@ -646,6 +646,13 @@
 # chg disables demandimport intentionally for performance wins.
 return ((not has_chg()) and os.environ.get('HGDEMANDIMPORT') != 'disable')
 
+@checkvers("py", "Python >= %s", (2.7, 3.5, 3.6, 3.7, 3.8, 3.9))
+def has_python_range(v):
+major, minor = v.split('.')[0:2]
+py_major, py_minor = sys.version_info.major, sys.version_info.minor
+
+return (py_major, py_minor) >= (int(major), int(minor))
+
 @check("py3", "running with Python 3.x")
 def has_py3():
 return 3 == sys.version_info[0]



To: indygreg, #hg-reviewers
Cc: durin42, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D5088: hghave: add pyXY features for Python version numbers

2018-10-15 Thread indygreg (Gregory Szorc)
indygreg added a comment.


  In https://phab.mercurial-scm.org/D5088#76415, @durin42 wrote:
  
  > Ah, so I could do (no-py27 no-py35 !) I suppose. Doesn't help with the 
other half, but it's still only three lines...
  
  
  `(no-py27 no-py35 !)` would be "<2.7 & < 3.5", which would only be true for 
<=2.6. You'd want `no-py35` to say "Python 2.7 only" for example.
  
  > I'm not opposed to the patch, but I'm a little wary of it - so far we only 
have one use case and I already worked around that with an (re) line instead.
  
  Explicit annotation of expected differences in behavior is better than e.g. a 
`(re)`. I'm willing to be that `(re)` survives long after we drop support for 
Python 3.6 in several years...

REPOSITORY
  rHG Mercurial

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

To: indygreg, #hg-reviewers
Cc: durin42, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D5088: hghave: add pyXY features for Python version numbers

2018-10-14 Thread durin42 (Augie Fackler)
durin42 added a comment.


  In https://phab.mercurial-scm.org/D5088#76414, @indygreg wrote:
  
  > In https://phab.mercurial-scm.org/D5088#76278, @durin42 wrote:
  >
  > > Is there a way for me to specify something like "<=3.5" and "3.6<=" or 
similar?
  >
  >
  > Adding `no-` to the capability name will invert the condition. e.g. 3.5 
will test false for `no-py27` and `no-py35` and true for `no-py36` and 
`no-py37`.
  >
  > If that is too confusing (I can make an argument it is), we could add a 2nd 
hghave series for the `<=` check. Say `pymax27`, `pymax36` etc.
  
  
  Ah, so I could do (no-py27 no-py35 !) I suppose. Doesn't help with the other 
half, but it's still only three lines...
  
  I'm not opposed to the patch, but I'm a little wary of it - so far we only 
have one use case and I already worked around that with an (re) line instead.

REPOSITORY
  rHG Mercurial

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

To: indygreg, #hg-reviewers
Cc: durin42, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D5088: hghave: add pyXY features for Python version numbers

2018-10-14 Thread indygreg (Gregory Szorc)
indygreg added a comment.


  In https://phab.mercurial-scm.org/D5088#76278, @durin42 wrote:
  
  > Is there a way for me to specify something like "<=3.5" and "3.6<=" or 
similar?
  
  
  Adding `no-` to the capability name will invert the condition. e.g. 3.5 will 
test false for `no-py27` and `no-py35` and true for `no-py36` and `no-py37`.
  
  If that is too confusing (I can make an argument it is), we could add a 2nd 
hghave series for the `<=` check. Say `pymax27`, `pymax36` etc.

REPOSITORY
  rHG Mercurial

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

To: indygreg, #hg-reviewers
Cc: durin42, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D5088: hghave: add pyXY features for Python version numbers

2018-10-14 Thread durin42 (Augie Fackler)
durin42 added a comment.


  Is there a way for me to specify something like "<=3.5" and "3.6<=" or 
similar?

REPOSITORY
  rHG Mercurial

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

To: indygreg, #hg-reviewers
Cc: durin42, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D5088: hghave: add pyXY features for Python version numbers

2018-10-13 Thread indygreg (Gregory Szorc)
indygreg updated this revision to Diff 12096.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5088?vs=12095&id=12096

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

AFFECTED FILES
  tests/hghave.py

CHANGE DETAILS

diff --git a/tests/hghave.py b/tests/hghave.py
--- a/tests/hghave.py
+++ b/tests/hghave.py
@@ -641,6 +641,13 @@
 # chg disables demandimport intentionally for performance wins.
 return ((not has_chg()) and os.environ.get('HGDEMANDIMPORT') != 'disable')
 
+@checkvers("py", "Python >= %s", (2.7, 3.5, 3.6, 3.7, 3.8, 3.9))
+def has_python_range(v):
+major, minor = v.split('.')[0:2]
+py_major, py_minor = sys.version_info.major, sys.version_info.minor
+
+return (py_major, py_minor) >= (int(major), int(minor))
+
 @check("py3", "running with Python 3.x")
 def has_py3():
 return 3 == sys.version_info[0]



To: indygreg, #hg-reviewers
Cc: mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D5088: hghave: add pyXY features for Python version numbers

2018-10-13 Thread indygreg (Gregory Szorc)
indygreg created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  This will allow us to sniff for Python >= versions in tests.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  tests/hghave.py

CHANGE DETAILS

diff --git a/tests/hghave.py b/tests/hghave.py
--- a/tests/hghave.py
+++ b/tests/hghave.py
@@ -641,6 +641,13 @@
 # chg disables demandimport intentionally for performance wins.
 return ((not has_chg()) and os.environ.get('HGDEMANDIMPORT') != 'disable')
 
+@checkvers("py", "Python >= %s", (2.7, 3.5, 3.6, 3.7, 3.8, 3.9))
+def has_python_range(v):
+major, minor = v.split('.')[0:2]
+py_major, py_minor = sys.version_info.major, sys.version_info.minor
+
+return (py_major, py_minor) >= (int(major), int(minor))
+
 @check("py3k", "running with Python 3.x")
 def has_py3k():
 return 3 == sys.version_info[0]



To: indygreg, #hg-reviewers
Cc: mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel