Skip to content

Commit 2fb9eae

Browse files
authored
Support Docker 5.0 image (#5657)
Support Docker 5.0 image
2 parents edf2e60 + 1513a5f commit 2fb9eae

File tree

4 files changed

+34
-17
lines changed

4 files changed

+34
-17
lines changed

readthedocs/config/config.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,11 @@ def validate(self):
239239
@property
240240
def python_interpreter(self):
241241
ver = self.python_full_version
242-
return 'python{}'.format(ver)
242+
if not ver or isinstance(ver, (int, float)):
243+
return 'python{}'.format(ver)
244+
245+
# Allow to specify ``pypy3.5`` as Python interpreter
246+
return ver
243247

244248
@property
245249
def python_full_version(self):
@@ -248,7 +252,8 @@ def python_full_version(self):
248252
# Get the highest version of the major series version if user only
249253
# gave us a version of '2', or '3'
250254
ver = max(
251-
v for v in self.get_valid_python_versions() if v < ver + 1
255+
v for v in self.get_valid_python_versions()
256+
if not isinstance(v, str) and v < ver + 1
252257
)
253258
return ver
254259

readthedocs/config/tests/test_config.py

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -348,12 +348,21 @@ def test_it_defaults_to_a_valid_version(self):
348348

349349
def test_it_supports_other_versions(self):
350350
build = get_build_config(
351-
{'python': {'version': 3.5}},
351+
{'python': {'version': 3.7}},
352352
)
353353
build.validate()
354-
assert build.python.version == 3.5
355-
assert build.python_interpreter == 'python3.5'
356-
assert build.python_full_version == 3.5
354+
assert build.python.version == 3.7
355+
assert build.python_interpreter == 'python3.7'
356+
assert build.python_full_version == 3.7
357+
358+
def test_it_supports_string_versions(self):
359+
build = get_build_config(
360+
{'python': {'version': 'pypy3.5'}},
361+
)
362+
build.validate()
363+
assert build.python.version == 'pypy3.5'
364+
assert build.python_interpreter == 'pypy3.5'
365+
assert build.python_full_version == 'pypy3.5'
357366

358367
def test_it_validates_versions_out_of_range(self):
359368
build = get_build_config(
@@ -375,12 +384,12 @@ def test_it_validates_wrong_type(self):
375384

376385
def test_it_validates_wrong_type_right_value(self):
377386
build = get_build_config(
378-
{'python': {'version': '3.5'}},
387+
{'python': {'version': '3.6'}},
379388
)
380389
build.validate()
381-
assert build.python.version == 3.5
382-
assert build.python_interpreter == 'python3.5'
383-
assert build.python_full_version == 3.5
390+
assert build.python.version == 3.6
391+
assert build.python_interpreter == 'python3.6'
392+
assert build.python_full_version == 3.6
384393

385394
build = get_build_config(
386395
{'python': {'version': '3'}},
@@ -716,7 +725,7 @@ def test_as_dict(tmpdir):
716725
'version': 1,
717726
'formats': ['pdf'],
718727
'python': {
719-
'version': 3.5,
728+
'version': 3.7,
720729
},
721730
'requirements_file': 'requirements.txt',
722731
},
@@ -733,7 +742,7 @@ def test_as_dict(tmpdir):
733742
'version': '1',
734743
'formats': ['pdf'],
735744
'python': {
736-
'version': 3.5,
745+
'version': 3.7,
737746
'install': [{
738747
'requirements': str(tmpdir.join('requirements.txt')),
739748
}],
@@ -944,8 +953,8 @@ def test_python_check_invalid_types(self, value):
944953
@pytest.mark.parametrize(
945954
'image,versions',
946955
[
947-
('latest', [2, 2.7, 3, 3.5, 3.6]),
948-
('stable', [2, 2.7, 3, 3.5, 3.6]),
956+
('latest', [2, 2.7, 3, 3.5, 3.6, 3.7, 'pypy3.5']),
957+
('stable', [2, 2.7, 3, 3.5, 3.6, 3.7]),
949958
],
950959
)
951960
def test_python_version(self, image, versions):

readthedocs/rtd_tests/tests/test_config_integration.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ def test_python_supported_versions_image_latest(self, load_config):
144144
config = load_yaml_config(self.version)
145145
self.assertEqual(
146146
config.get_valid_python_versions(),
147-
[2, 2.7, 3, 3.5, 3.6, 3.7],
147+
[2, 2.7, 3, 3.5, 3.6, 3.7, 'pypy3.5'],
148148
)
149149

150150
@mock.patch('readthedocs.doc_builder.config.load_config')

readthedocs/settings/base.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -357,12 +357,15 @@ def USE_PROMOS(self): # noqa
357357
'readthedocs/build:4.0': {
358358
'python': {'supported_versions': [2, 2.7, 3, 3.5, 3.6, 3.7]},
359359
},
360+
'readthedocs/build:5.0': {
361+
'python': {'supported_versions': [2, 2.7, 3, 3.5, 3.6, 3.7, 'pypy3.5']},
362+
},
360363
}
361364

362365
# Alias tagged via ``docker tag`` on the build servers
363366
DOCKER_IMAGE_SETTINGS.update({
364-
'readthedocs/build:stable': DOCKER_IMAGE_SETTINGS.get('readthedocs/build:3.0'),
365-
'readthedocs/build:latest': DOCKER_IMAGE_SETTINGS.get('readthedocs/build:4.0'),
367+
'readthedocs/build:stable': DOCKER_IMAGE_SETTINGS.get('readthedocs/build:4.0'),
368+
'readthedocs/build:latest': DOCKER_IMAGE_SETTINGS.get('readthedocs/build:5.0'),
366369
})
367370

368371
# All auth

0 commit comments

Comments
 (0)