jakesylvestre / pychess

Automatically exported from code.google.com/p/pychess
GNU General Public License v3.0
1 stars 7 forks source link

PyChess hard-codes /usr/bin/python #661

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Alexandru Moșoi reported on pychess-people that PyChess won't work on a 
distribution where "python" defaults to Python 3.x (notably Arch Linux).

His proposed patch is here: 
https://code.google.com/r/alexandru-pychess/source/detail?r=1f2aaff3de05b08d58aa
6e15b0e0f9caba290ed8#

Original issue reported on code.google.com by Uncombed...@gmail.com on 29 Mar 2011 at 1:39

GoogleCodeExporter commented 9 years ago
This patch may be too forward-thinking.
PEP 394 is less than a month old.
As of 1 March, many major distros don't have the python2 symlink.
On most distros, "python" is a 2.x version. (It "should" be, under 394).

We should at least use #!/usr/bin/env python in the shebang lines.

Arch's PKGBUILD system is lovely. 
One "spaghetti" line in pychess-hg's (just before running setup.py) should fix 
the issue downstream, even if we change the lines:
find "$srcdir/$_hgrepo-build" -type f -perm /a=x -exec sed 
's@^#!.*python\>@#!/usr/bin/env python2@' '{}' +

If anyone knows distutils well, it would be great to have setup.py change the 
#! lines. Then they can default to #!/usr/bin/env python2 in the source. It's 
OK to force developers to figure out how to make the symlink. :)

Original comment by Uncombed...@gmail.com on 29 Mar 2011 at 1:57

GoogleCodeExporter commented 9 years ago
On Wed, Apr 4, 2012 at 7:00 PM, Martti Kühne <mysatyre@gmail.com> wrote:

    hello there

    tried pychess on archlinux today, it's a great tool.
    found your e-mail address on code.google.com, because my pychess kept breaking
    when a game was finished, the yellow buttons wouldn't work.

    what went wrong? the message I got was this:

    Traceback (most recent call last):
     File "/usr/lib/python2.7/site-packages/pychess/widgets/gamenanny.py", line 113, in cb
       createRematch(gamemodel)
     File "/usr/lib/python2.7/site-packages/pychess/widgets/newGameDialog.py", line 566, in createRematch
       xmlengine = discoverer.getEngines()[binname]
    KeyError: 'python2'

    what's up with my python?

    python development changed the binary's names to python2 and python3
    respectively, for the time as long as both are around.

    I suggest changing these two lines in newGameDialog.py:

    [patch]
    --- abs/pychess/pkg/usr/lib/python2.7/site-packages/pychess/widgets/newGameDialog.py2011-12-31 19:57:48.000000000 +0100
    +++ /usr/lib/python2.7/site-packages/pychess/widgets/newGameDialog.py2012-04-04 13:45:32.919915526 +0200
    @@ -561,7 +561,7 @@
                player0tup = (bp.__type__, bp.__class__, (WHITE, repr(wp)), repr(bp))
            else:
                binname = bp.engine.path.split("/")[-1]
    -            if binname == "python":
    +            if binname.find("python") == 0:
                    binname = bp.engine.args[1].split("/")[-1]
                xmlengine = discoverer.getEngines()[binname]
                player0tup = (ARTIFICIAL, discoverer.initPlayerEngine,
    @@ -570,7 +570,7 @@
        else:
            player0tup = (bp.__type__, bp.__class__, (WHITE, ""), repr(bp))
            binname = wp.engine.path.split("/")[-1]
    -        if binname == "python":
    +        if binname.find("python") == 0:
                binname = wp.engine.args[1].split("/")[-1]
            xmlengine = discoverer.getEngines()[binname]
            player1tup = (ARTIFICIAL, discoverer.initPlayerEngine,
    [/patch]

    cheers!
    mar77i

Original comment by gbtami on 8 Apr 2012 at 7:43

GoogleCodeExporter commented 9 years ago
This issue was closed by revision bc4a450d6f71.

Original comment by gbtami on 21 Jun 2012 at 5:59