Opened 8 years ago
Closed 7 years ago
#16080 closed enhancement (fixed)
Python 3 preparation: Handle the renaming of "urllib" and "urllib2"
Reported by:  wluebbe  Owned by:  

Priority:  major  Milestone:  sage6.10 
Component:  distribution  Keywords:  python3 
Cc:  Merged in:  
Authors:  Frédéric Chapoton  Reviewers:  Volker Braun, R. Andrew Ohana 
Report Upstream:  N/A  Work issues:  
Branch:  3098f5f (Commits, GitHub, GitLab)  Commit:  3098f5fa5eecfff7fae914b99964831ab01d3d4f 
Dependencies:  Stopgaps: 
Description
The tool 2to3 changes the respective import statements to the new Py3 names.
But the code has to depend on the Python version!
There are 16 effected modules.
This ticket is tracked as a dependency of metaticket ticket:16052.
Change History (18)
comment:1 Changed 8 years ago by
 Milestone changed from sage6.2 to sage6.3
comment:2 Changed 8 years ago by
 Milestone changed from sage6.3 to sage6.4
comment:3 Changed 7 years ago by
 Branch set to public/16080
 Commit set to c9f3a9882700609ea007846211b79f02287864ed
 Milestone changed from sage6.4 to sage6.10
 Status changed from new to needs_review
comment:4 Changed 7 years ago by
 Commit changed from c9f3a9882700609ea007846211b79f02287864ed to ab05e0685d4b654bac10348e9f3b795713f0d14a
Branch pushed to git repo; I updated commit sha1. New commits:
ab05e06  trac #16080 correct one doctest

comment:5 Changed 7 years ago by
 Commit changed from ab05e0685d4b654bac10348e9f3b795713f0d14a to 3ac77d397fb2e1a8cab3cfe049e88fc3b8a2716b
Branch pushed to git repo; I updated commit sha1. New commits:
3ac77d3  trac #16080 move back 3 imports inside functions

comment:6 Changed 7 years ago by
Could you use six.moves.urllib
instead? We already include six as a standard package, so it is fine to use it.
comment:7 Changed 7 years ago by
+1 to six.moves.urlib. Rest is great!
comment:8 Changed 7 years ago by
I was using this page
http://python3porting.com/stdlib.html
as a reference, and it says that six could not handle urllib. Maybe this is outdated ?
Do we really gain something by using six instead of the "try except" ? In other words, do you really want me to spend more time on that ? I may have other things to do.
comment:9 Changed 7 years ago by
 Commit changed from 3ac77d397fb2e1a8cab3cfe049e88fc3b8a2716b to 99699f60ccb23c01102f3d6dd4251449d840bdb1
Branch pushed to git repo; I updated commit sha1. New commits:
99699f6  trac #16080 now redone using six.moves

comment:10 Changed 7 years ago by
 Reviewers set to Volker Braun, R. Andrew Ohana
 Status changed from needs_review to positive_review
comment:11 Changed 7 years ago by
 Status changed from positive_review to needs_work
merge conflict, probably with #19296
comment:12 Changed 7 years ago by
This does not work. Maybe we need to update six. Or maybe my initial solution was better.
comment:13 Changed 7 years ago by
 Commit changed from 99699f60ccb23c01102f3d6dd4251449d840bdb1 to f848c3b3d283126b5238cafae7228095036a160d
Branch pushed to git repo; I updated commit sha1. New commits:
f848c3b  trac #16080 correcting some imports

comment:14 Changed 7 years ago by
 Commit changed from f848c3b3d283126b5238cafae7228095036a160d to 3098f5fa5eecfff7fae914b99964831ab01d3d4f
Branch pushed to git repo; I updated commit sha1. New commits:
3098f5f  Merge branch 'public/16080' into 6.10.b5

comment:15 Changed 7 years ago by
 Status changed from needs_work to needs_review
Better wait for the bot's green light before setting back to positive review.
comment:16 Changed 7 years ago by
ok, seems to be good to go. Volker, do you approve ?
comment:17 Changed 7 years ago by
 Status changed from needs_review to positive_review
comment:18 Changed 7 years ago by
 Branch changed from public/16080 to 3098f5fa5eecfff7fae914b99964831ab01d3d4f
 Resolution set to fixed
 Status changed from positive_review to closed
New commits:
trac #16080 changing imports of urllib,urrlib2,urlparse for py3 compatibility