Commit 5a0d079c authored by ngimel's avatar ngimel Committed by Soumith Chintala
Browse files

make vision depend on pillow-simd if already installed (#522)

* make vision depend on pillow-simd if already installed

* actually make pillow-simd optional
parent da67a1e9
...@@ -5,6 +5,7 @@ import re ...@@ -5,6 +5,7 @@ import re
import shutil import shutil
import sys import sys
from setuptools import setup, find_packages from setuptools import setup, find_packages
from pkg_resources import get_distribution, DistributionNotFound
def read(*names, **kwargs): def read(*names, **kwargs):
...@@ -15,6 +16,13 @@ def read(*names, **kwargs): ...@@ -15,6 +16,13 @@ def read(*names, **kwargs):
return fp.read() return fp.read()
def get_dist(pkgname):
try:
return get_distribution(pkgname)
except DistributionNotFound:
return None
def find_version(*file_paths): def find_version(*file_paths):
version_file = read(*file_paths) version_file = read(*file_paths)
version_match = re.search(r"^__version__ = ['\"]([^'\"]*)['\"]", version_match = re.search(r"^__version__ = ['\"]([^'\"]*)['\"]",
...@@ -30,12 +38,15 @@ VERSION = find_version('torchvision', '__init__.py') ...@@ -30,12 +38,15 @@ VERSION = find_version('torchvision', '__init__.py')
requirements = [ requirements = [
'numpy', 'numpy',
'pillow >= 4.1.1',
'six', 'six',
'torch', 'torch',
'tqdm' 'tqdm'
] ]
pillow_ver = ' >= 4.1.1'
pillow_req = 'pillow-simd' if get_dist('pillow-simd') is not None else 'pillow'
requirements.append(pillow_req + pillow_ver)
setup( setup(
# Metadata # Metadata
name='torchvision', name='torchvision',
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment