bzr does not work with python2.6

Bug #269535 reported by Felix Möller
20
Affects Status Importance Assigned to Milestone
Bazaar
Fix Released
Medium
Vincent Ladeuil

Bug Description

I am trying to use bzr on openSUSE but it does not work at all. The problem is probably my python version. I have

$ python --version
Python 2.6b3

I have tried bzr 1.6.1 and 1.7rc1.

Initially they both fail with:
$ ../install/bin/bzr init
/home/fm/bzr-1.6.1/install/lib/python2.6/site-packages/bzrlib/lazy_import.py:195:
DeprecationWarning: the sha module is deprecated; use the hashlib module
instead
  module = __import__(module_python_path, scope, scope, [])
bzr: ERROR: exceptions.TypeError: object.__init__() takes no parameters

After:
--- /home/fm/bzr-1.6.1/install/lib/python2.6/site-packages/bzrlib/transport/__init__.py 2008-09-12 20:09:55.000000000 +0200
+++ ../build/lib.linux-i686-2.6/bzrlib/transport/__init__.py 2008-09-05 22:12:59.000000000 +0200
@@ -293,7 +293,7 @@
     _bytes_to_read_before_seek = 0

     def __init__(self, base):
- super(Transport, self).__init__()
+ super(Transport, self).__init__(base=base)
         self.base = base

     def _translate_error(self, e, path, raise_generic=True):

this error is gone.

After that I get
fm@macbook:~/bzr-1.6.1/dir> ../install/bin/bzr ci
/home/fm/bzr-1.6.1/install/lib/python2.6/site-packages/bzrlib/lazy_import.py:195: DeprecationWarning: the sha module is deprecated; use the hashlib module instead
  module = __import__(module_python_path, scope, scope, [])
/home/fm/bzr-1.6.1/install/lib/python2.6/site-packages/bzrlib/lazy_import.py:195: DeprecationWarning: the md5 module is deprecated; use hashlib instead
  module = __import__(module_python_path, scope, scope, [])
Committing to: /home/fm/bzr-1.6.1/dir/
bzr: ERROR: exceptions.ImportError: cannot import name U32

This is caused by http://svn.python.org/view/python/trunk/Lib/gzip.py?rev=61821&r1=61813&r2=61821 ...

So what is the solution for that?

Revision history for this message
John A Meinel (jameinel) wrote :

Thanks for reporting this. I'll put up some patches for it. We don't really *need* U32, though I'm surprised they deleted the function completely.

I don't know that this will fix everything, but if you want to keep trying, it would be nice to try and get bzr to work with python 2.6. I don't think the changes will make 1.7 final, but we can try and get something nicer for 1.8.

Changed in bzr:
assignee: nobody → jameinel
importance: Undecided → Medium
status: New → In Progress
Revision history for this message
John A Meinel (jameinel) wrote :

For now, I've put together the attached patch

Revision history for this message
Felix Möller (felix-derklecks) wrote :

Thanks for the quick patch, now I get:

fm@macbook:~/bzr-1.7rc1/dir> ../install/bin/bzr init
/home/fm/bzr-1.7rc1/install/lib/python2.6/site-packages/bzrlib/lazy_import.py:195: DeprecationWarning: the sha module is deprecated; use the hashlib module instead
  module = __import__(module_python_path, scope, scope, [])
bzr: ERROR: exceptions.ImportError: failed to load bzrlib.repofmt.weaverepo.RepositoryFormat7: cannot import name LOWU32

Traceback (most recent call last):
  File "install/lib/python2.6/site-packages/bzrlib/commands.py", line 857, in run_bzr_catch_errors
  File "install/lib/python2.6/site-packages/bzrlib/commands.py", line 797, in run_bzr
  File "install/lib/python2.6/site-packages/bzrlib/commands.py", line 499, in run_argv_aliases
  File "install/lib/python2.6/site-packages/bzrlib/builtins.py", line 1340, in run
  File "install/lib/python2.6/site-packages/bzrlib/info.py", line 346, in show_bzrdir_info
  File "install/lib/python2.6/site-packages/bzrlib/info.py", line 361, in show_component_info
  File "install/lib/python2.6/site-packages/bzrlib/info.py", line 449, in describe_format
  File "install/lib/python2.6/site-packages/bzrlib/bzrdir.py", line 2768, in make_bzrdir
  File "install/lib/python2.6/site-packages/bzrlib/bzrdir.py", line 2720, in helper
  File "install/lib/python2.6/site-packages/bzrlib/bzrdir.py", line 2705, in _load
