Skip to content
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

Default magic_file to 'magic' #137

Closed
julian-r opened this issue Aug 14, 2017 · 8 comments · May be fixed by #294
Closed

Default magic_file to 'magic' #137

julian-r opened this issue Aug 14, 2017 · 8 comments · May be fixed by #294

Comments

@julian-r
Copy link

For windows it would be quite good, because then if the cwd contains the dll and the mgc file everything works out of the box :)

@ahupp
Copy link
Owner

ahupp commented May 5, 2020

How about a environment variable?

@ahupp ahupp added feature and removed feature labels May 6, 2020
@ahupp
Copy link
Owner

ahupp commented May 6, 2020

Actually on second thought, I'd rather leave it up to the application to pass this through. Or do you have a situation where you don't own the code calling python-magic?

@julian-r
Copy link
Author

Its actually quite simple: there is this binary package, which is compatible with the python build for windows: https://github.com/julian-r/file-windows/. The only problem is, that this python-magic modules does not find the the dll or the mgc file. If we could adjust this, i don't need to maintain (or in this case not maintain) a extra package (https://pypi.org/project/python-magic-bin/0.4.14/). I could take care about the dll and the visual studio build in the future. I could also take an evening to build egg's for windows, but i would try to not do this in an extra project. :)

@julian-r
Copy link
Author

Okay, just did some investigation to my old memories:

  • This fork is able to build a mac and a windows binary egg. https://github.com/julian-r/python-magic
    My offer: I will help you maintaining the package, will take care about win and mac platforms. For unixes binary packages are not needed anyways. This will make the package for users on those platforms much more friendly and everyone with a build pipline can install a hassle free egg package :)

Hope that sounds interesting for you.

@Orangensaft
Copy link

I would love this feature! We are currently deploying to linux but partly developing using windows.
For windows we have to use the python-magic-bin package. For linux python-magic. With this feature we could just have one package that works cross-platform.

@ahupp
Copy link
Owner

ahupp commented Oct 14, 2020

@julian-r I love that you provide the binaries, but my preference is to not include them in the standard package. Any existing users (by definition) already provide their own binaries, and would in general want to use the system-provided binary.
Same goes for the magic file; switching to a non-system file would be a big surprise.

But I think the goal of making this more seamless is a good one. There's a general problem I have here of figuring out how to find the shared lib on various platforms, just look a the mess in magic.py to see all the special cases.

This feels like an issue of configuration to me; you have a single codebase and want to run it in different ways (e.g pointing at a new shared lib / magic file).

So I'll re-suggest the environment variable idea:

PYTHON_MAGIC_SHARED_LIB=something.dll
PYTHON_MAGIC_DB=something.mgc

What do you think?

@davidfraser
Copy link

@julian-r's Windows binaries being available on PyPI are really useful, and I would love them to be maintained somehow

@ahupp
Copy link
Owner

ahupp commented Aug 25, 2023

Merging into #293

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants