New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for file's builtin magic module #120
Conversation
Hi @felixonmars, my main concern is about how to test the two solutions, since they have the same namespace |
I was having a look at https://pypi.org/project/filemagic/ and I thought it was the module you are trying to support but I see it implements a slightly different API. Is that what you used? >>> magic.MAGIC_MIME_TYPE
16
>>> magic.MAGIC_MIME
1040 |
Actually, it's yet another. The one I use is bundled inside upstream "file" project and unfortunately not available from PyPI: https://github.com/archlinux/svntogit-community/blob/packages/python-magic/trunk/PKGBUILD#L12 So projects like s3cmd has implemented a quite complex compatibility check for the three versions: |
So the question is: how to test it in a CI environment if not available in PyPI? |
I see no easy answer either. Since the Arch repository version is the "file" one, and I always run tests during packaging, would you feel okay if I report back in a timely manner if the tests are not passing? |
In that case I will have to exclude that block from |
file's builtin magic module has a somewhat different API, and it's not co-installable with pypi:python-magic as both has the same name. Adding a fallback logic here makes mocket work with either one. All related tests are passing here.
@mindflayer Indeed, that's the problem. I have updated this PR to use MAGIC_MIME_TYPE instead and reverted the test change, all tests are now passing. |
OK, let me finish what I am doing for my job and I'll release a version of |
Thanks a lot :) |
@felixonmars Here you are: https://pypi.org/project/mocket/3.8.7/ |
Thanks! |
file's builtin magic module has a somewhat different API, and it's not
co-installable with pypi:python-magic as both has the same name. Adding
a fallback logic here makes mocket work with either one.
All related tests are passing here.