if __name__ == "__main__":
import sys
- sys.exit(emerge_main())
+ from portage.exception import PermissionDenied
+ try:
+ retval = emerge_main()
+ except PermissionDenied, e:
+ sys.stderr.write("Permission denied: '%s'\n" % str(e))
+ sys.exit(e.errno)
+ sys.exit(retval)
except KeyError:
usage(sys.argv)
sys.exit(os.EX_USAGE)
+ except portage.exception.PermissionDenied, e:
+ sys.stderr.write("Permission denied: '%s'\n" % str(e))
+ sys.exit(e.errno)
main()
mtime = pathstat[stat.ST_MTIME]
else:
raise portage.exception.DirectoryNotFound(mypath)
- except (IOError,OSError,portage.exception.PortageException):
+ except EnvironmentError, e:
+ if e.errno == portage.exception.PermissionDenied.errno:
+ raise portage.exception.PermissionDenied(mypath)
+ del e
+ if EmptyOnError:
+ return [], []
+ return None, None
+ except portage.exception.PortageException:
if EmptyOnError:
return [], []
return None, None
if e.errno != errno.EACCES:
raise
del e
- if EmptyOnError:
- return [], []
raise portage.exception.PermissionDenied(mypath)
ftype = []
for x in list:
"""An operation was not permitted operating system"""
class PermissionDenied(PortageException):
+ from errno import EACCES as errno
"""Permission denied"""
class ReadOnlyFileSystem(PortageException):