Skip to content

Build: remove all reshim commands #10134

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

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all 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
25 changes: 2 additions & 23 deletions readthedocs/doc_builder/director.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
"""Build process director."""

import os
import tarfile

Expand Down Expand Up @@ -357,34 +359,11 @@ def check_old_output_directory(self):
raise BuildUserError(BuildUserError.BUILD_OUTPUT_OLD_DIRECTORY_USED)

def run_build_commands(self):
reshim_commands = (
{"pip", "install"},
{"conda", "create"},
{"conda", "install"},
{"mamba", "create"},
{"mamba", "install"},
{"poetry", "install"},
)
cwd = self.data.project.checkout_path(self.data.version.slug)
environment = self.build_environment
for command in self.data.config.build.commands:
environment.run(command, escape_command=False, cwd=cwd)

# Execute ``asdf reshim python`` if the user is installing a
# package since the package may contain an executable
# See https://github.com/readthedocs/readthedocs.org/pull/9150#discussion_r882849790
for reshim_command in reshim_commands:
# Convert tuple/list into set to check reshim command is a
# subset of the command itself. This is to find ``pip install``
# but also ``pip -v install`` and ``python -m pip install``
if reshim_command.issubset(command.split()):
environment.run(
*["asdf", "reshim", "python"],
escape_command=False,
cwd=cwd,
record=False,
)

html_output_path = os.path.join(cwd, BUILD_COMMANDS_OUTPUT_PATH_HTML)
if not os.path.exists(html_output_path):
raise BuildUserError(BuildUserError.BUILD_COMMANDS_WITHOUT_OUTPUT)
Expand Down
18 changes: 0 additions & 18 deletions readthedocs/projects/tests/test_build_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -889,7 +889,6 @@ def test_build_tools(self, load_yaml_config):
[
mock.call("asdf", "install", "python", python_version),
mock.call("asdf", "global", "python", python_version),
mock.call("asdf", "reshim", "python", record=False),
mock.call(
"python",
"-mpip",
Expand All @@ -900,13 +899,10 @@ def test_build_tools(self, load_yaml_config):
),
mock.call("asdf", "install", "nodejs", nodejs_version),
mock.call("asdf", "global", "nodejs", nodejs_version),
mock.call("asdf", "reshim", "nodejs", record=False),
mock.call("asdf", "install", "rust", rust_version),
mock.call("asdf", "global", "rust", rust_version),
mock.call("asdf", "reshim", "rust", record=False),
mock.call("asdf", "install", "golang", golang_version),
mock.call("asdf", "global", "golang", golang_version),
mock.call("asdf", "reshim", "golang", record=False),
mock.ANY,
]
)
Expand Down Expand Up @@ -988,31 +984,27 @@ def test_build_tools_cached(self, load_yaml_config, build_tools_storage, tarfile
record=False,
),
mock.call("asdf", "global", "python", python_version),
mock.call("asdf", "reshim", "python", record=False),
mock.call(
"mv",
mock.ANY,
f"/home/docs/.asdf/installs/nodejs/{nodejs_version}",
record=False,
),
mock.call("asdf", "global", "nodejs", nodejs_version),
mock.call("asdf", "reshim", "nodejs", record=False),
mock.call(
"mv",
mock.ANY,
f"/home/docs/.asdf/installs/rust/{rust_version}",
record=False,
),
mock.call("asdf", "global", "rust", rust_version),
mock.call("asdf", "reshim", "rust", record=False),
mock.call(
"mv",
mock.ANY,
f"/home/docs/.asdf/installs/golang/{golang_version}",
record=False,
),
mock.call("asdf", "global", "golang", golang_version),
mock.call("asdf", "reshim", "golang", record=False),
mock.ANY,
]
)
Expand Down Expand Up @@ -1046,7 +1038,6 @@ def test_build_commands(self, load_yaml_config):
[
mock.call("asdf", "install", "python", python_version),
mock.call("asdf", "global", "python", python_version),
mock.call("asdf", "reshim", "python", record=False),
mock.call(
"python",
"-mpip",
Expand All @@ -1063,14 +1054,6 @@ def test_build_commands(self, load_yaml_config):
escape_command=False,
cwd=mock.ANY,
),
mock.call(
"asdf",
"reshim",
"python",
escape_command=False,
record=False,
cwd=mock.ANY,
),
mock.call(
"pelican --settings docs/pelicanconf.py --output $READTHEDOCS_OUTPUT/html/ docs/",
escape_command=False,
Expand Down Expand Up @@ -1194,7 +1177,6 @@ def test_python_mamba_commands(self, load_yaml_config):
[
mock.call("asdf", "install", "python", "mambaforge-4.10.3-10"),
mock.call("asdf", "global", "python", "mambaforge-4.10.3-10"),
mock.call("asdf", "reshim", "python", record=False),
mock.call(
"mamba",
"env",
Expand Down