GTG

setup.py imports GTK

Bug #401254 reported by Jonathan Lange
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
GTG
Fix Released
Medium
Unassigned

Bug Description

bochecha on IRC reported that setup.py fails when running 'install'. This makes it _very_ hard for GTG to be packaged reliably into an RPM.

Here's the error:

http://fpaste.org/paste/19136

   1. + python setup.py install
   2. Traceback (most recent call last):
   3. File "setup.py", line 26, in <module>
   4. import GTG
   5. File "/home/mathieu/Fedora/rpmbuild/BUILD/gtg-0.1.2/GTG/__init__.py", line 28, in <module>
   6. from gtk import glade
   7. File "/usr/lib64/python2.6/site-packages/gtk-2.0/gtk/__init__.py", line 79, in <module>
   8. _
   9. File "/usr/lib64/python2.6/site-packages/gtk-2.0/gtk/__init__.py", line 67, in _init
  10. _gtk.init_check()
  11. RuntimeError: could not open display

The problem is that setup.py imports GTG (which is ok, I guess), but GTG imports gtk and gtk needs a running X server. It's a bug that you need to have a running X to install GTG.

Changed in gtg:
importance: Undecided → Medium
milestone: none → 0.2
status: New → Confirmed
Changed in gtg:
assignee: nobody → Lionel Dricot (ploum)
status: Confirmed → In Progress
Revision history for this message
Mathieu Bridon (bochecha) wrote :

Thanks Jonathan for reporting it, I just opened my Launchpad account 5 minutes ago :)

« This makes it _very_ hard for GTG to be packaged reliably into an RPM. »

This might be nit-picking, but it is actually inaccurate:
- it is not « very hard », it is « totally impossible » ^^'
- this issues shows up on Fedora only it seems, not on all RPM-based OSes.

After some investigation, this is due to this patch that we use in our pygtk package: http://cvs.fedoraproject.org/viewvc/devel/pygtk2/pygtk-nodisplay-exception.patch?view=markup

Thanks a lot for considering this as an issue in GTG. Let me know if there's some particular bazaar commit that I can try to see if that fixes it.

Revision history for this message
Lionel Dricot (ploum-deactivatedaccount) wrote :

Should be fixed with rev. 283.

Mathieu, could you please test it ?

Changed in gtg:
status: In Progress → Fix Committed
Revision history for this message
Mathieu Bridon (bochecha) wrote :

Just tested it.

For the record, and to be absolutely sure I didn't do anything wrong, here is how I tested (based on the instructions at http://live.gnome.org/gtg/ReleaseProcess) :

1. get the latest source:
  $ bzr branch lp:gtg

2. install in a temp folder:
  $ python setup.py install --prefix=~/gtg
Traceback (most recent call last):
  File "setup.py", line 110, in <module>
    description = infor.SHORT_DESCRIPTION,
NameError: name 'infor' is not defined

So I modified line 110 of setup.py to replace « infor.SHORT_DESCRIPTION » by « info.SHORT_DESCRIPTION » and tried again the same command, which succeeded this time.

3. generate the tarball:
  $ python setup.py sdist

4. I then used the dist/gtg-0.1.2.tar.gz archive to create the RPM.

It now fails with the following:
+ python setup.py install
Traceback (most recent call last):
  File "setup.py", line 29, in <module>
    import info
ImportError: No module named info

Looking at the source, it looks like before creating the dist, there is a info.py file in the root of gtg, but it's not in the extracted dist.

So I edited setup.py as follows:
114c114
< scripts=['gtg',],
---
> scripts=['gtg','info.py'],

And generated again the dist, and then used this new archive for building the RPM.

This time it built fine, I'll now try to install and use it to see if I didn't miss some dependency or break something :]

Revision history for this message
Mathieu Bridon (bochecha) wrote :

« I'll now try to install and use it to see if I didn't miss some dependency or break something :] »

Looks like I did ^^'

With the last modification in setup.py, now I have this file installed from gtg:
  /usr/bin/info.py

I'm almost sure that's a wrong idea :D

Any idea how to fix that better than by dumbly adding the info.py script to the «scripts » line in setup.py as I did ?

Revision history for this message
Lionel Dricot (ploum-deactivatedaccount) wrote :

Mathieu > I moved info.py in the package. Please test rev 284 to see if it works.

Revision history for this message
Mathieu Bridon (bochecha) wrote :

I'm afraid that still doesn't work :-/

Here is what I get now:
+ /usr/bin/python setup.py build
Traceback (most recent call last):
  File "setup.py", line 29, in <module>
    from GTG import info
  File "/home/mathieu/Fedora/rpmbuild/BUILD/gtg-0.1.2/GTG/__init__.py", line 28, in <module>
    from gtk import glade
  File "/usr/lib64/python2.6/site-packages/gtk-2.0/gtk/__init__.py", line 79, in <module>
    _init()
  File "/usr/lib64/python2.6/site-packages/gtk-2.0/gtk/__init__.py", line 67, in _init
    _gtk.init_check()
RuntimeError: could not open display

Changed in gtg:
status: Fix Committed → In Progress
Revision history for this message
Lionel Dricot (ploum-deactivatedaccount) wrote :

try rev. 285

Revision history for this message
Mathieu Bridon (bochecha) wrote :

285 fixes the issue ! (and 286 that I tried before understanding how to go back in time with bzr doesn't break it back :)

Thanks a lot for your efforts on this issue Lionel.

Changed in gtg:
status: In Progress → Fix Committed
Changed in gtg:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.