diff --git a/setup.py b/setup.py index 8ba171dce2e..98cc5c8eb3a 100644 --- a/setup.py +++ b/setup.py @@ -94,7 +94,7 @@ def get_extensions(): third_party_search_directories = [] runtime_library_dirs = None - if sys.platform.startswith('linux') or sys.platform.startswith('darwin'): + if sys.platform.startswith('linux'): sources = sources + source_image_cpu libraries.append('png') third_party_search_directories.append(os.path.join(cwd, "third_party/libpng")) @@ -222,7 +222,7 @@ def throw_of_failure(command): def build_deps(): this_dir = os.path.dirname(os.path.abspath(__file__)) - if sys.platform.startswith('linux') or sys.platform.startswith('darwin'): + if sys.platform.startswith('linux'): cpu_count = multiprocessing.cpu_count() os.chdir("third_party/zlib/") throw_of_failure('cmake .') @@ -232,8 +232,6 @@ def build_deps(): zlib_path = os.path.join(this_dir, "third_party/zlib") if sys.platform.startswith("linux"): libpng_cmake_options = "-DPNG_BUILD_ZLIB=ON -DPNG_STATIC=OFF -DZLIB_INCLUDE_DIR:PATH={zlib_path} -DZLIB_LIBRARY:FILEPATH={zlib_path}/libz.so".format(zlib_path=zlib_path) - if sys.platform.startswith("darwin"): - libpng_cmake_options = "-DPNG_BUILD_ZLIB=ON -DPNG_STATIC=OFF -DZLIB_INCLUDE_DIR:PATH={zlib_path} -DZLIB_LIBRARY:FILEPATH={zlib_path}/libz.dylib".format(zlib_path=zlib_path) os.chdir("third_party/libpng/") os.system('cmake {} .'.format(libpng_cmake_options)) throw_of_failure("cmake --build . -- -j {}".format(cpu_count)) @@ -253,14 +251,6 @@ def build_ext_with_dependencies(self): 'third_party/libpng/libpng.so']) ] -if sys.platform.startswith('darwin'): - data_files = [ - ('torchvision/lib', [ - 'third_party/zlib/libz.dylib', - 'third_party/libpng/libpng.dylib']) - ] - - setup( # Metadata name=package_name, diff --git a/test/test_image.py b/test/test_image.py index b681b615d16..7ea5c84ea63 100644 --- a/test/test_image.py +++ b/test/test_image.py @@ -4,7 +4,7 @@ import torch from PIL import Image -if sys.platform.startswith('linux') or sys.platform.startswith("darwin"): +if sys.platform.startswith('linux'): from torchvision.io.image import read_png, decode_png import numpy as np @@ -21,14 +21,14 @@ def get_images(directory, img_ext): class ImageTester(unittest.TestCase): - @unittest.skipUnless(sys.platform.startswith("linux") or sys.platform.startswith("darwin"), "Support only available on linux for now.") + @unittest.skipUnless(sys.platform.startswith("linux"), "Support only available on linux for now.") def test_read_png(self): for img_path in get_images(IMAGE_DIR, ".png"): img_pil = torch.from_numpy(np.array(Image.open(img_path))) img_lpng = read_png(img_path) self.assertTrue(torch.equal(img_lpng, img_pil)) - @unittest.skipUnless(sys.platform.startswith("linux") or sys.platform.startswith("darwin"), "Support only available on linux for now.") + @unittest.skipUnless(sys.platform.startswith("linux"), "Support only available on linux for now.") def test_decode_png(self): for img_path in get_images(IMAGE_DIR, ".png"): img_pil = torch.from_numpy(np.array(Image.open(img_path)))