@@ -135,10 +135,8 @@ def build_doc_release(self, release, force=False, interactive=False):
135135 self .stdout .write (f"Starting update for { release } at { datetime .now ()} ..." )
136136
137137 # checkout_dir is shared for all languages.
138- checkout_dir = settings .DOCS_BUILD_ROOT .joinpath ("sources" , release .version )
139- parent_build_dir = settings .DOCS_BUILD_ROOT .joinpath (
140- release .lang , release .version
141- )
138+ checkout_dir = settings .DOCS_BUILD_ROOT / "sources" / release .version
139+ parent_build_dir = settings .DOCS_BUILD_ROOT / release .lang / release .version
142140 if not checkout_dir .exists ():
143141 checkout_dir .mkdir (parents = True )
144142 if not parent_build_dir .exists ():
@@ -161,20 +159,21 @@ def build_doc_release(self, release, force=False, interactive=False):
161159 )
162160 return
163161
164- source_dir = checkout_dir . joinpath ( "docs" )
162+ source_dir = checkout_dir / "docs"
165163
166164 if release .lang != settings .DEFAULT_LANGUAGE_CODE :
167165 scm_url = release .scm_url .replace (
168166 "django.git" , "django-docs-translations.git"
169167 )
170- trans_dir = checkout_dir . joinpath ( "django-docs-translation" )
168+ trans_dir = checkout_dir / "django-docs-translation"
171169 if not trans_dir .exists ():
172170 trans_dir .mkdir ()
173171 self .update_git (scm_url , trans_dir )
174- if not source_dir .joinpath ("locale" ).exists ():
175- source_dir .joinpath ("locale" ).symlink_to (
176- trans_dir .joinpath ("translations" )
177- )
172+
173+ locale_dir = source_dir / "locale"
174+ if not locale_dir .exists ():
175+ locale_dir .symlink_to (trans_dir / "translations" )
176+
178177 extra_kwargs = {"stdout" : subprocess .DEVNULL } if self .verbosity == 0 else {}
179178 subprocess .check_call (
180179 "cd %s && make translations" % trans_dir , shell = True , ** extra_kwargs
@@ -191,7 +190,7 @@ def build_doc_release(self, release, force=False, interactive=False):
191190 #
192191 for builder in builders :
193192 # Wipe and re-create the build directory. See #18930.
194- build_dir = parent_build_dir . joinpath ( "_build" , builder )
193+ build_dir = parent_build_dir / "_build" / builder
195194 if build_dir .exists ():
196195 shutil .rmtree (str (build_dir ))
197196 build_dir .mkdir (parents = True )
@@ -209,7 +208,7 @@ def build_doc_release(self, release, force=False, interactive=False):
209208 srcdir = source_dir ,
210209 confdir = source_dir ,
211210 outdir = build_dir ,
212- doctreedir = build_dir . joinpath ( ".doctrees" ) ,
211+ doctreedir = build_dir / ".doctrees" ,
213212 buildername = builder ,
214213 # Translated docs builds generate a lot of warnings, so send
215214 # stderr to stdout to be logged (rather than generating an email)
@@ -234,9 +233,9 @@ def build_doc_release(self, release, force=False, interactive=False):
234233 # Create a zip file of the HTML build for offline reading.
235234 # This gets moved into MEDIA_ROOT for downloading.
236235 #
237- html_build_dir = parent_build_dir . joinpath ( "_build" , "djangohtml" )
236+ html_build_dir = parent_build_dir / "_build" / "djangohtml"
238237 zipfile_name = f"django-docs-{ release .version } -{ release .lang } .zip"
239- zipfile_path = Path ( settings .MEDIA_ROOT ). joinpath ( "docs" , zipfile_name )
238+ zipfile_path = settings .MEDIA_ROOT / "docs" / zipfile_name
240239 if not zipfile_path .parent .exists ():
241240 zipfile_path .parent .mkdir (parents = True )
242241 if self .verbosity >= 2 :
@@ -259,8 +258,8 @@ def zipfile_inclusion_filter(file_path):
259258 # Copy the build results to the directory used for serving
260259 # the documentation in the least disruptive way possible.
261260 #
262- build_dir = parent_build_dir . joinpath ( "_build" )
263- built_dir = parent_build_dir . joinpath ( "_built" )
261+ build_dir = parent_build_dir / "_build"
262+ built_dir = parent_build_dir / "_built"
264263 subprocess .check_call (
265264 [
266265 "rsync" ,
@@ -275,7 +274,7 @@ def zipfile_inclusion_filter(file_path):
275274 if release .is_default :
276275 self ._setup_stable_symlink (release , built_dir )
277276
278- json_built_dir = parent_build_dir . joinpath ( "_built" , "json" )
277+ json_built_dir = parent_build_dir / "_built" / "json"
279278 documents = gen_decoded_documents (json_built_dir )
280279 release .sync_to_db (documents )
281280
@@ -289,7 +288,7 @@ def update_git(self, url, destdir, changed_dir="."):
289288 repo , branch = url .rsplit ("@" , 1 )
290289 else :
291290 repo , branch = url , "main"
292- if destdir . joinpath ( ".git" ).exists ():
291+ if ( destdir / ".git" ).exists ():
293292 remote = "origin"
294293 branch_with_remote = f"{ remote } /{ branch } "
295294 try :
0 commit comments