Two conflicting implementations of python-magic (was API changes...)

Bug #504560 reported by Rodrigo Bistolfi
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
lalita
Incomplete
Critical
Unassigned

Bug Description

The python-magic API has changed in their 0.1 release, should we reflect this changes in Lalita (python-magic is a dependency for the url plugin.)
I attach a trivial patch just in case.

Revision history for this message
Rodrigo Bistolfi (rodrigobistolfi) wrote :
Changed in lalita:
milestone: none → alpha
importance: Undecided → Critical
Revision history for this message
Facundo Batista (facundo) wrote :

I have a fully updated Karmic, and the python-magic version is like a bigger number: 5.03-1ubuntu1

We should support previous and newer versions. The problem is that the API seems to be the older one, and after an "import magic", you don't have a version attribute or anything.

In which system you have a newer version? What do you think about supporting two versions?

Changed in lalita:
status: New → Incomplete
Revision history for this message
Rodrigo Bistolfi (rodrigobistolfi) wrote :

I installed python-magic from pypi in my Vector Linux and Slackware systems (12.1)
http://pypi.python.org/pypi/python-magic/0.1

Ubuntu is using a package from another source: http://packages.ubuntu.com/karmic/python-magic
They are splitting python-magic from the file package (source in http://www.darwinsys.com/file/)
We could pick one or make an adapter for supporting both. The pypi package is outdated, but how this dependency will be handled by lalita if installed through pipy?

Revision history for this message
Facundo Batista (facundo) wrote :

Rodrigo: I think we should support both versions.

Not a very big adapter, just the minimum needed for this to work.

What do you think?

Revision history for this message
Rodrigo Bistolfi (rodrigobistolfi) wrote :

I agree, I will get both sources and take a look.

summary: - Api changes in python-magic
+ Two conflicting implementations of python-magic (was API changes...)
Revision history for this message
Facundo Batista (facundo) wrote :

Hi Rodrigo, do you have any news about this?

Thanks!

Changed in lalita:
milestone: alpha → beta
Revision history for this message
Rodrigo Bistolfi (rodrigobistolfi) wrote :

Hi Facundo, sorry about the delay, I have been busy at work.
How do you think we should implement this? I have a few questions:

1) Should the fix be part of the url.py module, or should it be available for other plug-ins, maybe through a separated utils.py module or similar? I think it should go in url.py and others can pick it up from there if needed. The plug-ins folder needs a clean up already.

2) Do we need a simple adapter, providing an unified interface for both implementations or do we need something fancier, maybe using zope.interface ?

Revision history for this message
Facundo Batista (facundo) wrote :

Hola Rodrigo! After we discussed this on IRC and you did some mockups... did you make a decision about how to proceed?

Revision history for this message
Rodrigo Bistolfi (rodrigobistolfi) wrote :

Hi Facundo! Given that we concluded that the metaclass approach was the more elegant, I think we should take that approach. If we find maintenance related problems, I can switch to one of the other proposed implementations. I am cleaning up and I will branch it for reviewing. If you agree, we can evaluate the solution until lalita becomes Beta.

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.