Patchwork D185: setup: fix mistake that prevented Python 3 from being excluded

login
register
mail settings
Submitter phabricator
Date July 26, 2017, 5:33 p.m.
Message ID <differential-rev-PHID-DREV-v5rbtmn5u5otso4re4zm-req@phab.mercurial-scm.org>
Download mbox | patch
Permalink /patch/22557/
State Superseded, archived
Headers show

Comments

phabricator - July 26, 2017, 5:33 p.m.
durin42 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  My intent was to only allow Python 3 if the right environment variable
  is set (for when people want to use `pip install .` on hg
  locally). This fixes the bug in my previous change. I verified that
  `python3.6 run-tests.py` still passes the tests that passed before,
  and that all tests pass on 2.7 (including our virtualenv-using
  installation test).

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  setup.py

CHANGE DETAILS




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

Patch

diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -4,8 +4,10 @@ 
 # 'python setup.py install', or
 # 'python setup.py --help' for more options
 
+import os
+
 supportedpy = '~= 2.7'
-if 'HGALLOWPYTHON3':
+if os.environ.get('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.
@@ -101,7 +103,7 @@ 
 ispypy = "PyPy" in sys.version
 
 import ctypes
-import os, stat, subprocess, time
+import stat, subprocess, time
 import re
 import shutil
 import tempfile