Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Update to python 3.1, is it safe?
View unanswered posts
View posts from last 24 hours

Goto page 1, 2  Next  
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
Kingoftherings
Guru
Guru


Joined: 04 May 2008
Posts: 328

PostPosted: Sun Aug 02, 2009 2:13 am    Post subject: Update to python 3.1, is it safe? Reply with quote

I just noticed Python 3.1 got added to the Portage tree in ~arch.
Is it safe to update to it? Doesn't Python 3.x break compatibility with 2.x applications?

Basically, what I'm asking is that if I update, will all my python stuff break?

http://packages.gentoo.org/package/dev-lang/python
If it breaks compatibility with older python apps, I would think it'd be masked.
Back to top
View user's profile Send private message
michel7
Guru
Guru


Joined: 04 May 2006
Posts: 461
Location: localhost

PostPosted: Sun Aug 02, 2009 2:37 am    Post subject: Reply with quote

i just tried it out and NOTHING works. python3 seems to break portage so dont try it ...
_________________
Software is like sex. It's better when it's free
Back to top
View user's profile Send private message
Kingoftherings
Guru
Guru


Joined: 04 May 2008
Posts: 328

PostPosted: Sun Aug 02, 2009 2:50 am    Post subject: Reply with quote

michel7 wrote:
i just tried it out and NOTHING works. python3 seems to break portage so dont try it ...


Oh that's right, portage uses python. So you can't even downgrade?
Back to top
View user's profile Send private message
michel7
Guru
Guru


Joined: 04 May 2006
Posts: 461
Location: localhost

PostPosted: Sun Aug 02, 2009 3:10 am    Post subject: Reply with quote

python3 is installed in a new SLOT so there is no need to downgrade. you can switch between python2/python3 with eselect ...
_________________
Software is like sex. It's better when it's free
Back to top
View user's profile Send private message
gami
Apprentice
Apprentice


Joined: 02 Jun 2006
Posts: 297

PostPosted: Sun Aug 02, 2009 6:23 am    Post subject: Reply with quote

Python 3.1 is indeed installed in a new slot (like every previous new python minor version). And it is not made the default python on your machine unless you choose to do so yourself with eselect-python. So simply installing Python 3.1 should be safe. If you make it the active version you may encounter problems. Feel free to report those.
Back to top
View user's profile Send private message
poly_poly-man
Advocate
Advocate


Joined: 06 Dec 2006
Posts: 2477
Location: RIT, NY, US

PostPosted: Sun Aug 02, 2009 6:28 am    Post subject: Reply with quote

gami wrote:
Python 3.1 is indeed installed in a new slot (like every previous new python minor version). And it is not made the default python on your machine unless you choose to do so yourself with eselect-python. So simply installing Python 3.1 should be safe. If you make it the active version you may encounter problems. Feel free to report those.
doesn't eselect use python?
_________________
iVBORw0KGgoAAAANSUhEUgAAA

avatar: new version of logo - see topic 838248. Potentially still a WiP.
Back to top
View user's profile Send private message
LukynZ
Apprentice
Apprentice


Joined: 19 Dec 2008
Posts: 230
Location: The Czech Republic

PostPosted: Sun Aug 02, 2009 7:21 am    Post subject: Reply with quote

well yes, it is new slot, but depclean unmerge old one and then is a problem 'cause emerge is in python...
Back to top
View user's profile Send private message
blm
n00b
n00b


Joined: 14 Dec 2005
Posts: 7

PostPosted: Sun Aug 02, 2009 8:38 am    Post subject: Reply with quote

LukynZ wrote:
well yes, it is new slot, but depclean unmerge old one and then is a problem 'cause emerge is in python...


Yes, this is indeed a problem... Not thinking I went ahead and did a depclean and removed python-2.6. I ran eselect to switch to python-3.1 but everything portage related is broken. Anyone have any suggestions on how I can get 3.1 working properly with all the portage utils?

When I run emerge I get the following:

Code:
  File "/usr/bin/emerge", line 41
    except PermissionDenied, e:
                           ^
