Sorry, that should of been (from line 91):
tokens = line.split(None, 1)[1].strip('"').split("/")
if len(tokens) != 2:
message = "**** Malformed classification line: %s:\n" % line
sys.stderr.write(message)
return
category = tokens[0]
sub_category = tokens[1]
...
There was also a bogus debug line in there that I've removed.
-------- Original Message --------
Subject: Re: [pkg-discuss] Code review request for opensolaris
packaging bug #4483.
Date: Thu, 06 Nov 2008 18:51:18 -0800
From: Rich Burridge <[EMAIL PROTECTED]>
To: Danek Duvall <[EMAIL PROTECTED]>
CC: pkg discuss <[email protected]>
References: <[EMAIL PROTECTED]>
<[EMAIL PROTECTED]> <[EMAIL PROTECTED]>
<[EMAIL PROTECTED]> <[EMAIL PROTECTED]>
<[EMAIL PROTECTED]>
Danek Duvall wrote:
> On Thu, Nov 06, 2008 at 03:35:31PM -0800, Rich Burridge wrote:
>
>>> - line 98: Shouldn't this simply be tokens[0]? Likewise on 99, tokens[1]?
>>> Or just "category, sub_category = tokens"?
>> No, because it needs to remove the initial and trailing double quotes
>> (which should be present on all classification lines because of the
>> previous classification work I did):
>
> Ah, quotes. Then please call .strip('"') on the string instead of assuming
> they're there.
Okay. Rather than generate a new webrev just for this, are you okay with:
91 tokens = line.split(None, 1)[1].split("/")
becoming:
91 tokens = line.split(None, 1)[1].strip('"').split("/")
?
Seems to work just fine:
$ python
Python 2.5.2 (r252:60911, Jul 31 2008, 17:28:52)
[GCC 4.2.3 (Ubuntu 4.2.3-2ubuntu7)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> line='classification "System/Hardware"'
>>> tokens = line.split(None, 1)[1].strip('"').split("/")
>>> print tokens
['System', 'Hardware']
>>> newline='classification Applications/Internet'
>>> newtokens = newline.split(None, 1)[1].strip('"').split("/")
>>> print newtokens
['Applications', 'Internet']
>>>
Thanks.
_______________________________________________
pkg-discuss mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/pkg-discuss
_______________________________________________
pkg-discuss mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/pkg-discuss