xrmx / bootchart

merge of bootchart-collector and pybootchartgui
GNU General Public License v2.0
233 stars 88 forks source link

python 3 incompatibility #16

Closed mattia-b89 closed 13 years ago

mattia-b89 commented 13 years ago

make works but not pybootchart, there is a python 3 incompatibility i'm on archlinux

xrmx commented 13 years ago

Could you please paste the errors here?

mattia-b89 commented 13 years ago

pybootchartgui give me:

Traceback (most recent call last): File "/usr/bin/pybootchartgui", line 20, in from pybootchartgui.main import main ImportError: No module named pybootchartgui.main

xrmx commented 13 years ago

This means that the stuff is installed where your python can't find it. Does 'PY_LIBDIR=/usr/lib/python3.2 make' work?. Obviously change python3.2 to your python version.

If arch is already shipping python3 as default python the arch bootchart2 packager should handle this so please contact him.

mattia-b89 commented 13 years ago

no, same error....i've also opened a thread in our forum but nobody has reply

xrmx commented 13 years ago

Could you please try with latest git? If it does not work you can try to pass PY_SITEDIR with the correct directory where your python stores packages which i don't know otherwise please wait the arch bootchart2 maintainer to update the package.

mattia-b89 commented 13 years ago

nothing works.....same error

i wait reply on forum because i think is only python related problem not bootchart....

mattia-b89 commented 13 years ago

i solved my issue: i must edit PKGBUILD (installation script on archlinux) adding

sed -i -e 's|python2.6|python2.7|' \ -e 's|python\b|python2|g' Makefile make || return 1 make DESTDIR=${pkgdir} install || return 1 sed -i "s|#!/usr/bin/python$|#!/usr/bin/python2|" ${pkgdir}/usr/bin/pybootchartgui

so now it works !

xrmx commented 13 years ago

So your default python is 3.x and you are forcing the script to use python2, which is 2.7.x., instead of python.

What does this gives you? python -c "from distutils import sysconfig; print sysconfig.get_config_var('DESTLIB')"

I cannot see why latest git Makefile should not run out of the box on your platform. Are you sure it gives the very same error after make && make install without your sed expressions?

mattia-b89 commented 13 years ago

i get this:

File "<string>", line 1
from distutils import sysconfig; print sysconfig.get_config_var('DESTLIB')
                                                          ^
SyntaxError: invalid syntax
xrmx commented 13 years ago

brown paper bug, fixed in latest git. Now we should start seeing python3 errors :)

mattia-b89 commented 13 years ago

yes, compiled latest git without any sed and now obtain:

Traceback (most recent call last):
File "/usr/bin/pybootchartgui", line 20, in <module>
from pybootchartgui.main import main
File "/usr/lib/python3.1/site-packages/pybootchartgui/main.py", line 84
print s
          ^
SyntaxError: invalid syntax
xrmx commented 13 years ago

It would take a few to fix all the issues and actually i don't think i have all pybootchartgui dependencies available on my system so for now you have to ship with your sed rules. Thanks for the time you have spent debugging the issue.

mattia-b89 commented 13 years ago

it's a pleasure to help you

so, when you complete to fix this issue, you say me, just write in this thread

hi!

xrmx commented 13 years ago

So i've committed what brings me to a cairo import error to the 'python3' branch. Please checkout that branch and see if it is working fine or not for you.

mattia-b89 commented 13 years ago

when i compile, i get this error:

 Sorry: TabError: inconsistent use of tabs and spaces in indentation (draw.py, line   170)Sorry: TabError: inconsistent use of tabs and spaces in indentation (gui.py, line 39)Sorry: TabError: inconsistent use of tabs and spaces in indentation (draw.py, line 170)Sorry: TabError: inconsistent use of tabs and spaces in indentation (gui.py, line 39)

despite that i can install bootchart and if i launch pybootchart, i get:

Traceback (most recent call last):
File "/usr/bin/pybootchartgui", line 20, in <module>
from pybootchartgui.main import main
File "/usr/lib/python3.1/site-packages/pybootchartgui/main.py", line 26, in <module>
from . import batch
File "/usr/lib/python3.1/site-packages/pybootchartgui/batch.py", line 16, in <module>
import cairo
ImportError: No module named cairo
xrmx commented 13 years ago

You do not have pycairo for python3 installed.

mattia-b89 commented 13 years ago

