Small glitch and a simple question

Johannes Ranke jranke at uni-bremen.de
Mon Dec 18 08:18:51 CET 2006


Hi,


* James Westby <jw+debian at jameswestby.net> [061216 02:50]:
> On (16/12/06 01:42), Johannes Ranke wrote:
> > Hi all,
> > 
> > I am quite new to python, but I want to use it to automate a packaging 
> > task. Changelog() almost works for me :)
> > 
> > There is a parse error caused by the following line in a changelog
> > 
> > 
> >  -- Douglas Bates <bates at stat.wisc.edu>  Fri, 8 Oct 1999 10:04:55 -0500
> > 
> > which should rather read
> > 
> >  -- Douglas Bates <bates at stat.wisc.edu>  Fri,  8 Oct 1999 10:04:55 -0500
> >                                               ^ 
> > 
> > Yes, the difference is the whitespace here... If Changelog() could
> > tolerate this, it would make it more bullet-proof, although of course I
> > can find a workaround.
> 
> Yes I am rather strict about what I will parse where possible (i.e. the
> body of the changelog is hard to be strict about, but the headers and
> footers are not).
> 
> I'm not entirely sure whether the date in your second example if rfc822
> compliant as required for policy. Looking at the rfx the format of the
> date field is given in BNF, but it does not state whether whitespace is
> significant anwhere.
> 
> I am not sure what to do about this. I would prefer to keep the parsing
> as strict as possible, but I understand the desire to accept syntax that
> is accepted by all of the other tools. Certainly if someone points out a
> reference that states the rfc allows the above syntax I will support it.

I just looked into rfc 822 at http://www.ietf.org/rfc/rfc0822.txt

There, in chapter 5.1 it says

     date        =  1*2DIGIT month 2DIGIT        ; day month year
                                                 ;  e.g. 20 Jun 82

Chapter 2.4 states the meaning of the asterisk:

     2.4.  *RULE:  REPETITION

          The character "*" preceding an element indicates repetition.
     The full form is:

                              <l>*<m>element

     indicating at least <l> and at most <m> occurrences  of  element.
     Default values are 0 and infinity so that "*(element)" allows any
     number, including zero; "1*element" requires at  least  one;  and
     "1*2element" allows one or two.

So this means that either one or two digits are allowed for specifying
the day of the month, so both date specifications are allowed.

> 
> > 
> > Another question I have that might sound stupid: If I have a modified
> > changelog, how do I write it to the file? I only found
> > 
> > print changelog
> > 
> > in the example, but I can't write the object to a file.
> 
> The changelog creation is done in the __str__() method, so converting it
> to a string will get you the properly formatted changelog. This means
> that you can call string = str(changelog) and then write string to the
> file.

Ah, thanks for the hint!
 
> The code I wrote this module for doesn't currently care about the actual
> changelog, it just wants to access the information in an existing one,
> so I didn't pay much attention to that end of the API. If you would like
> a method with a signature something like

What do you mean by "method with a signature"?
 
>   write_to_file(file)
> 
> say the word and it will be in the next version.

This would be nice to have, indeed.
 
> Can I ask what you are using the module for? I would be interested in
> the uses other people are finding for the code, and any suggestions you
> have for how to improve it or what new features may be wanted.

I want to use it for backporting Debian versions of R packages from sid
to etch.
 
> Also if the code is public you could provide me with a copy to use for
> regression tests/consideration of your code in any API changes.

So far, the code is really simple, I am just testing. I will be happy to
share the code once it is worked out.
 
> Thanks,
 
Thank you!

Johannes

> James
> 
> -- 
>   James Westby   --    GPG Key ID: B577FE13    --     http://jameswestby.net/
>   seccure key - (3+)k7|M*edCX/.A:n*N!>|&7U.L#9E)Tu)T0>AM - secp256r1/nistp256



More information about the pkg-python-debian-discuss mailing list