From bf65180e9b804e10afed43d930aead7a7ab8651d Mon Sep 17 00:00:00 2001 From: ashitsalesforce Date: Sun, 17 Mar 2024 23:35:43 -0700 Subject: [PATCH] python script improvement - use built-in which() method python script improvement - use built-in which() method --- updateSWT.py | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/updateSWT.py b/updateSWT.py index bf4bb9d7..b2354605 100755 --- a/updateSWT.py +++ b/updateSWT.py @@ -50,20 +50,6 @@ def exitWithError(errorStr): print(errorStr) sys.exit(-1) - -def which(program): - fpath = os.path.split(program) - if fpath: - if is_exe(program): - return program - else: - for path in os.environ["PATH"].split(os.pathsep): - exe_file = os.path.join(path, program) - if is_exe(exe_file): - return exe_file - - return None - ########################################################### def getSWTDownloadLinkForPlatform(soup, platformString): @@ -119,7 +105,7 @@ def installInLocalMavenRepo(unzippedSWTDir, mvnArtifactId, gitCloneRootDir): swtVersion = unzippedSWTDir.split('-')[1] # print(swtVersion) - if which("mvn") == None : + if shutil.which("mvn") == None : exitWithError("did not find mvn command in the execute path")