Skip to content

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

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

Merged
merged 2 commits into from
May 30, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import shutil
import sys
from setuptools import setup, find_packages
from pkg_resources import get_distribution, DistributionNotFound


def read(*names, **kwargs):
Expand All @@ -15,6 +16,13 @@ def read(*names, **kwargs):
return fp.read()


def get_dist(pkgname):
try:
return get_distribution(pkgname)
except DistributionNotFound:
return None


def find_version(*file_paths):
version_file = read(*file_paths)
version_match = re.search(r"^__version__ = ['\"]([^'\"]*)['\"]",
Expand All @@ -30,12 +38,15 @@ def find_version(*file_paths):

requirements = [
'numpy',
'pillow >= 4.1.1',
'six',
'torch',
'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(
# Metadata
name='torchvision',
Expand Down