Skip to content

Support Docker 5.0 image #5657

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 20, 2019
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions readthedocs/config/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,11 @@ def validate(self):
@property
def python_interpreter(self):
ver = self.python_full_version
return 'python{}'.format(ver)
if not ver or isinstance(ver, (int, float)):
return 'python{}'.format(ver)

# Allow to specify ``pypy3.5`` as Python interpreter
return ver
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a note that we can do this better later #4343


@property
def python_full_version(self):
Expand All @@ -254,7 +258,8 @@ def python_full_version(self):
# Get the highest version of the major series version if user only
# gave us a version of '2', or '3'
ver = max(
v for v in self.get_valid_python_versions() if v < ver + 1
v for v in self.get_valid_python_versions()
if not isinstance(v, str) and v < ver + 1
)
return ver

Expand Down
33 changes: 21 additions & 12 deletions readthedocs/config/tests/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -348,12 +348,21 @@ def test_it_defaults_to_a_valid_version(self):

def test_it_supports_other_versions(self):
build = get_build_config(
{'python': {'version': 3.5}},
{'python': {'version': 3.7}},
)
build.validate()
assert build.python.version == 3.5
assert build.python_interpreter == 'python3.5'
assert build.python_full_version == 3.5
assert build.python.version == 3.7
assert build.python_interpreter == 'python3.7'
assert build.python_full_version == 3.7

def test_it_supports_string_versions(self):
build = get_build_config(
{'python': {'version': 'pypy3.5'}},
)
build.validate()
assert build.python.version == 'pypy3.5'
assert build.python_interpreter == 'pypy3.5'
assert build.python_full_version == 'pypy3.5'

def test_it_validates_versions_out_of_range(self):
build = get_build_config(
Expand All @@ -375,12 +384,12 @@ def test_it_validates_wrong_type(self):

def test_it_validates_wrong_type_right_value(self):
build = get_build_config(
{'python': {'version': '3.5'}},
{'python': {'version': '3.6'}},
)
build.validate()
assert build.python.version == 3.5
assert build.python_interpreter == 'python3.5'
assert build.python_full_version == 3.5
assert build.python.version == 3.6
assert build.python_interpreter == 'python3.6'
assert build.python_full_version == 3.6

build = get_build_config(
{'python': {'version': '3'}},
Expand Down Expand Up @@ -716,7 +725,7 @@ def test_as_dict(tmpdir):
'version': 1,
'formats': ['pdf'],
'python': {
'version': 3.5,
'version': 3.7,
},
'requirements_file': 'requirements.txt',
},
Expand All @@ -733,7 +742,7 @@ def test_as_dict(tmpdir):
'version': '1',
'formats': ['pdf'],
'python': {
'version': 3.5,
'version': 3.7,
'install': [{
'requirements': str(tmpdir.join('requirements.txt')),
}],
Expand Down Expand Up @@ -944,8 +953,8 @@ def test_python_check_invalid_types(self, value):
@pytest.mark.parametrize(
'image,versions',
[
('latest', [2, 2.7, 3, 3.5, 3.6]),
('stable', [2, 2.7, 3, 3.5, 3.6]),
('latest', [2, 2.7, 3, 3.6, 3.7, 'pypy3.5']),
('stable', [2, 2.7, 3, 3.6, 3.7]),
],
)
def test_python_version(self, image, versions):
Expand Down
2 changes: 1 addition & 1 deletion readthedocs/rtd_tests/tests/test_config_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ def test_python_supported_versions_image_latest(self, load_config):
config = load_yaml_config(self.version)
self.assertEqual(
config.get_valid_python_versions(),
[2, 2.7, 3, 3.5, 3.6, 3.7],
[2, 2.7, 3, 3.6, 3.7, 'pypy3.5'],
)

@mock.patch('readthedocs.doc_builder.config.load_config')
Expand Down
7 changes: 5 additions & 2 deletions readthedocs/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -329,12 +329,15 @@ def USE_PROMOS(self): # noqa
'readthedocs/build:4.0': {
'python': {'supported_versions': [2, 2.7, 3, 3.5, 3.6, 3.7]},
},
'readthedocs/build:5.0': {
'python': {'supported_versions': [2, 2.7, 3, 3.6, 3.7, 'pypy3.5']},
},
}

# Alias tagged via ``docker tag`` on the build servers
DOCKER_IMAGE_SETTINGS.update({
'readthedocs/build:stable': DOCKER_IMAGE_SETTINGS.get('readthedocs/build:3.0'),
'readthedocs/build:latest': DOCKER_IMAGE_SETTINGS.get('readthedocs/build:4.0'),
'readthedocs/build:stable': DOCKER_IMAGE_SETTINGS.get('readthedocs/build:4.0'),
'readthedocs/build:latest': DOCKER_IMAGE_SETTINGS.get('readthedocs/build:5.0'),
})

# All auth
Expand Down