Skip to content

Commit 236bf6a

Browse files
committed
Use feature flag
1 parent c56c889 commit 236bf6a

File tree

3 files changed

+41
-37
lines changed

3 files changed

+41
-37
lines changed

readthedocs/doc_builder/python_environments.py

+6-3
Original file line numberDiff line numberDiff line change
@@ -352,14 +352,17 @@ def install_core_requirements(self):
352352
positive='pip<20.3',
353353
negative='pip',
354354
)
355-
cmd = pip_install_cmd + [pip_version]
355+
setuptools_version = self.project.get_feature_value(
356+
Feature.INSTALL_LATEST_SETUPTOOLS,
357+
positive='setuptools',
358+
negative='setuptools==41.0.1',
359+
)
360+
cmd = pip_install_cmd + [pip_version, setuptools_version]
356361
self.build_env.run(
357362
*cmd, bin_path=self.venv_bin(), cwd=self.checkout_path
358363
)
359364

360365
requirements = [
361-
'Pygments==2.3.1',
362-
'setuptools==41.0.1',
363366
self.project.get_feature_value(
364367
Feature.DONT_INSTALL_DOCUTILS,
365368
positive='',

readthedocs/projects/models.py

+35-31
Original file line numberDiff line numberDiff line change
@@ -1547,17 +1547,13 @@ def add_features(sender, **kwargs):
15471547

15481548
# Feature constants - this is not a exhaustive list of features, features
15491549
# may be added by other packages
1550-
USE_SPHINX_LATEST = 'use_sphinx_latest'
1551-
DONT_INSTALL_DOCUTILS = 'dont_install_docutils'
15521550
ALLOW_DEPRECATED_WEBHOOKS = 'allow_deprecated_webhooks'
1553-
PIP_ALWAYS_UPGRADE = 'pip_always_upgrade'
15541551
DONT_OVERWRITE_SPHINX_CONTEXT = 'dont_overwrite_sphinx_context'
15551552
MKDOCS_THEME_RTD = 'mkdocs_theme_rtd'
15561553
API_LARGE_DATA = 'api_large_data'
15571554
DONT_SHALLOW_CLONE = 'dont_shallow_clone'
15581555
USE_TESTING_BUILD_IMAGE = 'use_testing_build_image'
15591556
SHARE_SPHINX_DOCTREE = 'share_sphinx_doctree'
1560-
DEFAULT_TO_MKDOCS_0_17_3 = 'default_to_mkdocs_0_17_3'
15611557
CLEAN_AFTER_BUILD = 'clean_after_build'
15621558
EXTERNAL_VERSION_BUILD = 'external_version_build'
15631559
UPDATE_CONDA_STARTUP = 'update_conda_startup'
@@ -1569,6 +1565,16 @@ def add_features(sender, **kwargs):
15691565
CACHED_ENVIRONMENT = 'cached_environment'
15701566
LIMIT_CONCURRENT_BUILDS = 'limit_concurrent_builds'
15711567

1568+
# Dependecies related features
1569+
PIP_ALWAYS_UPGRADE = 'pip_always_upgrade'
1570+
USE_NEW_PIP_RESOLVER = 'use_new_pip_resolver'
1571+
DONT_INSTALL_LATEST_PIP = 'dont_install_latest_pip'
1572+
USE_SPHINX_LATEST = 'use_sphinx_latest'
1573+
DONT_INSTALL_DOCUTILS = 'dont_install_docutils'
1574+
DEFAULT_TO_MKDOCS_0_17_3 = 'default_to_mkdocs_0_17_3'
1575+
USE_SPHINX_RTD_EXT_LATEST = 'rtd_sphinx_ext_latest'
1576+
INSTALL_LATEST_SETUPTOOLS = 'install_latest_setuptoold'
1577+
15721578
# Search related features
15731579
DISABLE_SERVER_SIDE_SEARCH = 'disable_server_side_search'
15741580
ENABLE_MKDOCS_SERVER_SIDE_SEARCH = 'enable_mkdocs_server_side_search'
@@ -1583,21 +1589,10 @@ def add_features(sender, **kwargs):
15831589
SPHINX_PARALLEL = 'sphinx_parallel'
15841590
USE_SPHINX_BUILDERS = 'use_sphinx_builders'
15851591
DEDUPLICATE_BUILDS = 'deduplicate_builds'
1586-
USE_SPHINX_RTD_EXT_LATEST = 'rtd_sphinx_ext_latest'
15871592
DONT_CREATE_INDEX = 'dont_create_index'
1588-
USE_NEW_PIP_RESOLVER = 'use_new_pip_resolver'
1589-
DONT_INSTALL_LATEST_PIP = 'dont_install_latest_pip'
15901593

15911594
FEATURES = (
1592-
(USE_SPHINX_LATEST, _('Use latest version of Sphinx')),
1593-
(
1594-
DONT_INSTALL_DOCUTILS,
1595-
_(
1596-
'Do not install docutils as requirement for build documentation',
1597-
),
1598-
),
15991595
(ALLOW_DEPRECATED_WEBHOOKS, _('Allow deprecated webhook views')),
1600-
(PIP_ALWAYS_UPGRADE, _('Always run pip install --upgrade')),
16011596
(
16021597
DONT_OVERWRITE_SPHINX_CONTEXT,
16031598
_(
@@ -1624,10 +1619,6 @@ def add_features(sender, **kwargs):
16241619
SHARE_SPHINX_DOCTREE,
16251620
_('Use shared directory for doctrees'),
16261621
),
1627-
(
1628-
DEFAULT_TO_MKDOCS_0_17_3,
1629-
_('Install mkdocs 0.17.3 by default'),
1630-
),
16311622
(
16321623
CLEAN_AFTER_BUILD,
16331624
_('Clean all files used in the build process'),
@@ -1672,6 +1663,31 @@ def add_features(sender, **kwargs):
16721663
_('Limit the amount of concurrent builds'),
16731664
),
16741665

1666+
# Dependecies related features
1667+
(PIP_ALWAYS_UPGRADE, _('Always run pip install --upgrade')),
1668+
(USE_NEW_PIP_RESOLVER, _('Use new pip resolver')),
1669+
(
1670+
DONT_INSTALL_LATEST_PIP,
1671+
_('Don\'t install the latest version of pip'),
1672+
),
1673+
(USE_SPHINX_LATEST, _('Use latest version of Sphinx')),
1674+
(
1675+
DONT_INSTALL_DOCUTILS,
1676+
_('Do not install docutils as requirement for build documentation'),
1677+
),
1678+
(
1679+
DEFAULT_TO_MKDOCS_0_17_3,
1680+
_('Install mkdocs 0.17.3 by default'),
1681+
),
1682+
(
1683+
USE_SPHINX_RTD_EXT_LATEST,
1684+
_('Use latest version of the Read the Docs Sphinx extension'),
1685+
),
1686+
(
1687+
INSTALL_LATEST_SETUPTOOLS,
1688+
_('Install latest version of setuptools'),
1689+
),
1690+
16751691
# Search related features.
16761692
(
16771693
DISABLE_SERVER_SIDE_SEARCH,
@@ -1728,22 +1744,10 @@ def add_features(sender, **kwargs):
17281744
DEDUPLICATE_BUILDS,
17291745
_('Mark duplicated builds as NOOP to be skipped by builders'),
17301746
),
1731-
(
1732-
USE_SPHINX_RTD_EXT_LATEST,
1733-
_('Use latest version of the Read the Docs Sphinx extension'),
1734-
),
17351747
(
17361748
DONT_CREATE_INDEX,
17371749
_('Do not create index.md or README.rst if the project does not have one.'),
17381750
),
1739-
(
1740-
USE_NEW_PIP_RESOLVER,
1741-
_('Use new pip resolver'),
1742-
),
1743-
(
1744-
DONT_INSTALL_LATEST_PIP,
1745-
_('Don\'t install the latest version of pip'),
1746-
),
17471751
)
17481752

17491753
projects = models.ManyToManyField(

readthedocs/rtd_tests/tests/test_doc_building.py

-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# -*- coding: utf-8 -*-
21
"""
32
Things to know:
43
@@ -1192,8 +1191,6 @@ def setUp(self):
11921191
self.build_env_mock = Mock()
11931192

11941193
self.base_requirements = [
1195-
'Pygments',
1196-
'setuptools',
11971194
'docutils',
11981195
'mock',
11991196
'pillow',

0 commit comments

Comments
 (0)