From a2adeecbb753b2998b24f9ec7ea2b927f6332042 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= Date: Mon, 4 Nov 2024 13:55:48 +0100 Subject: [PATCH] build: fix conditional install_requires #581 Fix conditional `install_requires` in `setup.py` to use environment markers instead of inline conditions. The latter do not work correctly with universal wheels -- e.g. a wheel made on Python 3.12 would not have a dependency on `typing-extensions` at all, even if it were installed on Python 3.11 or older, and the other way around. --- setup.py | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/setup.py b/setup.py index b41f1c52..e3739f5c 100644 --- a/setup.py +++ b/setup.py @@ -10,6 +10,8 @@ install_requires = [ 'msgpack>=0.5.0', + 'greenlet>=3.0; python_implementation != "PyPy"', + 'typing-extensions>=4.5; python_version < "3.12"', ] needs_pytest = {'pytest', 'test', 'ptr'}.intersection(sys.argv) @@ -32,13 +34,6 @@ 'docs': docs_require, } -if platform.python_implementation() != 'PyPy': - # pypy already includes an implementation of the greenlet module - install_requires.append('greenlet>=3.0') - -if sys.version_info < (3, 12): - install_requires.append('typing-extensions>=4.5') - # __version__: see pynvim/_version.py with open(os.path.join(__PATH__, "pynvim/_version.py"),