Changeset 04aadb6 in rtems-source-builder


Ignore:
Timestamp:
Jan 30, 2014, 3:04:42 AM (5 years ago)
Author:
Chris Johns <chrisj@…>
Branches:
4.10, 4.11, 4.9, master
Children:
d9c1a48
Parents:
2be445d
Message:

Check the user's PATH environment variable.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • source-builder/sb/check.py

    r2be445d r04aadb6  
    9797
    9898
     99def path_check(opts, silent = False):
     100    if 'PATH' in os.environ:
     101        paths = os.environ['PATH'].split(os.pathsep)
     102        for p in paths:
     103            if len(p.strip()) == 0:
     104                if not silent:
     105                    log.notice('error: environment PATH contains an empty path')
     106                return False
     107            elif p.strip() == '.' or p.strip() == '..':
     108                if not silent:
     109                    log.notice('error: environment PATH invalid path: %s' % (p))
     110                return False
     111            elif not path.exists(p):
     112                if not silent and opts.warn_all():
     113                    log.notice('warning: environment PATH not found: %s' % (p))
     114            elif not path.isdir(p):
     115                if not silent and opts.warn_all():
     116                    log.notice('warning: environment PATH not a directory: %s' % (p))
     117    return True
     118
     119
    99120def host_setup(opts):
    100121    """ Basic sanity check. All executables and directories must exist."""
     122
     123    if not path_check(opts):
     124        return False
    101125
    102126    checks = { 'none':    _check_none,
Note: See TracChangeset for help on using the changeset viewer.