3535import zipfile
3636from collections import namedtuple
3737from collections .abc import Callable
38+ from pathlib import Path
3839from typing import Any
3940
4041import scriptutil
@@ -262,7 +263,7 @@ def checkSigs(urlString: str, version: str, tmpDir: str, isSigned: bool, keysFil
262263 gpgHomeDir = "%s/lucene.gpg" % tmpDir
263264 if os .path .exists (gpgHomeDir ):
264265 shutil .rmtree (gpgHomeDir )
265- os . makedirs (gpgHomeDir , 0o700 )
266+ Path (gpgHomeDir ). mkdir ( mode = 0o700 , parents = True )
266267 run ("gpg --homedir %s --import %s" % (gpgHomeDir , keysFile ), "%s/lucene.gpg.import.log" % tmpDir )
267268
268269 if mavenURL is None :
@@ -501,7 +502,7 @@ def unpackAndVerify(java: Any, tmpDir: str, artifact: str, gitRevision: str, ver
501502 destDir = "%s/unpack" % tmpDir
502503 if os .path .exists (destDir ):
503504 shutil .rmtree (destDir )
504- os . makedirs (destDir )
505+ Path (destDir ). mkdir ( parents = True )
505506 os .chdir (destDir )
506507 print (" unpack %s..." % artifact )
507508 unpackLogFile = "%s/lucene-unpack-%s.log" % (tmpDir , artifact )
@@ -722,7 +723,7 @@ def checkMaven(baseURL: str, tmpDir: str, gitRevision: str, version: str, isSign
722723 artifactsURL = "%s/lucene/maven/org/apache/lucene/" % baseURL
723724 targetDir = "%s/maven/org/apache/lucene" % tmpDir
724725 if not os .path .exists (targetDir ):
725- os . makedirs (targetDir )
726+ Path (targetDir ). mkdir ( parents = True )
726727 crawl (artifacts , artifactsURL , targetDir )
727728 print ()
728729 verifyPOMperBinaryArtifact (artifacts , version )
@@ -747,7 +748,7 @@ def getBinaryDistFiles(tmpDir: str, version: str, baseURL: str):
747748 destDir = "%s/unpack-lucene-getBinaryDistFiles" % tmpDir
748749 if os .path .exists (destDir ):
749750 shutil .rmtree (destDir )
750- os . makedirs (destDir )
751+ Path (destDir ). mkdir ( parents = True )
751752 os .chdir (destDir )
752753 print (" unpack %s..." % distribution )
753754 unpackLogFile = "%s/unpack-%s-getBinaryDistFiles.log" % (tmpDir , distribution )
@@ -864,7 +865,7 @@ def verifyMavenSigs(tmpDir: str, artifacts: list[str], keysFile: str):
864865 gpgHomeDir = "%s/lucene.gpg" % tmpDir
865866 if os .path .exists (gpgHomeDir ):
866867 shutil .rmtree (gpgHomeDir )
867- os . makedirs (gpgHomeDir , 0o700 )
868+ Path (gpgHomeDir ). mkdir ( mode = 0o700 , parents = True )
868869 run ("gpg --homedir %s --import %s" % (gpgHomeDir , keysFile ), "%s/lucene.gpg.import.log" % tmpDir )
869870
870871 reArtifacts = re .compile (r"\.(?:pom|[jw]ar)$" )
@@ -929,7 +930,7 @@ def crawl(downloadedFiles: list[str], urlString: str, targetDir: str, exclusions
929930 path = os .path .join (targetDir , text )
930931 if text .endswith ("/" ):
931932 if not os .path .exists (path ):
932- os . makedirs (path )
933+ Path (path ). mkdir ( parents = True )
933934 crawl (downloadedFiles , subURL , path , exclusions )
934935 else :
935936 if not os .path .exists (path ) or FORCE_CLEAN :
@@ -1162,7 +1163,7 @@ def smokeTest(java: Any, baseURL: str, gitRevision: str, version: str, tmpDir: s
11621163 raise RuntimeError ("temp dir %s exists; please remove first" % tmpDir )
11631164
11641165 if not os .path .exists (tmpDir ):
1165- os . makedirs (tmpDir )
1166+ Path (tmpDir ). mkdir ( parents = True )
11661167
11671168 lucenePath = None
11681169 print ()
0 commit comments