kde_build: problem with kdeSvnPath/kdeSvnUnpack

Wolfgang Rohdewald wolfgang at rohdewald.de
Wed Jan 12 23:28:23 CET 2011

kdeSvnPath() may return False but then
kdeSvnUnpack() will fail because False has no method rindex()

again I am not sure how to fix this. I think
kdeSvnPath() should return None for no path found
(would be more pythonic)
and kdeSvnUnpack() should return False if kdeSvnPath() is None

that is compatible with all callers of svnPath() since None and
False both evaluate to False in if-statements

current wrong code:

def kdeSvnPath( self ):
    """overload this function in kde packages to use the nocopy option"""
    """this function should return the full path seen from /home/KDE/"""
    if self.subinfo.buildTarget in self.subinfo.svnTargets.keys():
        return self.subinfo.svnTargets[ self.subinfo.buildTarget ]
        return False

def kdeSvnUnpack( self, svnpath=None, packagedir=None ):
    """fetching and copying the sources from svn"""
    if not svnpath and not packagedir:
        if self.kdeSvnPath():
            svnpath = self.kdeSvnPath()[ :self.kdeSvnPath().rfind('/') ]
            packagedir = self.kdeSvnPath()[ self.kdeSvnPath().rfind('/') + 1:]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.kde.org/pipermail/kde-windows/attachments/20110112/36345665/attachment-0001.htm 

More information about the Kde-windows mailing list