Skip to content

Commit 12424d1

Browse files
ericholscherstsewd
authored andcommitted
Revert "Build details page: normalize/trim command paths (#9815)"
This reverts commit 20533d4.
1 parent 43e4253 commit 12424d1

File tree

1 file changed

+0
-33
lines changed

1 file changed

+0
-33
lines changed

readthedocs/api/v2/serializers.py

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
"""Defines serializers for each of our models."""
22

3-
import re
4-
53
from allauth.socialaccount.models import SocialAccount
6-
from django.conf import settings
74
from rest_framework import serializers
85

96
from readthedocs.builds.models import Build, BuildCommandResult, Version
@@ -130,41 +127,11 @@ class VersionAdminSerializer(VersionSerializer):
130127
class BuildCommandSerializer(serializers.ModelSerializer):
131128

132129
run_time = serializers.ReadOnlyField()
133-
command = serializers.SerializerMethodField()
134130

135131
class Meta:
136132
model = BuildCommandResult
137133
exclude = []
138134

139-
def get_command(self, obj):
140-
# HACK: remove unreadable paths from the command outputs when returning it from the API.
141-
# We could make this change at build level, but we want to avoid undoable issues from now
142-
# and hack a small solution to fix the immediate problem.
143-
#
144-
# This converts:
145-
# $ /usr/src/app/checkouts/readthedocs.org/user_builds/
146-
# <container_hash>/<project_slug>/envs/<version_slug>/bin/python
147-
# $ /home/docs/checkouts/readthedocs.org/user_builds/
148-
# <project_slug>/envs/<version_slug>/bin/python
149-
# into
150-
# $ python
151-
project_slug = obj.build.version.project.slug
152-
version_slug = obj.build.version.slug
153-
docroot = settings.DOCROOT.rstrip("/") # remove trailing '/'
154-
155-
# Remove Docker hash from DOCROOT when running it locally
156-
# DOCROOT contains the Docker container hash (e.g. b7703d1b5854).
157-
# We have to remove it from the DOCROOT it self since it changes each time
158-
# we spin up a new Docker instance locally.
159-
container_hash = "/"
160-
if settings.RTD_DOCKER_COMPOSE:
161-
docroot = re.sub("/[0-9a-z]+/?$", "", settings.DOCROOT, count=1)
162-
container_hash = "/[0-9a-z]+/"
163-
164-
regex = f"{docroot}{container_hash}{project_slug}/envs/{version_slug}(/bin/)?"
165-
command = re.sub(regex, "", obj.command, count=1)
166-
return command
167-
168135

169136
class BuildSerializer(serializers.ModelSerializer):
170137

0 commit comments

Comments
 (0)