Patchwork [4,of,5,stable] setup: explicitly declare supported Python versions

login
register
mail settings
Submitter Augie Fackler
Date July 24, 2017, 9:08 p.m.
Message ID <6d82dcfad5dfb1b1a83c.1500930492@augie-macbookpro2.roam.corp.google.com>
Download mbox | patch
Permalink /patch/22548/
State Accepted
Headers show

Comments

Augie Fackler - July 24, 2017, 9:08 p.m.
# HG changeset patch
# User Augie Fackler <augie@google.com>
# Date 1500647992 14400
#      Fri Jul 21 10:39:52 2017 -0400
# Branch stable
# Node ID 6d82dcfad5dfb1b1a83c47055dc8a2377c59701b
# Parent  5af4fa0a0bbbeadb3569b68f0440120a786c81f2
setup: explicitly declare supported Python versions

I think we should probably backport this to 4.2 as well, and do one
more release there that explicitly declares 2.6 support. That way
anyone stuck on Python 2.6 will end up getting the right hg if they
use a modern pip to install. Users can still use `python setup.py`
incantations to attempt installing Mercurial on unsupported Pythons,
including 3.5 and 3.6.

A followup change will switch to only doing our own
Python-version-check logic if we're not being installed by a
reasonable pip.

Patch

diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -4,6 +4,25 @@ 
 # 'python setup.py install', or
 # 'python setup.py --help' for more options
 
+supportedpy = '~= 2.7'
+if 'HGALLOWPYTHON3':
+    # Mercurial will never work on Python 3 before 3.5 due to a lack
+    # of % formatting on bytestrings, and can't work on 3.6.0 or 3.6.1
+    # due to a bug in % formatting in bytestrings.
+    #
+    # TODO: when we actually work on Python 3, use this string as the
+    # actual supportedpy string.
+    supportedpy = ','.join([
+        '>=2.7',
+        '!=3.0.*',
+        '!=3.1.*',
+        '!=3.2.*',
+        '!=3.3.*',
+        '!=3.4.*',
+        '!=3.6.0',
+        '!=3.6.1',
+    ])
+
 import sys, platform
 if sys.version_info < (2, 7, 0, 'final'):
     raise SystemExit('Mercurial requires Python 2.7 or later.')
@@ -892,4 +911,5 @@  setup(name='mercurial',
                               'welcome': 'contrib/macosx/Welcome.html',
                               },
                },
+      python_requires=supportedpy,
       **extra)