Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify rustbuild Rust beta downloading. #36666

Conversation

frewsxcv
Copy link
Member

@frewsxcv frewsxcv commented Sep 23, 2016

No need to shell out to curl or WebClient when we can just use the
urllib2 library built
into Python.

@rust-highfive
Copy link
Collaborator

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @alexcrichton (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

Please see the contribution instructions for more information.

@frewsxcv frewsxcv force-pushed the simplify-rustbuild-bootstrap-download branch from 079b0bd to 1a06546 Compare September 23, 2016 03:56
@@ -18,6 +18,7 @@
import sys
import tarfile
import tempfile
import urllib2
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No the urllib2 module is Python 2-only, considering #36509 just landed a week ago I think we should only use Py3k-compatible modules from now on.

This should be enough without introducing six as an additional dep:

try:
    from urllib2 import urlopen
except ImportError:
    from urllib.request import urlopen

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, didn't realize we supported Python 3, great! Will make the change.

No need to shell out to curl or WebClient when we can just use the
urllib2 library built into Python.
@frewsxcv frewsxcv force-pushed the simplify-rustbuild-bootstrap-download branch from 1a06546 to 374ace4 Compare September 23, 2016 13:01
@sanxiyn
Copy link
Member

sanxiyn commented Sep 26, 2016

Note that pre-2.7.9 Python does not verify SSL certificates, but curl and WebClient do. Maybe we should warn on old versions of Python?

@alexcrichton
Copy link
Member

Thanks for the PR! This was originally done in Cargo as well (where much of this is from) but was reverted for a few reasons:

  • urlllib doesn't have proxy support, but curl does
  • Python 2/3 compat (looks like that's handled here though)
  • Spotty support for https in python, including SNI and such

Since this is intended to be "the most robust method of downloading we can find" it may not be super necessary to unify everywhere (it seems to work well today). For me the lack of proxy plus the spotty support for https in python is a bit of a deal breaker :(

@frewsxcv
Copy link
Member Author

Yeah, thought about @sanxiyn's comment this morning and agree this is probably not a desired change. From what I've heard, Python 2.7.9 > n >= 2.7.0 (very unfortunately) still gets used quite a bit in industry, which results in security issues when using urllib2.

@frewsxcv frewsxcv closed this Sep 26, 2016
@frewsxcv frewsxcv deleted the simplify-rustbuild-bootstrap-download branch September 26, 2016 16:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants