Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Python versions
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Portage & Programming
View previous topic :: View next topic  
Author Message
Princess Nell
l33t
l33t


Joined: 15 Apr 2005
Posts: 916

PostPosted: Sun Jun 23, 2013 4:51 pm    Post subject: Python versions Reply with quote

Is there any generic configuration that allows running a given python prog with a python version other than the system default? On my system, both python 2 and 3 are installed, 3 is the default, but there is some software in portage that doesn't seem like python3 and will probably never get fixed. Sure, editing the launcher to use python2 instead of python is possible, but will be overridden next time the port is re-emerged.

The software in question is games-arcade/solarwolf.
Code:

SyntaxError: invalid syntax
  File "./solarwolf.py", line 42
    print 'Pychecker Enabled'


Of course, it may be possible to patch the ebuild and make python2 a requirement.
Back to top
View user's profile Send private message
TomWij
Retired Dev
Retired Dev


Joined: 04 Jul 2012
Posts: 1553

PostPosted: Sun Jun 23, 2013 7:26 pm    Post subject: Reply with quote

Let's say you want a specific package CATEGORY/PKG to use 2.7; create a file /etc/portage/env/python2.7 and set PYTHON_TARGETS="python2_7" and PYTHON_SINGLE_TARGET="python2_7" in it, then add another file /etc/portage/package.env with as content CATEGORY/PKG python2.7 which will cause that package to use Python 2.7. This will cause the emerge to set the right shebang upon emerge. For more details on these configuration files, see `man portage`.
Back to top
View user's profile Send private message
dol-sen
Retired Dev
Retired Dev


Joined: 30 Jun 2002
Posts: 2805
Location: Richmond, BC, Canada

PostPosted: Sun Jun 23, 2013 10:22 pm    Post subject: Reply with quote

Forgive me Tom, but that seems like the hard way. You can set the python flags in package.use to override the PYTHON_TARGETS setting in make.conf

/etc/portage/package.use:
cat-egory/pkg -python_targets_2_6 -python_targets_3_2 python_targets_2_7

_________________
Brian
Porthole, the Portage GUI frontend irc@freenode: #gentoo-guis, #porthole, Blog
layman, gentoolkit, CoreBuilder, esearch...
Back to top
View user's profile Send private message
TomWij
Retired Dev
Retired Dev


Joined: 04 Jul 2012
Posts: 1553

PostPosted: Sun Jun 23, 2013 10:56 pm    Post subject: Reply with quote

Depends on whether you want to set it only once and be able to apply it to multiple packages or whether you want to keep changing it as new Python versions come and apply it to a single package, each approach has its (dis)advantages.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Portage & Programming All times are GMT
Page 1 of 1

 
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