setup.py
changeset 38721 dbbe45ae5ad1
parent 38207 db9d1dd01bf0
child 39210 1ddb296e0dee
equal deleted inserted replaced
38720:d12415b8f833 38721:dbbe45ae5ad1
    72 # backdoor to enable working on Python 3.
    72 # backdoor to enable working on Python 3.
    73 if sys.version_info[0] != 2:
    73 if sys.version_info[0] != 2:
    74     badpython = True
    74     badpython = True
    75 
    75 
    76     # Allow Python 3 from source checkouts.
    76     # Allow Python 3 from source checkouts.
    77     if os.path.isdir('.hg'):
    77     if os.path.isdir('.hg') or 'HGPYTHON3' in os.environ:
    78         badpython = False
    78         badpython = False
    79 
    79 
    80     if badpython:
    80     if badpython:
    81         error = """
    81         error = """
    82 Mercurial only supports Python 2.7.
    82 Mercurial only supports Python 2.7.
   367     oldpolicy = os.environ.get('HGMODULEPOLICY', None)
   367     oldpolicy = os.environ.get('HGMODULEPOLICY', None)
   368     os.environ['HGMODULEPOLICY'] = 'py'
   368     os.environ['HGMODULEPOLICY'] = 'py'
   369     from mercurial import __version__
   369     from mercurial import __version__
   370     version = __version__.version
   370     version = __version__.version
   371 except ImportError:
   371 except ImportError:
   372     version = 'unknown'
   372     version = b'unknown'
   373 finally:
   373 finally:
   374     if oldpolicy is None:
   374     if oldpolicy is None:
   375         del os.environ['HGMODULEPOLICY']
   375         del os.environ['HGMODULEPOLICY']
   376     else:
   376     else:
   377         os.environ['HGMODULEPOLICY'] = oldpolicy
   377         os.environ['HGMODULEPOLICY'] = oldpolicy