Skip to content

Install latest version of setuptools #7290

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 7 commits into from
Jan 21, 2021
Merged
Show file tree
Hide file tree
Changes from 5 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
10 changes: 7 additions & 3 deletions readthedocs/doc_builder/python_environments.py
Original file line number Diff line number Diff line change
Expand Up @@ -337,21 +337,25 @@ def install_core_requirements(self):
*self._pip_cache_cmd_argument(),
]

# Install latest pip first,
# Install latest pip and setuptools first,
# so it is used when installing the other requirements.
pip_version = self.project.get_feature_value(
Feature.DONT_INSTALL_LATEST_PIP,
# 20.3 uses the new resolver by default.
positive='pip<20.3',
negative='pip',
)
cmd = pip_install_cmd + [pip_version]
setuptools_version = self.project.get_feature_value(
Feature.INSTALL_LATEST_SETUPTOOLS,
positive='setuptools',
negative='setuptools==41.0.1',
)
cmd = pip_install_cmd + [pip_version, setuptools_version]
self.build_env.run(
*cmd, bin_path=self.venv_bin(), cwd=self.checkout_path
)
Comment on lines +353 to 356
Copy link
Member

Choose a reason for hiding this comment

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

We are changing where we install setuptools here.

Now we are installing it together with pip as the first command we executed. Before, we were installing it together with our own dependencies. I don't think this is something bad, but definitely a change that may break in a random way 🙃

It makes sense to be installed with pip to me; but we should keep an eye on this.


requirements = [
'setuptools==41.0.1',
self.project.get_feature_value(
Feature.DONT_INSTALL_DOCUTILS,
positive='',
Expand Down
61 changes: 35 additions & 26 deletions readthedocs/projects/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -1563,17 +1563,13 @@ def add_features(sender, **kwargs):

# Feature constants - this is not a exhaustive list of features, features
# may be added by other packages
USE_SPHINX_LATEST = 'use_sphinx_latest'
DONT_INSTALL_DOCUTILS = 'dont_install_docutils'
ALLOW_DEPRECATED_WEBHOOKS = 'allow_deprecated_webhooks'
PIP_ALWAYS_UPGRADE = 'pip_always_upgrade'
DONT_OVERWRITE_SPHINX_CONTEXT = 'dont_overwrite_sphinx_context'
MKDOCS_THEME_RTD = 'mkdocs_theme_rtd'
API_LARGE_DATA = 'api_large_data'
DONT_SHALLOW_CLONE = 'dont_shallow_clone'
USE_TESTING_BUILD_IMAGE = 'use_testing_build_image'
SHARE_SPHINX_DOCTREE = 'share_sphinx_doctree'
DEFAULT_TO_MKDOCS_0_17_3 = 'default_to_mkdocs_0_17_3'
CLEAN_AFTER_BUILD = 'clean_after_build'
EXTERNAL_VERSION_BUILD = 'external_version_build'
UPDATE_CONDA_STARTUP = 'update_conda_startup'
Expand All @@ -1589,6 +1585,16 @@ def add_features(sender, **kwargs):
SKIP_SYNC_VERSIONS = 'skip_sync_versions'
SYNC_VERSIONS_USING_A_TASK = 'sync_versions_using_a_task'

# Dependecies related features
PIP_ALWAYS_UPGRADE = 'pip_always_upgrade'
USE_NEW_PIP_RESOLVER = 'use_new_pip_resolver'
DONT_INSTALL_LATEST_PIP = 'dont_install_latest_pip'
USE_SPHINX_LATEST = 'use_sphinx_latest'
DONT_INSTALL_DOCUTILS = 'dont_install_docutils'
DEFAULT_TO_MKDOCS_0_17_3 = 'default_to_mkdocs_0_17_3'
USE_SPHINX_RTD_EXT_LATEST = 'rtd_sphinx_ext_latest'
INSTALL_LATEST_SETUPTOOLS = 'install_latest_setuptoold'

# Search related features
DISABLE_SERVER_SIDE_SEARCH = 'disable_server_side_search'
ENABLE_MKDOCS_SERVER_SIDE_SEARCH = 'enable_mkdocs_server_side_search'
Expand All @@ -1603,20 +1609,10 @@ def add_features(sender, **kwargs):
SPHINX_PARALLEL = 'sphinx_parallel'
USE_SPHINX_BUILDERS = 'use_sphinx_builders'
DEDUPLICATE_BUILDS = 'deduplicate_builds'
USE_SPHINX_RTD_EXT_LATEST = 'rtd_sphinx_ext_latest'
DONT_CREATE_INDEX = 'dont_create_index'
DONT_INSTALL_LATEST_PIP = 'dont_install_latest_pip'

FEATURES = (
(USE_SPHINX_LATEST, _('Use latest version of Sphinx')),
(
DONT_INSTALL_DOCUTILS,
_(
'Do not install docutils as requirement for build documentation',
),
),
(ALLOW_DEPRECATED_WEBHOOKS, _('Allow deprecated webhook views')),
(PIP_ALWAYS_UPGRADE, _('Always run pip install --upgrade')),
(
DONT_OVERWRITE_SPHINX_CONTEXT,
_(
Expand All @@ -1643,10 +1639,6 @@ def add_features(sender, **kwargs):
SHARE_SPHINX_DOCTREE,
_('Use shared directory for doctrees'),
),
(
DEFAULT_TO_MKDOCS_0_17_3,
_('Install mkdocs 0.17.3 by default'),
),
(
CLEAN_AFTER_BUILD,
_('Clean all files used in the build process'),
Expand Down Expand Up @@ -1701,6 +1693,31 @@ def add_features(sender, **kwargs):
_('Sync versions using a task instead of the API'),
),

# Dependecies related features
(PIP_ALWAYS_UPGRADE, _('Always run pip install --upgrade')),
(USE_NEW_PIP_RESOLVER, _('Use new pip resolver')),
(
DONT_INSTALL_LATEST_PIP,
_('Don\'t install the latest version of pip'),
),
(USE_SPHINX_LATEST, _('Use latest version of Sphinx')),
(
DONT_INSTALL_DOCUTILS,
_('Do not install docutils as requirement for build documentation'),
),
(
DEFAULT_TO_MKDOCS_0_17_3,
_('Install mkdocs 0.17.3 by default'),
),
(
USE_SPHINX_RTD_EXT_LATEST,
_('Use latest version of the Read the Docs Sphinx extension'),
),
(
INSTALL_LATEST_SETUPTOOLS,
_('Install latest version of setuptools'),
),

# Search related features.
(
DISABLE_SERVER_SIDE_SEARCH,
Expand Down Expand Up @@ -1757,18 +1774,10 @@ def add_features(sender, **kwargs):
DEDUPLICATE_BUILDS,
_('Mark duplicated builds as NOOP to be skipped by builders'),
),
(
USE_SPHINX_RTD_EXT_LATEST,
_('Use latest version of the Read the Docs Sphinx extension'),
),
(
DONT_CREATE_INDEX,
_('Do not create index.md or README.rst if the project does not have one.'),
),
(
DONT_INSTALL_LATEST_PIP,
_('Don\'t install the latest version of pip'),
),
)

projects = models.ManyToManyField(
Expand Down
2 changes: 0 additions & 2 deletions readthedocs/rtd_tests/tests/test_doc_building.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
"""
Things to know:

Expand Down Expand Up @@ -1192,7 +1191,6 @@ def setUp(self):
self.build_env_mock = Mock()

self.base_requirements = [
'setuptools',
'docutils',
'mock',
'pillow',
Expand Down