@@ -133,10 +133,8 @@ def build_doc_release(self, release, force=False, interactive=False):
133133 self .stdout .write (f"Starting update for { release } at { datetime .now ()} ..." )
134134
135135 # checkout_dir is shared for all languages.
136- checkout_dir = settings .DOCS_BUILD_ROOT .joinpath ("sources" , release .version )
137- parent_build_dir = settings .DOCS_BUILD_ROOT .joinpath (
138- release .lang , release .version
139- )
136+ checkout_dir = settings .DOCS_BUILD_ROOT / "sources" / release .version
137+ parent_build_dir = settings .DOCS_BUILD_ROOT / release .lang / release .version
140138 if not checkout_dir .exists ():
141139 checkout_dir .mkdir (parents = True )
142140 if not parent_build_dir .exists ():
@@ -159,20 +157,21 @@ def build_doc_release(self, release, force=False, interactive=False):
159157 )
160158 return
161159
162- source_dir = checkout_dir . joinpath ( "docs" )
160+ source_dir = checkout_dir / "docs"
163161
164162 if release .lang != "en" :
165163 scm_url = release .scm_url .replace (
166164 "django.git" , "django-docs-translations.git"
167165 )
168- trans_dir = checkout_dir . joinpath ( "django-docs-translation" )
166+ trans_dir = checkout_dir / "django-docs-translation"
169167 if not trans_dir .exists ():
170168 trans_dir .mkdir ()
171169 self .update_git (scm_url , trans_dir )
172- if not source_dir .joinpath ("locale" ).exists ():
173- source_dir .joinpath ("locale" ).symlink_to (
174- trans_dir .joinpath ("translations" )
175- )
170+
171+ locale_dir = source_dir / "locale"
172+ if not locale_dir .exists ():
173+ locale_dir .symlink_to (trans_dir / "translations" )
174+
176175 extra_kwargs = {"stdout" : subprocess .DEVNULL } if self .verbosity == 0 else {}
177176 subprocess .check_call (
178177 "cd %s && make translations" % trans_dir , shell = True , ** extra_kwargs
@@ -189,7 +188,7 @@ def build_doc_release(self, release, force=False, interactive=False):
189188 #
190189 for builder in builders :
191190 # Wipe and re-create the build directory. See #18930.
192- build_dir = parent_build_dir . joinpath ( "_build" , builder )
191+ build_dir = parent_build_dir / "_build" / builder
193192 if build_dir .exists ():
194193 shutil .rmtree (str (build_dir ))
195194 build_dir .mkdir (parents = True )
@@ -207,7 +206,7 @@ def build_doc_release(self, release, force=False, interactive=False):
207206 srcdir = source_dir ,
208207 confdir = source_dir ,
209208 outdir = build_dir ,
210- doctreedir = build_dir . joinpath ( ".doctrees" ) ,
209+ doctreedir = build_dir / ".doctrees" ,
211210 buildername = builder ,
212211 # Translated docs builds generate a lot of warnings, so send
213212 # stderr to stdout to be logged (rather than generating an email)
@@ -232,9 +231,9 @@ def build_doc_release(self, release, force=False, interactive=False):
232231 # Create a zip file of the HTML build for offline reading.
233232 # This gets moved into MEDIA_ROOT for downloading.
234233 #
235- html_build_dir = parent_build_dir . joinpath ( "_build" , "djangohtml" )
234+ html_build_dir = parent_build_dir / "_build" / "djangohtml"
236235 zipfile_name = f"django-docs-{ release .version } -{ release .lang } .zip"
237- zipfile_path = Path ( settings .MEDIA_ROOT ). joinpath ( "docs" , zipfile_name )
236+ zipfile_path = settings .MEDIA_ROOT / "docs" / zipfile_name
238237 if not zipfile_path .parent .exists ():
239238 zipfile_path .parent .mkdir (parents = True )
240239 if self .verbosity >= 2 :
@@ -257,8 +256,8 @@ def zipfile_inclusion_filter(file_path):
257256 # Copy the build results to the directory used for serving
258257 # the documentation in the least disruptive way possible.
259258 #
260- build_dir = parent_build_dir . joinpath ( "_build" )
261- built_dir = parent_build_dir . joinpath ( "_built" )
259+ build_dir = parent_build_dir / "_build"
260+ built_dir = parent_build_dir / "_built"
262261 subprocess .check_call (
263262 [
264263 "rsync" ,
@@ -273,7 +272,7 @@ def zipfile_inclusion_filter(file_path):
273272 if release .is_default :
274273 self ._setup_stable_symlink (release , built_dir )
275274
276- json_built_dir = parent_build_dir . joinpath ( "_built" , "json" )
275+ json_built_dir = parent_build_dir / "_built" / "json"
277276 documents = gen_decoded_documents (json_built_dir )
278277 release .sync_to_db (documents )
279278
@@ -287,7 +286,7 @@ def update_git(self, url, destdir, changed_dir="."):
287286 repo , branch = url .rsplit ("@" , 1 )
288287 else :
289288 repo , branch = url , "main"
290- if destdir . joinpath ( ".git" ).exists ():
289+ if ( destdir / ".git" ).exists ():
291290 remote = "origin"
292291 branch_with_remote = f"{ remote } /{ branch } "
293292 try :
0 commit comments