SyntaxError: invalid syntax


Or if I try to run python-updater, which calls portageq:

Code:
  File "/usr/bin/portageq", line 52
    print "ERROR: insufficient parameters!"
                                          ^
SyntaxError: invalid syntax
* Unable to proceed. Can not find PORTDIR. Make sure the command:

*   portageq portdir
* returns a value. If it doesn't, make sure you have updated to
* latest portage version.

* Report bugs to http://bugs.gentoo.org/


I tried editing emerge and portageq to use /usr/bin/python3.1 instead of the /usr/bin/python wrapper to no avail -- results are the same.
Back to top
View user's profile Send private message
LukynZ
Apprentice
Apprentice


Joined: 19 Dec 2008
Posts: 230
Location: The Czech Republic

PostPosted: Sun Aug 02, 2009 9:39 am    Post subject: Reply with quote

I fix it by downloading python 2.5, configure and make it in my directory, made a link to this directory and emerge normally 2.6, then switch it by eselect to 2.6 and everything is fine
Back to top
View user's profile Send private message
Arfrever
Bodhisattva
Bodhisattva


Joined: 29 Apr 2006
Posts: 2463
Location: 異世界

PostPosted: Sun Aug 02, 2009 5:19 pm    Post subject: Reply with quote

poly_poly-man wrote:
gami wrote:
Python 3.1 is indeed installed in a new slot (like every previous new python minor version). And it is not made the default python on your machine unless you choose to do so yourself with eselect-python. So simply installing Python 3.1 should be safe. If you make it the active version you may encounter problems. Feel free to report those.
doesn't eselect use python?


eselect is written in bash.
Back to top
View user's profile Send private message
Kingoftherings
Guru
Guru


Joined: 04 May 2008
Posts: 328

PostPosted: Sun Aug 02, 2009 6:25 pm    Post subject: Reply with quote

blm wrote:

I tried editing emerge and portageq to use /usr/bin/python3.1 instead of the /usr/bin/python wrapper to no avail -- results are the same.


The problem is that Python 3.x changed the 2.x language syntax. So emerge has to be rewritten to support 3.x.
This is the biggest syntax change:
Code:

Old: print "The answer is", 2*2
New: print("The answer is", 2*2)
Back to top
View user's profile Send private message
mtjm
n00b
n00b


Joined: 25 Nov 2008
Posts: 40
Location: Katowice, Poland

PostPosted: Sun Aug 02, 2009 8:28 pm    Post subject: Reply with quote

Kingoftherings wrote:
The problem is that Python 3.x changed the 2.x language syntax. So emerge has to be rewritten to support 3.x.
This is the biggest syntax change:
Code:

Old: print "The answer is", 2*2
New: print("The answer is", 2*2)

The following works in Python 2.6:
Code:

from __future__ import print_function
print("The answer is", 2*2)


For every program it is possible to make it work with both Python 2.6 and Python 3.0.
Back to top
View user's profile Send private message
Bill Cosby
Guru
Guru


Joined: 22 Jan 2005
Posts: 430
Location: Aachen, Germany

PostPosted: Sun Aug 02, 2009 8:52 pm    Post subject: Reply with quote

I recommend Paludis as a Portage replacement, wasn't it target of attacks because of ABI breakages of C++? :P
_________________
The Creature from Jekyll Island.
Back to top
View user's profile Send private message
Arfrever
Bodhisattva
Bodhisattva


Joined: 29 Apr 2006
Posts: 2463
Location: 異世界

PostPosted: Sun Aug 02, 2009 9:23 pm    Post subject: Reply with quote

mtjm wrote:
Kingoftherings wrote:
The problem is that Python 3.x changed the 2.x language syntax. So emerge has to be rewritten to support 3.x.
This is the biggest syntax change:
Code:

Old: print "The answer is", 2*2
New: print("The answer is", 2*2)

The following works in Python 2.6:
Code:

from __future__ import print_function
print("The answer is", 2*2)