ImportError: failed to load bzrlib.repofmt.weaverepo.RepositoryFormat7: cannot import name LOWU32

Revision history for this message
Felix Möller (felix-derklecks) wrote :

I think you might be wrong with your U32. Have a look at http://svn.python.org/view/python/trunk/Lib/gzip.py?rev=61646&view=markup ...

I have created a new patch for the U32 issue and added LOWU32 too.

Revision history for this message
Vincent Ladeuil (vila) wrote :

It's quite old but:
https://code.launchpad.net/~vila/bzr/bzr.python26

was my last attempt to run bzr with python-2.6.

I needed it to test the ssl module, which has since been provided for python-2.5 and 2.4 (as a separate package though).

Anyway, on 2007-11-20 (date of the last commit), I said:

    Ugly bug marking, but test suite passing for python2.6. Since 2.6
    is still developed investigating now seems a waste.

I'd be happy to resurrect it.

Revision history for this message
Felix Möller (felix-derklecks) wrote :

Hi vila,

Looking at http://www.python.org/dev/peps/pep-0361/ it seems like python will be released in one month. The current openSUSE factory version already contains python 2.6 ...

python 2.6 RC 1 is due today so I think it is not a moving target anymore. I would be happy to test a patch from you.

Thanks

Revision history for this message
Vincent Ladeuil (vila) wrote : Re: [Bug 269535] Re: bzr does not work with python2.6

    Felix> Looking at http://www.python.org/dev/peps/pep-0361/ it
    Felix> seems like python will be released in one month. The
    Felix> current openSUSE factory version already contains
    Felix> python 2.6 ...

    Felix> python 2.6 RC 1 is due today so I think it is not a moving target
    Felix> anymore.

Sure, my comment was made in November 2007...

    Felix> I would be happy to test a patch from you.

I'm looking into it but there are test failures and errors (with
a checkout of lp:python which is said to be what python-2.6 will
be):

Ran 13225 tests in 828.796s

FAILED (failures=33, errors=35, known_failure_count=8)
839 tests skipped
Missing feature 'FTPServer' skipped 94 tests.
Missing feature 'Internally performed glob expansion' skipped 5 tests.
Missing feature '_winreg' skipped 2 tests.
Missing feature 'attrib Windows command-line tool' skipped 1 tests.
Missing feature 'bzrlib._btree_serializer_c' skipped 1 tests.
Missing feature 'bzrlib._dirstate_helpers_c' skipped 23 tests.
Missing feature 'bzrlib._knit_load_data_c' skipped 25 tests.
Missing feature 'bzrlib._patiencediff_c' skipped 11 tests.
Missing feature 'bzrlib._readdir_pyx' skipped 1 tests.
Missing feature 'bzrlib._walkdirs_win32' skipped 9 tests.
Missing feature 'case-insensitive filesystem' skipped 1 tests.
tests failed

I've merged a recent bzr .dev and setup a new branch
(lp:~vila/bzr/py26bzr).

Your patch for U32 is correct (I did the same before seeing
yours).

But the behavior of __init__ has changed in an apparently very
subtle way which bites bzr hard.

Basically you can't apply your first patch (related to
super(Transport, self).__init__) because with python 2.5:

- it's not illegal to call object.__init__ with parameters

- it seems to call the next available __init__ when multiple
  inheritance is used.

In python 2.6, it fails to call object.__init__ if parameters are
specified but if you delete the parameters the call to __init__
for the next base class is wrong.

And that's only the first failing test. So in the short term,
you'd better look at how openSuse can tie python-2.5 as a
dependency for bzr.

bzr currently requires python 2.4 or 2.5, obviously we *will*
support 2.6, but we don't right now.

Revision history for this message
Vincent Ladeuil (vila) wrote :

Applying the patch attached to http://bugs.python.org/issue3879, and using at least revno 2943 from the lp:~vila/bzr/py26bzr/ makes the test suite pass.

Changed in bzr:
assignee: jameinel → vila
status: In Progress → Fix Committed
Revision history for this message
Vincent Ladeuil (vila) wrote :

Note that since python-2.6 final has not been released, this branch should be considered as a work in progress.

Revision history for this message
Vincent Ladeuil (vila) wrote :

There was one remaining failure fixed by revno 2945 on lp:~vila/bzr/py26bzr.

There are also some deprecation warnings which seems minor enough to leave as is, waiting for a final version of python-2.6.

In the mean time, I intend to polish the patches a bit and submit them for review.

Also note that the patches were built againt a python-2.6RC1, no tests have been conducted against priori beta versions.

Vincent Ladeuil (vila)
Changed in bzr:
milestone: none → 1.8
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

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