After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 382057 - assumed paths in python files
assumed paths in python files
Status: RESOLVED FIXED
Product: gnome-games-superseded
Classification: Deprecated
Component: general
unspecified
Other Mac OS
: High normal
: ---
Assigned To: GNOME Games maintainers
GNOME Games maintainers
: 376696 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2006-12-03 22:42 UTC by paul
Modified: 2006-12-10 10:05 UTC
See Also:
GNOME target: ---
GNOME version: 2.17/2.18


Attachments
generate sys.path.append at build time (4.09 KB, patch)
2006-12-05 09:30 UTC, paul
none Details | Review
spaces vs. tabs (4.09 KB, patch)
2006-12-05 10:28 UTC, paul
none Details | Review

Description paul 2006-12-03 22:42:32 UTC
paths in the python programs bundled in gnome-games assumes files are installed prefix = /usr

    sys.path.append('/usr/share/glchess/')
    sys.path.append('/usr/share/gnome-sudoku/')

suggest glchess.in and gnome-sudoko.in files with some 

    sys.path.insert('@pythondir@')

sed "s,@pythondir@,whateverpythoninstallpath,g" < $file.in > $(bindir)/$file
Comment 1 paul 2006-12-03 23:00:31 UTC
i guess it'd only need to be

sys.path.insert('@prefix@/glchess/')

sed 's,@prefix@,/opt/local,g' < glchess.in > $(bindir)/glchess
Comment 2 Andreas Røsdal 2006-12-04 21:50:00 UTC
*** Bug 376696 has been marked as a duplicate of this bug. ***
Comment 3 Andreas Røsdal 2006-12-04 21:52:45 UTC
Hello again Paul! 

This really needs to be fixed, so it's great if you could help us out with it. Could you please submit a patch?
Comment 4 paul 2006-12-05 09:30:34 UTC
Created attachment 77714 [details] [review]
generate sys.path.append at build time

hi, andreas

i hope this patch is up to par
my automake experiences are few and far between
Comment 5 paul 2006-12-05 10:28:44 UTC
Created attachment 77720 [details] [review]
spaces vs. tabs

ignore that last one,
Makefile:623: *** missing separator (did you mean TAB instead of 8 spaces?).  Stop.
XD
Comment 6 Andreas Røsdal 2006-12-09 11:54:22 UTC
Paul, your patch is not working. Have you tested it using make install?
The generated glchess and gnome-sudoku files are incorrect. 
Also, you shouldn't use sed to perform replacements.
Comment 7 Andreas Røsdal 2006-12-09 13:00:43 UTC
There is also the file defaults.py.in for both Python games, which should be used instead.
Comment 8 Andreas Røsdal 2006-12-09 17:25:55 UTC
I finally found out how to fix this bug based on your patch. Thanks a lot!
Comment 9 paul 2006-12-10 01:07:53 UTC
yeah, i just realized i overlooked the fact that i keep PYTHONPATH set in my shell environment

but when unset, the newly installed glchess errors out with

Traceback (most recent call last):
  • File "/opt/local/bin/glchess", line 10 in ?
    from glchess.glchess import start_game
ImportError: No module named glchess.glchess
[4224 refs]

because pyexecdir in the glchess file that's created by config.status expands to
 
${exec_prefix}/lib/python2.4/site-packages

unfortunately, my system doesnt expand that ${exec_prefix}

also, when builddir != srcdir, if i was to delete the funky one generated by config.status and let the makefile generate it...

Makefile:626: warning: overriding commands for target `glchess'
Makefile:318: warning: ignoring old commands for target `glchess'
sed \
-e "s|\@pyexecdir\@|/opt/local/lib/python2.4/site-packages|" \
        glchess.in > glchess
sed: glchess.in: No such file or directory
make[1]: *** [glchess] Error 1

so, i think that glchess/src/glchess and gnome-sudoku/src/gnome-sudoku need to be removed from AC_CONFIG_FILES in configure.in, along with glchess/src/Makefile.am and gnome-sudoku/src/Makefile.am needing $(srcdir) prefixed to the input file paths

Comment 10 paul 2006-12-10 01:50:27 UTC
also, gnome-sudoku with the proper pyexecdir still needs to load the datarootdir/gnome-sudoku directory for the glade files, else...

Traceback (most recent call last):
  • File "/opt/local/bin/gnome-sudoku", line 14 in ?
    start_game()
  • File "./lib/python2.4/site-packages/gnome_sudoku/gnome_sudoku.py", line 928 in start_game
  • File "./lib/python2.4/site-packages/gnome_sudoku/gnome_sudoku.py", line 338 in __init__
  • File "./lib/python2.4/site-packages/gnome_sudoku/sudoku_maker.py", line 312 in __init__
  • File "./lib/python2.4/site-packages/gnome_sudoku/sudoku_maker.py", line 397 in load
  • File "/usr/lib/python2.4/pickle.py", line 1390 in load
    return Unpickler(file).load()
  • File "/usr/lib/python2.4/pickle.py", line 872 in load
    dispatch[key](self)
  • File "/usr/lib/python2.4/pickle.py", line 894 in load_eof
    raise EOFError EOFError [118762 refs]

Comment 11 paul 2006-12-10 01:59:23 UTC
i could be wrong on that last one
Comment 12 Andreas Røsdal 2006-12-10 10:05:37 UTC
I applied the changes mentioned in comment #9. If you get any errors, please submit a patch.  http://webcvs.freedesktop.org/gstreamer/gst-python/ can be a good starting point for more info.