View previous topic :: View next topic |
Author |
Message |
Princess Nell l33t
Joined: 15 Apr 2005 Posts: 916
|
Posted: Sun Jun 23, 2013 4:51 pm Post subject: Python versions |
|
|
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 |
|
|
TomWij Retired Dev
Joined: 04 Jul 2012 Posts: 1553
|
Posted: Sun Jun 23, 2013 7:26 pm Post subject: |
|
|
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 |
|
|
dol-sen Retired Dev
Joined: 30 Jun 2002 Posts: 2805 Location: Richmond, BC, Canada
|
Posted: Sun Jun 23, 2013 10:22 pm Post subject: |
|
|
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 |
|
|
TomWij Retired Dev
Joined: 04 Jul 2012 Posts: 1553
|
Posted: Sun Jun 23, 2013 10:56 pm Post subject: |
|
|
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 |
|
|
|