[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Handling a package compatible with Python 3.3 but not 3.4



A long while back we had several discussions about the possibility that a
package installed into /usr/lib/python3 would support one version of Python 3
but not all of them.  IIRC, we never came to any good solution.

Now I have both a test case and a crappy solution. ;)

Genshi 0.7 supports Python 3.3 but not 3.4 yet because of
<http://genshi.edgewall.org/ticket/582>.  While we're waiting for upstream to
release a compatible version, I've done the following in Ubuntu, and in the
DPMT svn for genshi (not yet uploaded).

-----d/control-----
X-Python3-Version: >= 3.3, << 3.4
-----d/control-----

This is needed to even build the package when 3.3 and 3.4 is supported.
Without this, the test suite failure causes the package to ftbfs.

But this isn't quite enough because although the package builds and installs,
it *also* is importable in Python 3.4, though of course it will not work.  So
I also added the following quilt patch:

-----d/p/disable-python34.patch-----
Description: Raise an ImportError when trying to import genshi in a
  Python > 3.3, since it is not yet compatible with Python 3.4.
  Remove this when upstream ticket 582 is resolved.
  http://genshi.edgewall.org/ticket/582
Author: Barry Warsaw <barry@debian.org>
Forwarded: not-needed

--- a/genshi/__init__.py
+++ b/genshi/__init__.py
@@ -22,5 +22,9 @@
 __docformat__ = 'restructuredtext en'
 __version__ = '0.7'
 
+import sys
+if not sys.version_info < (3,4):
+    raise ImportError('See http://genshi.edgewall.org/ticket/582')
+
 from genshi.core import *
 from genshi.input import ParseError, XML, HTML
-----d/p/disable-python34.patch-----

Yes, I hate myself for this, but absent any principled way of handling this
(i.e. simple to set up using the appropriate Python helpers without making
d/rules a horrible mess, and easy to undo), I think this is a workable
solution.  I consider this temporary, and it will be quite easy to back out
once upstream is compatible with Python 3.4.

Before I upload, I wanted to get your feedback.

Cheers,
-Barry

Attachment: signature.asc
Description: PGP signature


Reply to: