From 5a6a26a7e070a48a8e890621db79ed7e0e090a2b Mon Sep 17 00:00:00 2001 From: Andrew Murray Date: Mon, 18 Jul 2022 15:52:40 +1000 Subject: [PATCH] Do not quote Pillow version for setuptools >= 60 --- .github/workflows/test-windows.yml | 10 ++-------- setup.py | 9 ++++++--- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/.github/workflows/test-windows.yml b/.github/workflows/test-windows.yml index b9accfdf9a5..c18517da28f 100644 --- a/.github/workflows/test-windows.yml +++ b/.github/workflows/test-windows.yml @@ -11,14 +11,8 @@ jobs: strategy: fail-fast: false matrix: - python-version: ["3.7", "3.8", "3.9", "3.10", "3.11-dev"] - architecture: ["x86", "x64"] - include: - # PyPy 7.3.4+ only ships 64-bit binaries for Windows - - python-version: "pypy-3.7" - architecture: "x64" - - python-version: "pypy-3.8" - architecture: "x64" + python-version: ["3.7", "3.8", "3.9"] + architecture: ["x64"] timeout-minutes: 30 diff --git a/setup.py b/setup.py index 71e853dcee9..b37ac6ed57c 100755 --- a/setup.py +++ b/setup.py @@ -15,6 +15,7 @@ import sys import warnings +from setuptools import __version__ as setuptools_version from setuptools import Extension, setup from setuptools.command.build_ext import build_ext @@ -846,14 +847,16 @@ def build_extensions(self): if struct.unpack("h", b"\0\1")[0] == 1: defs.append(("WORDS_BIGENDIAN", None)) + defs.append(("PILLOW_VERSION", f'"{PILLOW_VERSION}"')) if ( sys.platform == "win32" and sys.version_info < (3, 9) and not (PLATFORM_PYPY or PLATFORM_MINGW) ): - defs.append(("PILLOW_VERSION", f'"\\"{PILLOW_VERSION}\\""')) - else: - defs.append(("PILLOW_VERSION", f'"{PILLOW_VERSION}"')) + from packaging.version import parse as parse_version + + if parse_version(setuptools_version) < parse_version("60.0.0"): + defs[-1] = ("PILLOW_VERSION", f'"\\"{PILLOW_VERSION}\\""') self._update_extension("PIL._imaging", libs, defs)