diff --git a/helpers/helperslib/Buildable.py b/helpers/helperslib/Buildable.py --- a/helpers/helperslib/Buildable.py +++ b/helpers/helperslib/Buildable.py @@ -87,28 +87,25 @@ # Load the projects from the YAML file def loadProjectsFromTree( self, directoryPath ): # Get a listing of everything in this directory - filesPresent = os.listdir(directoryPath) + filesPresent = os.scandir(directoryPath) # We will recurse into directories beneath this one # If there is a metadata.yaml file present, we will parse it to determine if this is a repository we need to register - for fileToExamine in filesPresent: - # Determine the full path to the file we are examining - pathToExamine = os.path.join( directoryPath, fileToExamine ) - + for entry in filesPresent: # Is it a symlink? We always ignore these - if os.path.islink(pathToExamine): + if entry.is_symlink(): continue # Is it a directory we need to recurse into? - if os.path.isdir(pathToExamine): - self.loadProjectsFromTree(pathToExamine) + if entry.is_dir(): + self.loadProjectsFromTree(entry.path) continue # If the filename isn't metadata.yaml, ignore it - if fileToExamine != 'metadata.yaml': + if entry.name != 'metadata.yaml': continue # Load the metadata.yaml file and create a project from it - projectMetadataFile = open(pathToExamine, 'r', encoding='utf-8') + projectMetadataFile = open(entry.path, 'r', encoding='utf-8') # Parse the YAML file projectMetadata = yaml.load(projectMetadataFile) # Is it a repository - ie. something we need to know about?