classification
Title: The license url in site.py should always use X.Y.Z form of version number
Type: behavior Stage: resolved
Components: Documentation, Library (Lib) Versions: Python 3.3, Python 3.4
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: docs@python Nosy List: berker.peksag, demian.brecht, docs@python, georg.brandl, larry, orsenthil, py.user, python-dev, r.david.murray
Priority: normal Keywords: easy, patch

Created on 2013-06-13 22:29 by py.user, last changed 2013-09-14 18:00 by orsenthil. This issue is now closed.

Files
File name Uploaded Description Edit
issue18206.diff berker.peksag, 2013-06-17 16:59 review
issue18206_test.diff py.user, 2013-07-03 07:41 review
Messages (13)
msg191095 - (view) Author: py.user (py.user) * Date: 2013-06-13 22:29
[guest@localhost ~]$ python3
Python 3.3.0 (default, Sep 29 2012, 22:07:38)
[GCC 4.7.2 20120921 (Red Hat 4.7.2-2)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> license()
See http://www.python.org/3.3/license.html
>>>

404


answer from webmaster@python.org:

Hello,

When I use the version of Python distributed by python.org and type "license()" I get the full license text and not the url.

It seems like this might be a change made by Red Hat? Either way, the proper place to discuss issues like this is on the Python bug tracker:

	http://bugs.python.org/

Feel free to report an issue there and the developers can look at it.

This email address is actually for reporting problems with the Python.org website!

All the best,

Michael Foord



in Lib/site.py:
[guest@localhost cpython]$ sed -n '453,456p' Lib/site.py
    builtins.license = _Printer(
        "license", "See http://www.python.org/%.3s/license.html" % sys.version,
        ["LICENSE.txt", "LICENSE"],
        [os.path.join(here, os.pardir), here, os.curdir])
[guest@localhost cpython]$
msg191096 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2013-06-13 22:52
This broke because we now have release 3.3.0 instead of 3.3.
But it's easy to add a redirect, which I've done now.

In the future, site.py should be fixed to say 3.3.0 or 3.3.X depending on the current bugfix version.
msg191097 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2013-06-13 23:26
For anyone who wants to work on this: the license URL is printed if only if the license file can't be found.
msg191642 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2013-06-22 14:41
It would be nice to add a test (guarded by the network resource) that checks that the generated url in license is not a 404.  Would you be interested in tackling that, Berker?
msg197186 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2013-09-07 21:13
New changeset a723adeb1f47 by Senthil Kumaran in branch '3.3':
Fix License URL display and add test to check for license url presence.
http://hg.python.org/cpython/rev/a723adeb1f47

New changeset 12aaf64feca2 by Senthil Kumaran in branch 'default':
merge from 3.3
http://hg.python.org/cpython/rev/12aaf64feca2
msg197187 - (view) Author: Senthil Kumaran (orsenthil) * (Python committer) Date: 2013-09-07 21:16
Fixed in the 3.3 and 3.4.

3.3 - changeset a723adeb1f47
3.4 - changeset 12aaf64feca2
3.4 - (Fixed a merge conflict) changeset 6ecdf2b3192b
msg197630 - (view) Author: py.user (py.user) * Date: 2013-09-13 19:13
Senthil Kumaran changed the pattern

from: r'^See (http://www\.python\.org/[^/]+/license.html)$'
  to: r'^See (http://www\.python\.org/download/releases/[^/]+/license/)$'

test doesn't pass

[guest@localhost cpython]$ ./python
Python 3.4.0a2+ (default, Sep 14 2013, 05:56:46) 
[GCC 4.7.2 20121109 (Red Hat 4.7.2-8)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> license()
See http://www.python.org/3.4/license.html
>>>


make test
...
[265/380/3] test_site
test test_site failed -- Traceback (most recent call last):
  File "/home/guest/tmp/tests/misc/git/example/cpython/Lib/test/test_site.py", line 416, in test_license_page
    self.assertIsNotNone(mo, msg='can\'t find appropriate url in license')
AssertionError: unexpectedly None : can't find appropriate url in license
...
msg197664 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2013-09-13 21:13
The test needs to be fixed so that it runs even when the LICENSE file exists. (It is also missing the skip when the network resource is not asserted.)  I have a patched test, and a fix for the 3.4 problem, but I can't apply it because the 3.4.0 license file does not yet exist on the website.

On the other hand, this test could be a pain before the first alpha is released (the web URL doesn't exist yet), so perhaps the test also needs to special case that somehow.
msg197677 - (view) Author: py.user (py.user) * Date: 2013-09-13 23:33
R. David Murray wrote:

>It is also missing the skip when the network resource is not asserted.

How it connects, I copied from another python tests.
The test was skipped without network connection.

"support.requires('network')" ?

>the 3.4.0 license file does not yet exist on the website

http://www.python.org/download/releases/3.4.0/license/
opens

>The test needs to be fixed so that it runs even when the LICENSE file exists.

The fixture can rename it back and forth.
msg197678 - (view) Author: py.user (py.user) * Date: 2013-09-13 23:38
The patch needs to be compatible with version 2.7
Now there urllib.request is importing only.
msg197720 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2013-09-14 17:32
New changeset 7c18b799841e by R David Murray in branch '3.3':
#18206: Fix test for existence of license URL.
http://hg.python.org/cpython/rev/7c18b799841e

New changeset 321c3c9cd1b5 by R David Murray in branch 'default':
Merge #18206: Fix test for existence of license URL.
http://hg.python.org/cpython/rev/321c3c9cd1b5

New changeset 9354325d2ee4 by R David Murray in branch 'default':
#18206: Re-fix license URL.
http://hg.python.org/cpython/rev/9354325d2ee4
msg197721 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2013-09-14 17:38
You are right, there was a further typo in the 3.4 URL that I missed.

Yes, requires_resource('network') is what I was referring to (though using transient_internet is also a very good idea :).  I also changed the urllib call to only do a HEAD request.  No need to rename the LICENSE file, I just pulled the info out of the data structure.  It's a white box test, but then so is parsing the "See" line at all, so I think it is acceptable.

(I wonder if it would be worthwhile to have transient_internet call requires_resource('network')?)
msg197724 - (view) Author: Senthil Kumaran (orsenthil) * (Python committer) Date: 2013-09-14 18:00
Thanks for making these changes (and correcting some of my mistakes), RDM.
They are much better now.

On Sat, Sep 14, 2013 at 10:38 AM, R. David Murray <report@bugs.python.org>wrote:

>
> R. David Murray added the comment:
>
> You are right, there was a further typo in the 3.4 URL that I missed.
>
> Yes, requires_resource('network') is what I was referring to (though using
> transient_internet is also a very good idea :).  I also changed the urllib
> call to only do a HEAD request.  No need to rename the LICENSE file, I just
> pulled the info out of the data structure.  It's a white box test, but then
> so is parsing the "See" line at all, so I think it is acceptable.
>
> (I wonder if it would be worthwhile to have transient_internet call
> requires_resource('network')?)
>
> ----------
> status: open -> closed
>
> _______________________________________
> Python tracker <report@bugs.python.org>
> <http://bugs.python.org/issue18206>
> _______________________________________
>
History
Date User Action Args
2013-09-14 18:00:15orsenthilsetmessages: + msg197724
2013-09-14 17:38:39r.david.murraysetstatus: open -> closed

messages: + msg197721
2013-09-14 17:32:13python-devsetmessages: + msg197720
2013-09-13 23:38:31py.usersetmessages: + msg197678
2013-09-13 23:34:40py.usersettitle: license url in site.py should always use X.Y.Z form of version number -> The license url in site.py should always use X.Y.Z form of version number
2013-09-13 23:33:02py.usersetmessages: + msg197677
2013-09-13 21:13:42r.david.murraysetstatus: pending -> open
nosy: + larry
messages: + msg197664

2013-09-13 19:20:53py.usersetstatus: closed -> pending
2013-09-13 19:13:44py.usersetmessages: + msg197630
2013-09-07 21:16:06orsenthilsetstatus: open -> closed

nosy: + orsenthil
messages: + msg197187

resolution: fixed
stage: patch review -> resolved
2013-09-07 21:13:20python-devsetnosy: + python-dev
messages: + msg197186
2013-07-03 07:41:02py.usersetfiles: + issue18206_test.diff
2013-06-29 19:22:50demian.brechtsetnosy: + demian.brecht
2013-06-22 14:41:55r.david.murraysetmessages: + msg191642
2013-06-17 16:59:24berker.peksagsetfiles: + issue18206.diff
nosy: + berker.peksag

keywords: + patch
stage: needs patch -> patch review
2013-06-13 23:26:02r.david.murraysettitle: There is no license.html on www.python.org -> license url in site.py should always use X.Y.Z form of version number

keywords: + easy
nosy: + r.david.murray
versions: + Python 3.4
messages: + msg191097
stage: needs patch
2013-06-13 22:52:34georg.brandlsetmessages: + msg191096
2013-06-13 22:30:25vstinnersetnosy: + georg.brandl
2013-06-13 22:29:20py.usercreate