On Saturday 18 January 2014 21:00:48 Chris Reffett wrote: > --- /dev/null > +++ b/pym/portage/util/rochecker.py > @@ -0,0 +1,81 @@ > +#-*- coding:utf-8 -*- > +# Copyright 2014 Gentoo Foundation > +# Distributed under the terms of the GNU General Public License v2 > +""" > +Methods to check whether Portage is going to write to read-only > filesystems. +Since the methods are not portable across different OSes, > each OS needs its +own method. To expand RO checking for different OSes, > add a method which +accepts a list of directories and returns a list of > mounts which need to be +remounted RW, then add "elif ostype == (the > ostype value for your OS)" to prefer OSes -> OS's > +get_ro_checker() > +""" period at the end > +def get_ro_checker(): > + """ > + Uses the system type to find an appropriate method for testing whether > Portage > + is going to write to any read-only filesystems > + > + @return: > + 1. A method for testing for RO filesystems appropriate to the current > system > + """ not a new issue, but we really need to get away from this style and use PEP257. someone feel like fixing that in the code base ? :) > + if ostype == "Linux": > + return linux_ro_checker > + else: > + return empty_ro_checker isn't this a glorified dict ? _CHECKERS = { 'Linux': linux_ro_checker, } def get_ro_checker() return _CHECKERS.get(ostype, empty_ro_checker) -mike