Show More
@@ -6,32 +6,27 b'' | |||||
6 |
|
6 | |||
7 | import os |
|
7 | import os | |
8 |
|
8 | |||
9 | supportedpy = '~= 2.7' |
|
9 | # Mercurial will never work on Python 3 before 3.5 due to a lack | |
10 | if os.environ.get('HGALLOWPYTHON3', ''): |
|
10 | # of % formatting on bytestrings, and can't work on 3.6.0 or 3.6.1 | |
11 | # Mercurial will never work on Python 3 before 3.5 due to a lack |
|
11 | # due to a bug in % formatting in bytestrings. | |
12 | # of % formatting on bytestrings, and can't work on 3.6.0 or 3.6.1 |
|
12 | # We cannot support Python 3.5.0, 3.5.1, 3.5.2 because of bug in | |
13 | # due to a bug in % formatting in bytestrings. |
|
13 | # codecs.escape_encode() where it raises SystemError on empty bytestring | |
14 | # We cannot support Python 3.5.0, 3.5.1, 3.5.2 because of bug in |
|
14 | # bug link: https://bugs.python.org/issue25270 | |
15 | # codecs.escape_encode() where it raises SystemError on empty bytestring |
|
15 | supportedpy = ','.join( | |
16 | # bug link: https://bugs.python.org/issue25270 |
|
16 | [ | |
17 | # |
|
17 | '>=2.7', | |
18 | # TODO: when we actually work on Python 3, use this string as the |
|
18 | '!=3.0.*', | |
19 | # actual supportedpy string. |
|
19 | '!=3.1.*', | |
20 | supportedpy = ','.join( |
|
20 | '!=3.2.*', | |
21 | [ |
|
21 | '!=3.3.*', | |
22 |
|
|
22 | '!=3.4.*', | |
23 |
|
|
23 | '!=3.5.0', | |
24 |
|
|
24 | '!=3.5.1', | |
25 |
|
|
25 | '!=3.5.2', | |
26 |
|
|
26 | '!=3.6.0', | |
27 |
|
|
27 | '!=3.6.1', | |
28 | '!=3.5.0', |
|
28 | ] | |
29 | '!=3.5.1', |
|
29 | ) | |
30 | '!=3.5.2', |
|
|||
31 | '!=3.6.0', |
|
|||
32 | '!=3.6.1', |
|
|||
33 | ] |
|
|||
34 | ) |
|
|||
35 |
|
30 | |||
36 | import sys, platform |
|
31 | import sys, platform | |
37 | import sysconfig |
|
32 | import sysconfig | |
@@ -89,39 +84,6 b' Python {py} detected.' | |||||
89 | printf(error, file=sys.stderr) |
|
84 | printf(error, file=sys.stderr) | |
90 | sys.exit(1) |
|
85 | sys.exit(1) | |
91 |
|
86 | |||
92 | # We don't yet officially support Python 3. But we want to allow developers to |
|
|||
93 | # hack on. Detect and disallow running on Python 3 by default. But provide a |
|
|||
94 | # backdoor to enable working on Python 3. |
|
|||
95 | if sys.version_info[0] != 2: |
|
|||
96 | badpython = True |
|
|||
97 |
|
||||
98 | # Allow Python 3 from source checkouts. |
|
|||
99 | if os.path.isdir('.hg') or 'HGPYTHON3' in os.environ: |
|
|||
100 | badpython = False |
|
|||
101 |
|
||||
102 | if badpython: |
|
|||
103 | error = """ |
|
|||
104 | Python {py} detected. |
|
|||
105 |
|
||||
106 | Mercurial currently has beta support for Python 3 and use of Python 2.7 is |
|
|||
107 | recommended for the best experience. |
|
|||
108 |
|
||||
109 | Please re-run with Python 2.7 for a faster, less buggy experience. |
|
|||
110 |
|
||||
111 | If you would like to beta test Mercurial with Python 3, this error can |
|
|||
112 | be suppressed by defining the HGPYTHON3 environment variable when invoking |
|
|||
113 | this command. No special environment variables or configuration changes are |
|
|||
114 | necessary to run `hg` with Python 3. |
|
|||
115 |
|
||||
116 | See https://www.mercurial-scm.org/wiki/Python3 for more on Mercurial's |
|
|||
117 | Python 3 support. |
|
|||
118 | """.format( |
|
|||
119 | py='.'.join('%d' % x for x in sys.version_info[0:2]) |
|
|||
120 | ) |
|
|||
121 |
|
||||
122 | printf(error, file=sys.stderr) |
|
|||
123 | sys.exit(1) |
|
|||
124 |
|
||||
125 | if sys.version_info[0] >= 3: |
|
87 | if sys.version_info[0] >= 3: | |
126 | DYLIB_SUFFIX = sysconfig.get_config_vars()['EXT_SUFFIX'] |
|
88 | DYLIB_SUFFIX = sysconfig.get_config_vars()['EXT_SUFFIX'] | |
127 | else: |
|
89 | else: |
General Comments 0
You need to be logged in to leave comments.
Login now