From e00e4f0311793187349c61a7265a8c0798f6f04a Mon Sep 17 00:00:00 2001 From: nitely Date: Tue, 30 Jan 2018 10:01:47 -0300 Subject: [PATCH] install python-magic-bin in win32 and macOS --- setup.py | 8 +++++++- spirit/core/conf/defaults.py | 2 ++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 2d09e8b3..794c811d 100644 --- a/setup.py +++ b/setup.py @@ -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', diff --git a/spirit/core/conf/defaults.py b/spirit/core/conf/defaults.py index f5ac50da..3ad853c0 100644 --- a/spirit/core/conf/defaults.py +++ b/spirit/core/conf/defaults.py @@ -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 `_ #: #: .. Note:: #: To find a media-type just add an extension and an empty media-type,