yes, and it isn't in the our repo, i'll wait it ....

mattia-b89 commented 13 years ago

i've installed python-cairo, now i get the same error compiling but when i launch pybootchart i get this:

Traceback (most recent call last):
File "/usr/bin/pybootchartgui", line 20, in <module>
from pybootchartgui.main import main
File "/usr/lib/python3.1/site-packages/pybootchartgui/main.py", line 84
print s
      ^
SyntaxError: invalid syntax
xrmx commented 13 years ago

It looks you have not installed the python3 branch :)

mattia-b89 commented 13 years ago

how i can clone get python3 branch and not the master ?

mattia-b89 commented 13 years ago

i append "-b python3" in git clone command and i think i succesful. now i get the same error compiling but when i launch pybootchart, i get:

Traceback (most recent call last):
File "/usr/bin/pybootchartgui", line 20, in <module>
from pybootchartgui.main import main
File "/usr/lib/python3.1/site-packages/pybootchartgui/main.py", line 26, in <module>
from . import batch
File "/usr/lib/python3.1/site-packages/pybootchartgui/batch.py", line 17, in <module>
from . import draw
File "/usr/lib/python3.1/site-packages/pybootchartgui/draw.py", line 170
    if label_w + 10 > w:
                       ^
TabError: inconsistent use of tabs and spaces in indentation
xrmx commented 13 years ago

Fixed taberror issues in draw.py in python3 branch.

mattia-b89 commented 13 years ago

now, when compile:

Sorry: TabError: inconsistent use of tabs and spaces in indentation (gui.py, line 39)Sorry: TabError: inconsistent use of tabs and spaces in indentation (gui.py, line 39)

and launching pybootchart (without bootchart.tgz, i haven't boot using my bootchart entry in grub....):

No path given, trying /var/log/bootchart.tgz
parsing '/var/log/bootchart.tgz'
parsing 'header'
Traceback (most recent call last):
File "/usr/bin/pybootchartgui", line 23, in <module>
sys.exit(main())
File "/usr/lib/python3.1/site-packages/pybootchartgui/main.py", line 118, in main
res = parsing.Trace(writer, args, options)
File "/usr/lib/python3.1/site-packages/pybootchartgui/parsing.py", line 45, in __init__
parse_paths (writer, self, paths)
File "/usr/lib/python3.1/site-packages/pybootchartgui/parsing.py", line 586, in parse_paths
state = _do_parse(writer, state, name, tf.extractfile(name))
File "/usr/lib/python3.1/site-packages/pybootchartgui/parsing.py", line 533, in _do_parse
state.headers = _parse_headers(file)
File "/usr/lib/python3.1/site-packages/pybootchartgui/parsing.py", line 150, in _parse_headers
return reduce(parse, file.read().split('\n'), (defaultdict(str),''))[0]
NameError: global name 'reduce' is not defined
xrmx commented 13 years ago

pushed some more fixes, please retest.

mattia-b89 commented 13 years ago

now without any issues when compile but when i launch pybootchartgui i get (still without a bootchart.tgz .):

No path given, trying /var/log/bootchart.tgz
parsing '/var/log/bootchart.tgz'
parsing 'header'
Traceback (most recent call last):
File "/usr/bin/pybootchartgui", line 23, in <module>
sys.exit(main())
File "/usr/lib/python3.1/site-packages/pybootchartgui/main.py", line 118, in main
res = parsing.Trace(writer, args, options)
File "/usr/lib/python3.1/site-packages/pybootchartgui/parsing.py", line 46, in __init__
parse_paths (writer, self, paths)
File "/usr/lib/python3.1/site-packages/pybootchartgui/parsing.py", line 587, in parse_paths
state = _do_parse(writer, state, name, tf.extractfile(name))
File "/usr/lib/python3.1/site-packages/pybootchartgui/parsing.py", line 534, in _do_parse
state.headers = _parse_headers(file)
File "/usr/lib/python3.1/site-packages/pybootchartgui/parsing.py", line 151, in _parse_headers
return reduce(parse, file.read().split('\n'), (defaultdict(str),''))[0]
TypeError: Type str doesn't support the buffer API
xrmx commented 13 years ago

I cannot reproduce your error but i've pushed another fix for the same function, could you please try again and if it does not work send me /var/log/bootchart.tgz file by email? You can find my email address in the git history.

mattia-b89 commented 13 years ago

sent the email