jjlee / mechanize

Stateful programmatic web browsing in Python, after Andy Lester's Perl module WWW::Mechanize .
http://wwwsearch.sourceforge.net/mechanize/
618 stars 121 forks source link

setuptool install broken #39

Closed alexgarel closed 13 years ago

alexgarel commented 13 years ago

setuptools install of mechanize is broken (whereas pip works)

Facts :

$ man virtualenv 
$ virtualenv --setuptools test
New python executable in test/bin/python
Installing setuptools............done.
$ cd test/
$ . bin/activate
(test)$ bin/easy_install mechanize
Searching for mechanize
Reading http://pypi.python.org/simple/mechanize/
Reading http://wwwsearch.sourceforge.net/mechanize/
Best match: mechanize 0.2.4
Downloading http://wwwsearch.sourceforge.net/mechanize/src/mechanize-0.2.4.tar.gz
Traceback (most recent call last):
  File "bin/easy_install", line 8, in <module>
    load_entry_point('setuptools==0.6c11', 'console_scripts', 'easy_install')()
…
  File "/tmp/test/lib/python2.6/site-packages/setuptools-0.6c11-py2.6.egg/setuptools/package_index.py", line 553, in _download_to
ValueError: invalid literal for int() with base 10: '382727, 382727'

After investigating it seems that setuptools use dowload url on pypi page (whereas pip use archives hosted on pypi). It fails when checking Content-Length sent by http://wwwsearch.sourceforge.net/mechanize/src/mechanize-0.2.4.tar.gz which is repeated two times and given to setuptool as a tuple (and setuptool expect an int) :

$ curl -D - http://wwwsearch.sourceforge.net/mechanize/src/mechanize-0.2.4.tar.gz -o /tmp/tmp.tar.gz
Server: Apache/2.2.3 (CentOS)
Last-Modified: Thu, 28 Oct 2010 20:57:05 GMT
ETag: "5d707-493b395976a40"
Content-Length: 382727                                             <-----
Expires: Sat, 02 Apr 2011 07:41:43 GMT
Content-Type: application/x-gzip
Content-Length: 382727                                             <-----
Date: Thu, 31 Mar 2011 07:41:43 GMT
X-Varnish: 58847923
Age: 0
Via: 1.1 varnish
Connection: keep-alive
alexgarel commented 13 years ago

Note setuptools is on the way of correcting it : http://bugs.python.org/setuptools/issue123

jjlee commented 13 years ago

How strange. Could it be that SF is trying to discourage use of project web hosting to host release packages, by breaking files that are too large?? I think you're supposed to use their file release system, so I'm being a bit naughty by ignoring it. Seems unlikely though!

Thanks for letting me know -- maybe I'll change the links to point to PyPI...

jjlee commented 13 years ago

Sourceforge is returning invalid HTTP responses, move to PyPI

Point download URLs to PyPI instead of SF, since SF has started returning bogus Content-Length headers, breaking setuptools' easy_install command :-/

http://bugs.python.org/setuptools/issue123

Still put the built files on SF -- just don't link to them.

Closed by 062557503478c35c58f79fa0cf1462f92ff71c75