Show More
@@ -27,28 +27,19 b' except ImportError:' | |||||
27 | stdout = getattr(sys.stdout, 'buffer', sys.stdout) |
|
27 | stdout = getattr(sys.stdout, 'buffer', sys.stdout) | |
28 | stderr = getattr(sys.stderr, 'buffer', sys.stderr) |
|
28 | stderr = getattr(sys.stderr, 'buffer', sys.stderr) | |
29 |
|
29 | |||
30 | is_not_python2 = sys.version_info[0] >= 3 |
|
|||
31 | if is_not_python2: |
|
|||
32 |
|
30 | |||
33 |
|
|
31 | def _sys2bytes(p): | |
34 |
|
|
32 | if p is None: | |
35 |
|
|
33 | return p | |
36 |
|
|
34 | return p.encode('utf-8') | |
37 |
|
35 | |||
|
36 | ||||
38 |
|
|
37 | def _bytes2sys(p): | |
39 |
|
|
38 | if p is None: | |
40 |
|
|
39 | return p | |
41 |
|
|
40 | return p.decode('utf-8') | |
42 |
|
41 | |||
43 |
|
42 | |||
44 | else: |
|
|||
45 |
|
||||
46 | def _sys2bytes(p): |
|
|||
47 | return p |
|
|||
48 |
|
||||
49 | _bytes2sys = _sys2bytes |
|
|||
50 |
|
||||
51 |
|
||||
52 | def check(name, desc): |
|
43 | def check(name, desc): | |
53 | """Registers a check function for a feature.""" |
|
44 | """Registers a check function for a feature.""" | |
54 |
|
45 | |||
@@ -168,8 +159,6 b' def has_baz():' | |||||
168 |
|
159 | |||
169 | @check("bzr", "Breezy library and executable version >= 3.1") |
|
160 | @check("bzr", "Breezy library and executable version >= 3.1") | |
170 | def has_bzr(): |
|
161 | def has_bzr(): | |
171 | if not is_not_python2: |
|
|||
172 | return False |
|
|||
173 | try: |
|
162 | try: | |
174 | # Test the Breezy python lib |
|
163 | # Test the Breezy python lib | |
175 | import breezy |
|
164 | import breezy | |
@@ -877,9 +866,9 b' def has_demandimport():' | |||||
877 | return (not has_chg()) and os.environ.get('HGDEMANDIMPORT') != 'disable' |
|
866 | return (not has_chg()) and os.environ.get('HGDEMANDIMPORT') != 'disable' | |
878 |
|
867 | |||
879 |
|
868 | |||
880 |
# Add "py |
|
869 | # Add "py36", "py37", ... as possible feature checks. Note that there's no | |
881 | # punctuation here. |
|
870 | # punctuation here. | |
882 |
@checkvers("py", "Python >= %s", ( |
|
871 | @checkvers("py", "Python >= %s", (3.6, 3.7, 3.8, 3.9, 3.10, 3.11)) | |
883 | def has_python_range(v): |
|
872 | def has_python_range(v): | |
884 | major, minor = v.split('.')[0:2] |
|
873 | major, minor = v.split('.')[0:2] | |
885 | py_major, py_minor = sys.version_info.major, sys.version_info.minor |
|
874 | py_major, py_minor = sys.version_info.major, sys.version_info.minor | |
@@ -897,7 +886,7 b' def has_python3exe():' | |||||
897 | py = 'python3' |
|
886 | py = 'python3' | |
898 | if os.name == 'nt': |
|
887 | if os.name == 'nt': | |
899 | py = 'py -3' |
|
888 | py = 'py -3' | |
900 |
return matchoutput('%s -V' % py, br'^Python 3.( |
|
889 | return matchoutput('%s -V' % py, br'^Python 3.(6|7|8|9|10|11)') | |
901 |
|
890 | |||
902 |
|
891 | |||
903 | @check("pure", "running with pure Python code") |
|
892 | @check("pure", "running with pure Python code") |
General Comments 0
You need to be logged in to leave comments.
Login now