You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by ju...@apache.org on 2019/10/29 17:22:40 UTC

svn commit: r1869118 - /subversion/trunk/tools/dist/release.py

Author: julianfoad
Date: Tue Oct 29 17:22:40 2019
New Revision: 1869118

URL: http://svn.apache.org/viewvc?rev=1869118&view=rev
Log:
In 'release.py write-news': Add '--news-release-date' option.

Modified:
    subversion/trunk/tools/dist/release.py

Modified: subversion/trunk/tools/dist/release.py
URL: http://svn.apache.org/viewvc/subversion/trunk/tools/dist/release.py?rev=1869118&r1=1869117&r2=1869118&view=diff
==============================================================================
--- subversion/trunk/tools/dist/release.py (original)
+++ subversion/trunk/tools/dist/release.py Tue Oct 29 17:22:40 2019
@@ -1188,8 +1188,9 @@ def move_to_dist(args):
 
 def write_news(args):
     'Write text for the Subversion website.'
-    data = { 'date' : datetime.date.today().strftime('%Y%m%d'),
-             'date_pres' : datetime.date.today().strftime('%Y-%m-%d'),
+    release_date = args.news_release_date or datetime.date.today().strftime('%Y-%m-%d')
+    data = { 'date' : re.sub("-", "", release_date),  # format YYYYmmdd
+             'date_pres' : release_date,              # format YYYY-mm-dd
              'major-minor' : args.version.branch,
              'version' : str(args.version),
              'version_base' : args.version.base,
@@ -1796,6 +1797,9 @@ def main():
     subparser.set_defaults(func=write_news)
     subparser.add_argument('--announcement-url',
                     help='''The URL to the archived announcement email.''')
+    subparser.add_argument('--news-release-date',
+                    help='''The release date for the news, as YYYY-MM-DD.
+                            Default: today.''')
     subparser.add_argument('--edit-html-file',
                     help='''Insert the text into this file
                             news.html, index.html).''')



Re: svn commit: r1869118 - /subversion/trunk/tools/dist/release.py

Posted by Julian Foad <ju...@apache.org>.
Daniel Shahaf wrote:
> Julian Foad wrote on Tue, 29 Oct 2019 20:54 +00:00:
>> At a quick try I couldn't get either "time.strptime" nor
>> "datetime.strptime" to work.  The latter says "AttributeError: [...]
> 
> Thanks, r1869134.  The AttributeError was likely because the function's
> fully-qualified name is "datetime.datetime.strptime".

Ah, yes, that would be what I did wrong.  Thanks for fixing it.

> I've also committed my "Link to the KEYS file" patch too.  (I haven't
> done that until now because the soak was in progress.) 

Looks good.  Followed up in thread "Link to KEYS file on our download page".

> If either of
> these patches gets the way of a 1.13.1 or 1.12.3, don't hesitate to just
> revert it to unblock release work.

Thanks.

- Julian


Re: svn commit: r1869118 - /subversion/trunk/tools/dist/release.py

Posted by Daniel Shahaf <d....@daniel.shahaf.name>.
Julian Foad wrote on Tue, 29 Oct 2019 20:54 +00:00:
> Daniel Shahaf wrote:
> > release_date = time.strptime(args.news_release_date, "YYYY-mm-dd") if args.news_release_date else datetime.date.today()
> > … { 'date': release_date.strftime("YYYYmmdd"),
> >      'date_pres': release_date.strftime(…) }
> 
> Sounds good.  Format strings would be %Y-%m-%d etc.
> 
> At a quick try I couldn't get either "time.strptime" nor 
> "datetime.strptime" to work.  The latter says "AttributeError: 'module' 
> object has no attribute 'strptime'"... which puzzles me as the docs say 
> it's been available since Python 2.5.  I didn't bother to pursue doing 
> it using the "time" module though there was nothing stopping me.
> 
> Please just do whatever fixes it if you like, else maybe I'll have 
> another go later but not urgently.

Thanks, r1869134.  The AttributeError was likely because the function's
fully-qualified name is "datetime.datetime.strptime".

I've also committed my "Link to the KEYS file" patch too.  (I haven't
done that until now because the soak was in progress.)  If either of
these patches gets the way of a 1.13.1 or 1.12.3, don't hesitate to just
revert it to unblock release work.

Cheers,

Daniel

Re: svn commit: r1869118 - /subversion/trunk/tools/dist/release.py

Posted by Julian Foad <ju...@apache.org>.
Daniel Shahaf wrote:
> You don't do any input validation on the date in argv anywhere, so

Right.  I'm not wanting to spend much time on niceties as I want to 
change a lot of this to read data from somewhere else, but then it still 
might want validating at this level.

[...]
> release_date = time.strptime(args.news_release_date, "YYYY-mm-dd") if args.news_release_date else datetime.date.today()
> … { 'date': release_date.strftime("YYYYmmdd"),
>      'date_pres': release_date.strftime(…) }

