fi
# return shell-true/shell-false if exists.
# Takes single depend-type atoms.
- if "${PORTAGE_BIN_PATH}/portageq" 'has_version' "${ROOT}" "$1"; then
- return 0
- else
- return 1
- fi
+ "${PORTAGE_BIN_PATH}"/portageq has_version "${ROOT}" "$1"
+ local retval=$?
+ case "${retval}" in
+ 0)
+ return 0
+ ;;
+ 1)
+ return 1
+ ;;
+ *)
+ die "unexpected portageq exit code: ${retval}"
+ ;;
+ esac
}
portageq() {
post_emerge(settings, mtimedb, 0)
if __name__ == "__main__":
- retval = 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)
import os
import types
-
+import portage_exception
#-----------------------------------------------------------------------------
#
# To add functionality to this tool, add a function below.
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):