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 :
@@ -446,7 +447,7 @@ def run(command: str, logFile: str):
446447 if cygwin :
447448 command = cygwinifyPaths (command )
448449 if os .system ("%s > %s 2>&1" % (command , logFile )):
449- logPath = os . path . abspath ( logFile )
450+ logPath : str = str ( Path ( logFile ). resolve () )
450451 print ('\n command "%s" failed:' % command )
451452 printFileContents (logFile )
452453 raise RuntimeError ('command "%s" failed; see log file %s' % (command , logPath ))
@@ -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 :
@@ -1022,7 +1023,7 @@ def parse_config():
10221023 c .java = make_java_config (parser , c .test_alternative_java )
10231024
10241025 if c .tmp_dir :
1025- c .tmp_dir = os . path . abspath ( c .tmp_dir )
1026+ c .tmp_dir = str ( Path ( c .tmp_dir ). resolve () )
10261027 else :
10271028 tmp = "/tmp/smoke_lucene_%s_%s" % (c .version , c .revision )
10281029 c .tmp_dir = tmp
@@ -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