|
| 1 | +# -*- coding: utf-8 -*- |
1 | 2 | # pylint: disable=too-many-lines
|
2 | 3 |
|
3 | 4 | """Build configuration for rtd."""
|
|
36 | 37 | validate_string,
|
37 | 38 | )
|
38 | 39 |
|
39 |
| - |
40 | 40 | __all__ = (
|
41 | 41 | 'ALL',
|
42 | 42 | 'load',
|
|
64 | 64 | INVALID_KEYS_COMBINATION = 'invalid-keys-combination'
|
65 | 65 | INVALID_KEY = 'invalid-key'
|
66 | 66 |
|
67 |
| -DOCKER_DEFAULT_IMAGE = getattr(settings, 'DOCKER_DEFAULT_IMAGE', 'readthedocs/build') |
| 67 | +DOCKER_DEFAULT_IMAGE = getattr( |
| 68 | + settings, 'DOCKER_DEFAULT_IMAGE', 'readthedocs/build' |
| 69 | +) |
68 | 70 | DOCKER_DEFAULT_VERSION = getattr(settings, 'DOCKER_DEFAULT_VERSION', '2.0')
|
69 | 71 | # These map to corresponding settings in the .org,
|
70 | 72 | # so they haven't been renamed.
|
71 | 73 | DOCKER_IMAGE = getattr(
|
72 | 74 | settings,
|
73 | 75 | 'DOCKER_IMAGE',
|
74 |
| - '{}:{}'.format(DOCKER_DEFAULT_IMAGE, DOCKER_DEFAULT_VERSION) |
| 76 | + '{}:{}'.format(DOCKER_DEFAULT_IMAGE, DOCKER_DEFAULT_VERSION), |
75 | 77 | )
|
76 | 78 | DOCKER_IMAGE_SETTINGS = getattr(settings, 'DOCKER_IMAGE_SETTINGS', {})
|
77 | 79 |
|
@@ -243,9 +245,7 @@ def python_full_version(self):
|
243 | 245 | # Get the highest version of the major series version if user only
|
244 | 246 | # gave us a version of '2', or '3'
|
245 | 247 | ver = max(
|
246 |
| - v |
247 |
| - for v in self.get_valid_python_versions() |
248 |
| - if v < ver + 1 |
| 248 | + v for v in self.get_valid_python_versions() if v < ver + 1 |
249 | 249 | )
|
250 | 250 | return ver
|
251 | 251 |
|
@@ -275,7 +275,6 @@ def get_valid_python_versions_for_image(self, build_image):
|
275 | 275 | Returns supported versions for the ``DOCKER_DEFAULT_VERSION`` if not
|
276 | 276 | ``build_image`` found.
|
277 | 277 | """
|
278 |
| - |
279 | 278 | if build_image not in DOCKER_IMAGE_SETTINGS:
|
280 | 279 | build_image = '{}:{}'.format(
|
281 | 280 | DOCKER_DEFAULT_IMAGE,
|
@@ -320,7 +319,9 @@ def get_valid_python_versions(self):
|
320 | 319 | except (KeyError, TypeError):
|
321 | 320 | versions = set()
|
322 | 321 | for _, options in DOCKER_IMAGE_SETTINGS.items():
|
323 |
| - versions = versions.union(options['python']['supported_versions']) |
| 322 | + versions = versions.union( |
| 323 | + options['python']['supported_versions'] |
| 324 | + ) |
324 | 325 | return versions
|
325 | 326 |
|
326 | 327 | def get_valid_formats(self): # noqa
|
@@ -510,7 +511,8 @@ def validate_requirements_file(self):
|
510 | 511 | return None
|
511 | 512 | with self.catch_validation_error('requirements_file'):
|
512 | 513 | requirements_file = validate_file(
|
513 |
| - requirements_file, self.base_path |
| 514 | + requirements_file, |
| 515 | + self.base_path, |
514 | 516 | )
|
515 | 517 | return requirements_file
|
516 | 518 |
|
@@ -546,23 +548,23 @@ def python(self):
|
546 | 548 | python_install.append(
|
547 | 549 | PythonInstallRequirements(
|
548 | 550 | requirements=requirements,
|
549 |
| - ) |
| 551 | + ), |
550 | 552 | )
|
551 | 553 | if python['install_with_pip']:
|
552 | 554 | python_install.append(
|
553 | 555 | PythonInstall(
|
554 | 556 | path=self.base_path,
|
555 | 557 | method=PIP,
|
556 | 558 | extra_requirements=python['extra_requirements'],
|
557 |
| - ) |
| 559 | + ), |
558 | 560 | )
|
559 | 561 | elif python['install_with_setup']:
|
560 | 562 | python_install.append(
|
561 | 563 | PythonInstall(
|
562 | 564 | path=self.base_path,
|
563 | 565 | method=SETUPTOOLS,
|
564 | 566 | extra_requirements=[],
|
565 |
| - ) |
| 567 | + ), |
566 | 568 | )
|
567 | 569 |
|
568 | 570 | return Python(
|
@@ -785,30 +787,30 @@ def validate_python_install(self, index):
|
785 | 787 | with self.catch_validation_error(requirements_key):
|
786 | 788 | requirements = validate_file(
|
787 | 789 | self.pop_config(requirements_key),
|
788 |
| - self.base_path |
| 790 | + self.base_path, |
789 | 791 | )
|
790 | 792 | python_install['requirements'] = requirements
|
791 | 793 | elif 'path' in raw_install:
|
792 | 794 | path_key = key + '.path'
|
793 | 795 | with self.catch_validation_error(path_key):
|
794 | 796 | path = validate_directory(
|
795 | 797 | self.pop_config(path_key),
|
796 |
| - self.base_path |
| 798 | + self.base_path, |
797 | 799 | )
|
798 | 800 | python_install['path'] = path
|
799 | 801 |
|
800 | 802 | method_key = key + '.method'
|
801 | 803 | with self.catch_validation_error(method_key):
|
802 | 804 | method = validate_choice(
|
803 | 805 | self.pop_config(method_key, PIP),
|
804 |
| - self.valid_install_method |
| 806 | + self.valid_install_method, |
805 | 807 | )
|
806 | 808 | python_install['method'] = method
|
807 | 809 |
|
808 | 810 | extra_req_key = key + '.extra_requirements'
|
809 | 811 | with self.catch_validation_error(extra_req_key):
|
810 | 812 | extra_requirements = validate_list(
|
811 |
| - self.pop_config(extra_req_key, []) |
| 813 | + self.pop_config(extra_req_key, []), |
812 | 814 | )
|
813 | 815 | if extra_requirements and python_install['method'] != PIP:
|
814 | 816 | self.error(
|
@@ -1060,13 +1062,9 @@ def python(self):
|
1060 | 1062 | python = self._config['python']
|
1061 | 1063 | for install in python['install']:
|
1062 | 1064 | if 'requirements' in install:
|
1063 |
| - python_install.append( |
1064 |
| - PythonInstallRequirements(**install) |
1065 |
| - ) |
| 1065 | + python_install.append(PythonInstallRequirements(**install),) |
1066 | 1066 | elif 'path' in install:
|
1067 |
| - python_install.append( |
1068 |
| - PythonInstall(**install) |
1069 |
| - ) |
| 1067 | + python_install.append(PythonInstall(**install),) |
1070 | 1068 | return Python(
|
1071 | 1069 | version=python['version'],
|
1072 | 1070 | install=python_install,
|
|
0 commit comments