[PATCH] D71085: [LNT] Declare support for Python 3.6+

Thomas Preud'homme via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 5 15:54:44 PST 2019


thopre marked 3 inline comments as done.
thopre added inline comments.


================
Comment at: setup.py:12
 
-if sys.version_info < (2, 7):
-    raise RuntimeError("Python 2.7 or higher required.")
+if sys.version_info < (3, 6) and sys.version_info[:2] != (2, 7):
+    raise RuntimeError("Python 2.7 or Python 3.6 or higher required.")
----------------
PrzemekWirkus wrote:
> ```
> if sys.version_info[:2] < (3, 6) and sys.version_info[:2] != (2, 7):
>                    ^^^^
> ```
The {:2] is not necessary here due to how comparison works on tuples (from https://docs.python.org/3/reference/expressions.html#value-comparisons):

Lexicographical comparison between built-in collections works as follows:

    For two collections to compare equal, they must be of the same type, have the same length, and each pair of corresponding elements must compare equal (for example, [1,2] == (1,2) is false because the type is not the same).

    Collections that support order comparison are ordered the same as their first unequal elements (for example, [1,2,x] <= [1,2,y] has the same value as x <= y). If a corresponding element does not exist, the shorter collection is ordered first (for example, [1,2] < [1,2,3] is true).


So any (3, 6, *) will be greater than (3, 6) and any (3, 5, *) will be smaller than (3, 6)


================
Comment at: setup.py:131
 
-    python_requires='>=2.7',
+    python_requires='>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, !=3.5.*',
 )
----------------
PrzemekWirkus wrote:
> I've learnt a new thing today :)
Are you aware of a more succint way?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D71085/new/

https://reviews.llvm.org/D71085





More information about the llvm-commits mailing list