1
+ # -*- coding: utf-8 -*-
1
2
"""An API to load config from a readthedocs.yml file."""
2
- from __future__ import absolute_import
3
3
4
- from builtins import (filter , object )
4
+ from __future__ import (
5
+ absolute_import , division , print_function , unicode_literals )
5
6
6
- from readthedocs_build .config import (ConfigError , BuildConfig , InvalidConfig ,
7
- load as load_config )
8
- from .constants import BUILD_IMAGES , DOCKER_IMAGE
7
+ from builtins import filter , object
8
+ from readthedocs_build .config import load as load_config
9
+ from readthedocs_build .config import BuildConfig , ConfigError , InvalidConfig
10
+
11
+ from .constants import DOCKER_BUILD_IMAGES , DOCKER_IMAGE
9
12
10
13
11
14
class ConfigWrapper (object ):
@@ -18,7 +21,6 @@ class ConfigWrapper(object):
18
21
We only currently implement a subset of the existing YAML config.
19
22
This should be the canonical source for our usage of the YAML files,
20
23
never accessing the config object directly.
21
-
22
24
"""
23
25
24
26
def __init__ (self , version , yaml_config ):
@@ -53,10 +55,12 @@ def python_interpreter(self):
53
55
if ver in [2 , 3 ]:
54
56
# Get the highest version of the major series version if user only
55
57
# gave us a version of '2', or '3'
56
- ver = max (list (filter (
57
- lambda x : x < ver + 1 ,
58
- self ._yaml_config .get_valid_python_versions (),
59
- )))
58
+ ver = max (
59
+ list (
60
+ filter (
61
+ lambda x : x < ver + 1 ,
62
+ self ._yaml_config .get_valid_python_versions (),
63
+ )))
60
64
return 'python{0}' .format (ver )
61
65
62
66
@property
@@ -118,18 +122,18 @@ def load_yaml_config(version):
118
122
"""
119
123
Load a configuration from `readthedocs.yml` file.
120
124
121
- This uses the configuration logic from `readthedocs-build`,
122
- which will keep parsing consistent between projects.
125
+ This uses the configuration logic from `readthedocs-build`, which will keep
126
+ parsing consistent between projects.
123
127
"""
124
128
checkout_path = version .project .checkout_path (version .slug )
125
129
env_config = {}
126
130
127
131
# Get build image to set up the python version validation. Pass in the
128
132
# build image python limitations to the loaded config so that the versions
129
133
# can be rejected at validation
130
- build_image = BUILD_IMAGES .get (
134
+ build_image = DOCKER_BUILD_IMAGES .get (
131
135
version .project .container_image ,
132
- BUILD_IMAGES .get (DOCKER_IMAGE , None ),
136
+ DOCKER_BUILD_IMAGES .get (DOCKER_IMAGE , None ),
133
137
)
134
138
if build_image :
135
139
env_config = {
@@ -147,7 +151,8 @@ def load_yaml_config(version):
147
151
path = checkout_path ,
148
152
env_config = sphinx_env_config ,
149
153
)[0 ]
150
- except InvalidConfig : # This is a subclass of ConfigError, so has to come first
154
+ except InvalidConfig :
155
+ # This is a subclass of ConfigError, so has to come first
151
156
raise
152
157
except ConfigError :
153
158
config = BuildConfig (
0 commit comments