File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change 5
5
import shutil
6
6
import sys
7
7
from setuptools import setup , find_packages
8
+ from pkg_resources import get_distribution , DistributionNotFound
8
9
9
10
10
11
def read (* names , ** kwargs ):
@@ -15,6 +16,13 @@ def read(*names, **kwargs):
15
16
return fp .read ()
16
17
17
18
19
+ def get_dist (pkgname ):
20
+ try :
21
+ return get_distribution (pkgname )
22
+ except DistributionNotFound :
23
+ return None
24
+
25
+
18
26
def find_version (* file_paths ):
19
27
version_file = read (* file_paths )
20
28
version_match = re .search (r"^__version__ = ['\"]([^'\"]*)['\"]" ,
@@ -30,12 +38,15 @@ def find_version(*file_paths):
30
38
31
39
requirements = [
32
40
'numpy' ,
33
- 'pillow >= 4.1.1' ,
34
41
'six' ,
35
42
'torch' ,
36
43
'tqdm'
37
44
]
38
45
46
+ pillow_ver = ' >= 4.1.1'
47
+ pillow_req = 'pillow-simd' if get_dist ('pillow-simd' ) is not None else 'pillow'
48
+ requirements .append (pillow_req + pillow_ver )
49
+
39
50
setup (
40
51
# Metadata
41
52
name = 'torchvision' ,
You can’t perform that action at this time.
0 commit comments