Changeset 9f197de in rtems-tools


Ignore:
Timestamp:
May 20, 2019, 11:23:51 AM (6 months ago)
Author:
Vijay Kumar Banerjee <vijaykumar9597@…>
Branches:
master
Children:
6c79a16
Parents:
925448a
git-author:
Vijay Kumar Banerjee <vijaykumar9597@…> (05/20/19 11:23:51)
git-committer:
Chris Johns <chrisj@…> (05/21/19 05:53:38)
Message:

rtemstoolkit/path : Add listdir function

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • rtemstoolkit/path.py

    r925448a r9f197de  
    157157    path = os.path.expanduser(path)
    158158    return shell(path)
     159
     160def listdir(path):
     161    path = host(path)
     162    files = []
     163    if not exists(path):
     164        raise error.general('path does not exist : %s' % (path))
     165    elif not isdir(path):
     166        raise error.general('path is not a directory: %s' % (path))
     167    else:
     168        if windows:
     169            try:
     170                files = os.listdir(host(path))
     171            except IOError:
     172                raise error.general('Could not list files: %s' % (path))
     173            except OSError as e:
     174                raise error.general('Could not list files: %s: %s' % (path, str(e)))
     175            except WindowsError as e:
     176                raise error.general('Could not list files: %s: %s' % (path, str(e)))
     177        else:
     178            try:
     179                files = os.listdir(host(path))
     180            except IOError:
     181                raise error.general('Could not list files: %s' % (path))
     182            except OSError as e:
     183                raise error.general('Could not list files: %s: %s' % (path, str(e)))
     184
     185    return files
    159186
    160187def collect_files(path_):
     
    185212
    186213    if os.path.exists(src) and os.path.isdir(src):
    187         names = os.listdir(src)
     214        names = listdir(src)
    188215    else:
    189216        names = [basename(src)]
  • tester/rt/coverage.py

    r925448a r9f197de  
    216216             symbol_set_dir = path.join(self.build_dir,
    217217                                        self.bsp + '-coverage', symbol_set)
    218              html_files = os.listdir(symbol_set_dir)
     218             html_files = path.listdir(symbol_set_dir)
    219219             for html_file in html_files:
    220220                 html_file = path.join(symbol_set_dir, html_file)
     
    292292            config.set('symbol-sets', 'sets', sset)
    293293            config.add_section(sset)
    294             object_files = [o for o in os.listdir(self.symbol_sets[sset]) if o[-1] == 'o']
     294            object_files = [o for o in path.listdir(self.symbol_sets[sset]) if o[-1] == 'o']
    295295            object_paths = []
    296296            for o in object_files:
Note: See TracChangeset for help on using the changeset viewer.