Brad Hall wrote:
> On Mon, Aug 25, 2008 at 10:34:31PM -0700, Brock Pytlik wrote:
>   
>> Sorry that these are all flying at once.
>>
>> This fixes the problem where the indexer would blow up if a package had 
>> a directory which ended in a slash.
>>
>> CR:
>> http://cr.opensolaris.org/~bpytlik/ips-bug-3046-v1/
>>
>> Bug:
>> http://defect.opensolaris.org/bz/show_bug.cgi?id=3046
>>
>> Thanks,
>> Brock
>>     
>
> Maybe you can just do:
>
> return {
>       "basename": os.path.basename(self.attrs["path"].rstrip(os.path.sep))
>       "path": os.path.sep + self.attrs["path"]
>       }
>
> I don't think you need the extra checks there, rstrip() will do nothing if
> there isn't a "/" on the end (i.e. foo = "bar"; print foo.rstrip("/") ->
> "bar").  And maybe change to os.path.sep incase this gets run on other
> platforms as well.
>
> Aside from that, looks fine to me.
>
> -Brad
>   
I probably can collapse one of the checks out, but I need the if 
statement so that os.path.basename is never called on "/".

But I can change it to something that makes it more clear like....
if self.attrs["path"] == "/":
        return { "path": os.path.sep + self.attrs["path"] }
return {
        "basename": os.path.basename(self.attrs["path"].rstrip(os.path.sep))
        "path": os.path.sep + self.attrs["path"]

}


How does that look?

Brock

_______________________________________________
pkg-discuss mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/pkg-discuss

Reply via email to