install python-magic-bin in win32 and macOS

This commit is contained in:
nitely 2018-01-30 10:01:47 -03:00
parent 5addf36d6a
commit e00e4f0311
2 changed files with 9 additions and 1 deletions

View File

@ -3,6 +3,7 @@
from __future__ import unicode_literals
import sys
import os
import io
from setuptools import setup, find_packages
@ -18,6 +19,11 @@ VERSION = __import__('spirit').__version__
with io.open(os.path.join(BASE_DIR, 'requirements.txt'), encoding='utf-8') as fh:
REQUIREMENTS = fh.read()
if sys.platform.startswith(('win32', 'darwin')):
PYTHON_MAGIC_DEP = ['python-magic-bin==0.4.14']
else: # Linux?
PYTHON_MAGIC_DEP = ['python-magic==0.4.15']
# allow setup.py to be run from any path
os.chdir(os.path.normpath(os.path.join(os.path.abspath(__file__), os.pardir)))
@ -39,7 +45,7 @@ spirit=spirit.extra.bin.spirit:main
zip_safe=False,
install_requires=REQUIREMENTS,
extras_require={
'files': ['python-magic==0.4.15']},
'files': PYTHON_MAGIC_DEP},
license='MIT License',
classifiers=[
'Development Status :: 5 - Production/Stable',

View File

@ -67,6 +67,8 @@ ST_ALLOWED_UPLOAD_IMAGE_FORMAT = ('jpeg', 'jpg', 'gif')
ST_UPLOAD_FILE_ENABLED = True
#: Uploaded files will be validated against these formats.
#: This is a map of extension and media-type. Both are used for validation.
#: Requires running ``pip install django-spirit[files]`` to install
#: `python-magic <https://github.com/ahupp/python-magic#installation>`_
#:
#: .. Note::
#: To find a media-type just add an extension and an empty media-type,