[docs] replace() argument 1 must be str, not _StrPath

This change ports Ic8936c2e657a2a0212b1bc96915ba6e2035569b3 from
nova's specs repo to fix the redirect generation

The type of app.builder.srcdir is now a _StrPath which
breaks the invocation of replace when generating
redirects.

This change just fixes that by wrapping it in str()

Change-Id: I123aec140d9871ad27e522c107edad40efaf2a19
This commit is contained in:
Sean Mooney 2024-10-25 12:32:50 +01:00
parent ea19cfd56e
commit 39ccb17db4

View File

@ -11,7 +11,8 @@ LOG = logging.getLogger(__name__)
def process_redirect_file(app, path, ent): def process_redirect_file(app, path, ent):
parent_path = path.replace(app.builder.srcdir, app.builder.outdir) parent_path = path.replace(
str(app.builder.srcdir), str(app.builder.outdir))
with open(os.path.join(path, ent)) as redirects: with open(os.path.join(path, ent)) as redirects:
for line in redirects.readlines(): for line in redirects.readlines():
from_path, to_path = line.rstrip().split(' ') from_path, to_path = line.rstrip().split(' ')