Skip to content

Commit

Permalink
Group function definitions
Browse files Browse the repository at this point in the history
  • Loading branch information
stuarthayhurst committed Dec 10, 2023
1 parent 76fce5c commit 8907cf6
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions scripts/clean-dirs.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,14 @@ def isSymlinkBroken(path):
#Either not a symlink, or not broken
return False

#Find empty directories and delete, repeat until no empty directories are found
def listEmptyDirs(dirName):
emptyDirs = []
for (dirPath, dirNames, filenames) in os.walk(dirName):
if len(dirNames) == 0 and len(filenames) == 0 :
emptyDirs.append(dirPath)
return emptyDirs

#Generate a list of directories matching buildDir/*x*
buildDir = str(sys.argv[1])
resolutionDirs = getResolutionDirs(buildDir)
Expand All @@ -38,14 +46,6 @@ def isSymlinkBroken(path):
elif (os.path.exists(file) or isSymlinkBroken(file)):
os.rmdir(file)

#Find empty directories and delete, repeat until no empty directories are found
def listEmptyDirs(dirName):
emptyDirs = []
for (dirPath, dirNames, filenames) in os.walk(dirName):
if len(dirNames) == 0 and len(filenames) == 0 :
emptyDirs.append(dirPath)
return emptyDirs

emptyDirs = listEmptyDirs(buildDir)
while emptyDirs != []:
for emptyDir in emptyDirs:
Expand Down

0 comments on commit 8907cf6

Please sign in to comment.