The following works in both Python 3.* and all versions of Python 2.*:
Code:
print("The answer is %s" % (2*2))


Anyway `2to3 -f print` automatically updates call to print().
Back to top
View user's profile Send private message
Kingoftherings
Guru
Guru


Joined: 04 May 2008
Posts: 328

PostPosted: Sun Aug 02, 2009 10:15 pm    Post subject: Reply with quote

mtjm wrote:
Kingoftherings wrote:
The problem is that Python 3.x changed the 2.x language syntax. So emerge has to be rewritten to support 3.x.
This is the biggest syntax change:
Code:

Old: print "The answer is", 2*2
New: print("The answer is", 2*2)

The following works in Python 2.6:
Code:

from __future__ import print_function
print("The answer is", 2*2)


For every program it is possible to make it work with both Python 2.6 and Python 3.0.


Yeah you're right, but the point being that there are changes that don't work in 2.6.
Back to top
View user's profile Send private message
Naib
Watchman
Watchman


Joined: 21 May 2004
Posts: 6051
Location: Removed by Neddy

PostPosted: Sun Aug 02, 2009 10:52 pm    Post subject: Reply with quote

python3 is slotted alongside python2.5 and python2.6
There is already a patchset for portage for it to work with python3

so just don't emerge -C python-2.x just yet (prob won't be feasable till Q2 next year in all honesty and even then some scripts will still rely on a py2.x runtime for a while like plone which only works with py2.4)
if you did you can grab the patchsets from the gentoo python testing overlay and manually add them if you have fubar'ed yr setup :D

I am guessing this is just to get it into the tree (since it does work well, be it with nothing else since nothing else has been ported ;) ) so that as more and more support libs are converted over moving to py3 will be easy in gentoo
_________________
Quote:
Removed by Chiitoo


Last edited by Naib on Mon Aug 03, 2009 1:35 am; edited 1 time in total
Back to top
View user's profile Send private message
Naib
Watchman
Watchman


Joined: 21 May 2004
Posts: 6051
Location: Removed by Neddy

PostPosted: Sun Aug 02, 2009 11:10 pm    Post subject: Reply with quote

Kingoftherings wrote:
blm wrote:

I tried editing emerge and portageq to use /usr/bin/python3.1 instead of the /usr/bin/python wrapper to no avail -- results are the same.


The problem is that Python 3.x changed the 2.x language syntax. So emerge has to be rewritten to support 3.x.
This is the biggest syntax change:
Code:

Old: print "The answer is", 2*2
New: print("The answer is", 2*2)


print is the biggest breakage since it is a keyword -> function change but it isn't the worst (that can easily be fixed via a sed)
how strings are formatted is a bigger syntax change in my opinion

tbf py2.x -> py3 isn't as bad as the noise is making out. It isn't the 1st time python have broken backwards compatibility, I was bitten py2.3 -> py2.4 when they removed means to access the list being constructed within the list-comprehension, its just this time round there are some bigger syntax changes
_________________
Quote:
Removed by Chiitoo
Back to top
View user's profile Send private message
blm
n00b
n00b


Joined: 14 Dec 2005
Posts: 7

PostPosted: Mon Aug 03, 2009 1:04 am    Post subject: Reply with quote

Doing a manual build of python 2.6 (making sure to install it in a good place!) from source was the easiest thing for me. I just had to edit /usr/bin/emerge and /usr/bin/ebuild to use this installation so I could properly emerge python 2.6 and get it slotted alongside the new 3.1. Thanks for the advice to those who replied!
Back to top
View user's profile Send private message
mtjm
n00b
n00b


Joined: 25 Nov 2008
Posts: 40
Location: Katowice, Poland

PostPosted: Mon Aug 03, 2009 8:12 am    Post subject: Reply with quote

Naib wrote:
tbf py2.x -> py3 isn't as bad as the noise is making out. It isn't the 1st time python have broken backwards compatibility, I was bitten py2.3 -> py2.4 when they removed means to access the list being constructed within the list-comprehension, its just this time round there are some bigger syntax changes