Sounds good.  Format strings would be %Y-%m-%d etc.

At a quick try I couldn't get either "time.strptime" nor 
"datetime.strptime" to work.  The latter says "AttributeError: 'module' 
object has no attribute 'strptime'"... which puzzles me as the docs say 
it's been available since Python 2.5.  I didn't bother to pursue doing 
it using the "time" module though there was nothing stopping me.

Please just do whatever fixes it if you like, else maybe I'll have 
another go later but not urgently.

- Julian

Re: svn commit: r1869118 - /subversion/trunk/tools/dist/release.py

Posted by Daniel Shahaf <d....@daniel.shahaf.name>.
julianfoad@apache.org wrote on Tue, 29 Oct 2019 17:22 +00:00:
> +++ subversion/trunk/tools/dist/release.py Tue Oct 29 17:22:40 2019
> @@ -1188,8 +1188,9 @@ def move_to_dist(args):
>  def write_news(args):
>      'Write text for the Subversion website.'
> -    data = { 'date' : datetime.date.today().strftime('%Y%m%d'),
> -             'date_pres' : datetime.date.today().strftime('%Y-%m-%d'),
> +    release_date = args.news_release_date or datetime.date.today().strftime('%Y-%m-%d')
> +    data = { 'date' : re.sub("-", "", release_date),  # format YYYYmmdd

You don't do any input validation on the date in argv anywhere, so
--news-release-date=foo-bar would be accepted here, as would
--news-release-date=2020-1-1 without leading zeroes.

I assume the lack of leading zeroes would cause problems at some point
down the road (for example, if we ever try to use the 'date' or
'date_pres' replaceables in a context that actually parses them as
date strings, such as the ?update= parameter to download.cgi).

I suggest instead:

release_date = time.strptime(args.news_release_date, "YYYY-mm-dd") if args.news_release_date else datetime.date.today()
… { 'date': release_date.strftime("YYYYmmdd"),
    'date_pres': release_date.strftime(…) }

Cheers,

Daniel

> +             'date_pres' : release_date,              # format  YYYY-mm-dd
>               'major-minor' : args.version.branch,
>               'version' : str(args.version),
>               'version_base' : args.version.base,
> @@ -1796,6 +1797,9 @@ def main():
>      subparser.set_defaults(func=write_news)
>      subparser.add_argument('--announcement-url',
>                      help='''The URL to the archived announcement email.''')
> +    subparser.add_argument('--news-release-date',
> +                    help='''The release date for the news, as YYYY-MM-DD.
> +                            Default: today.''')
>      subparser.add_argument('--edit-html-file',
>                      help='''Insert the text into this file
>                              news.html, index.html).''')
> 
> 
>

Re: svn commit: r1869118 - /subversion/trunk/tools/dist/release.py

Posted by Daniel Shahaf <d....@daniel.shahaf.name>.
julianfoad@apache.org wrote on Tue, 29 Oct 2019 17:22 +00:00:
> +++ subversion/trunk/tools/dist/release.py Tue Oct 29 17:22:40 2019
> @@ -1188,8 +1188,9 @@ def move_to_dist(args):
>  def write_news(args):
>      'Write text for the Subversion website.'
> -    data = { 'date' : datetime.date.today().strftime('%Y%m%d'),
> -             'date_pres' : datetime.date.today().strftime('%Y-%m-%d'),
> +    release_date = args.news_release_date or datetime.date.today().strftime('%Y-%m-%d')
> +    data = { 'date' : re.sub("-", "", release_date),  # format YYYYmmdd

You don't do any input validation on the date in argv anywhere, so
--news-release-date=foo-bar would be accepted here, as would
--news-release-date=2020-1-1 without leading zeroes.

I assume the lack of leading zeroes would cause problems at some point
down the road (for example, if we ever try to use the 'date' or
'date_pres' replaceables in a context that actually parses them as
date strings, such as the ?update= parameter to download.cgi).

I suggest instead:

release_date = time.strptime(args.news_release_date, "YYYY-mm-dd") if args.news_release_date else datetime.date.today()
… { 'date': release_date.strftime("YYYYmmdd"),
    'date_pres': release_date.strftime(…) }

Cheers,

Daniel

> +             'date_pres' : release_date,              # format  YYYY-mm-dd
>               'major-minor' : args.version.branch,
>               'version' : str(args.version),
>               'version_base' : args.version.base,
> @@ -1796,6 +1797,9 @@ def main():
>      subparser.set_defaults(func=write_news)
>      subparser.add_argument('--announcement-url',
>                      help='''The URL to the archived announcement email.''')
> +    subparser.add_argument('--news-release-date',
> +                    help='''The release date for the news, as YYYY-MM-DD.
> +                            Default: today.''')
>      subparser.add_argument('--edit-html-file',
>                      help='''Insert the text into this file
>                              news.html, index.html).''')
> 
> 
>