2.4, 2.5 and 2.6 all required porting of some programs. The Plone CMS still uses Python 2.4. For Python 3 just some more changes are done, some of them are removal of features having better alternatives since 2.4 or earlier.
Back to top
View user's profile Send private message
ebichu
Apprentice
Apprentice


Joined: 03 Jul 2002
Posts: 231
Location: Manchester, England

PostPosted: Mon Aug 03, 2009 1:16 pm    Post subject: Reply with quote

I have python 3.1 and 2.6 installed nicely. I take it it isn't safe a good idea to run 'python-updater' yet due to backwards incompatibilities? Anyway, I tried python-updater (version 0.7) in '--pretend' mode and it wanted to "upgrade" from 3.1 to 2.6 (!) but didn't find any packages that needed to be reemerged.
_________________
Ebichu wa chiizu ga daisuki dechu!
Back to top
View user's profile Send private message
Naib
Watchman
Watchman


Joined: 21 May 2004
Posts: 6051
Location: Removed by Neddy

PostPosted: Mon Aug 03, 2009 1:22 pm    Post subject: Reply with quote

make sure : eselect python list is set to py2.6 (python are going for a python wrapper script for multABI compat mode via EPYTHON variable)

python-updater would only work if you changed the eselect python setting tho
_________________
Quote:
Removed by Chiitoo
Back to top
View user's profile Send private message
ebichu
Apprentice
Apprentice


Joined: 03 Jul 2002
Posts: 231
Location: Manchester, England

PostPosted: Mon Aug 03, 2009 1:31 pm    Post subject: Reply with quote

Naib wrote:
make sure : eselect python list is set to py2.6 (python are going for a python wrapper script for multABI compat mode via EPYTHON variable)

python-updater would only work if you changed the eselect python setting tho

Thanks, I forgot python-updater updates to the 'currently selected' version, not the 'latest' version. (And don't worry, I won't make 3.1 the current one just yet!)
_________________
Ebichu wa chiizu ga daisuki dechu!
Back to top
View user's profile Send private message
carbonat
n00b
n00b


Joined: 03 Aug 2009
Posts: 1

PostPosted: Mon Aug 03, 2009 1:44 pm    Post subject: Reply with quote

Apple Mac OS X was initially supported in the main Gentoo portage tree with the ppc-macos keyword. The approach taken then, however, resulted in too many problems, which was the drive behind creating Prefixed Portage. Bootstrapping on OS X is relatively simple, as the system itself provides most of the jobs get up to speed quickly. Prefixed Portage is tested and supported on Mac OS X Tiger and Leopard on PPC and x86 architectures. Stellenangebote
Tests on PPC Panther were successful, but the platform itself isn't fully supported any more.
_________________
Stellenmarkt


Last edited by carbonat on Mon Aug 10, 2009 11:02 pm; edited 3 times in total
Back to top
View user's profile Send private message
Mike Hunt
Watchman
Watchman


Joined: 19 Jul 2009
Posts: 5287

PostPosted: Mon Aug 03, 2009 2:01 pm    Post subject: Reply with quote

I like this:
Code:
# cd /usr/portage/profiles/package.mask
# grep -B 2 python ./*
./funtoo-cautionary-# Daniel Robbins <drobbins@funtoo.org> (02 Aug 2009)
./funtoo-cautionary-# let's watch upstream bugs for a bit:
./funtoo-cautionary:>=dev-lang/python-3
Back to top
View user's profile Send private message
pappy_mcfae
Watchman
Watchman


Joined: 27 Dec 2007
Posts: 5999
Location: Pomona, California.

PostPosted: Tue Aug 04, 2009 5:22 am    Post subject: Reply with quote

Somehow, I get the feeling there is wisdom in those words...as in I'm staying with 2.6 until forced to change, or until 3.1-r1. Whenever I change to it, I get errors right off the bat, like python-updater, for example. Portage dies, too, of course.

Blessed be!
Pappy
_________________
This space left intentionally blank, except for these ASCII symbols.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum