diff mbox series

[ovs-dev,v2] python: Fix package requirements with old setuptools

Message ID 3eb845185b04cee2f28c44b340bc2f80e72744b2.1553263261.git.tredaelli@redhat.com
State Accepted
Commit 2a6d9168d68d838604d03aa46084cce1b91ebee7
Headers show
Series [ovs-dev,v2] python: Fix package requirements with old setuptools | expand

Commit Message

Timothy Redaelli March 22, 2019, 2:02 p.m. UTC
Commit 00fcc832d598 ("Update Python package requirements") added a
PEP 508 environment marker to install pywin32 on Windows systems.

This requires a new setuptools version (>= 20.5), but (at least)
RHEL/CentOS7 and Debian Jessie are using an older version of
setuptools and so python extension failed to build.

This commit adds "extras_require" instead of the PEP 508 environment
markers in order to have the conditional dependency of pywin32, but by
remaining compatible with the old setuptools versions.

CC: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
CC: Lucian Petrut <lpetrut@cloudbasesolutions.com>
Fixes: 00fcc832d598 ("Update Python package requirements")
Signed-off-by: Timothy Redaelli <tredaelli@redhat.com>
---
v1 -> v2:
    - Use the more compatible PEP 496 environment marker "sys_platform"
      instead of "platform_system".
---
 python/setup.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Alin-Gabriel Serdean March 22, 2019, 2:25 p.m. UTC | #1
Acked-by: Alin Gabriel Serdean <aserdean@ovn.org>

-----Original Message-----
From: Timothy Redaelli <tredaelli@redhat.com> 
Sent: Friday, March 22, 2019 4:02 PM
To: dev@openvswitch.org
Cc: Alin Serdean <aserdean@cloudbasesolutions.com>; Lucian Petrut
<lpetrut@cloudbasesolutions.com>
Subject: [PATCH v2] python: Fix package requirements with old setuptools

Commit 00fcc832d598 ("Update Python package requirements") added a PEP 508
environment marker to install pywin32 on Windows systems.

This requires a new setuptools version (>= 20.5), but (at least)
RHEL/CentOS7 and Debian Jessie are using an older version of setuptools and
so python extension failed to build.

This commit adds "extras_require" instead of the PEP 508 environment markers
in order to have the conditional dependency of pywin32, but by remaining
compatible with the old setuptools versions.

CC: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
CC: Lucian Petrut <lpetrut@cloudbasesolutions.com>
Fixes: 00fcc832d598 ("Update Python package requirements")
Signed-off-by: Timothy Redaelli <tredaelli@redhat.com>
---
v1 -> v2:
    - Use the more compatible PEP 496 environment marker "sys_platform"
      instead of "platform_system".
---
 python/setup.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/python/setup.py b/python/setup.py index 14814ca4a..b7252800c
100644
--- a/python/setup.py
+++ b/python/setup.py
@@ -82,8 +82,8 @@ setup_args = dict(
     ext_modules=[setuptools.Extension("ovs._json", sources=["ovs/_json.c"],
                                       libraries=['openvswitch'])],
     cmdclass={'build_ext': try_build_ext},
-    install_requires=['sortedcontainers',
-                      'pywin32>=1.0;platform_system=="Windows"'],
+    install_requires=['sortedcontainers'],
+    extras_require={':sys_platform == "win32"': ['pywin32 >= 1.0']},
 )
 
 try:
--
2.20.1
Alin-Gabriel Serdean March 22, 2019, 2:47 p.m. UTC | #2
Thanks for the patch, applied on master!

-----Original Message-----
From: ovs-dev-bounces@openvswitch.org <ovs-dev-bounces@openvswitch.org> On
Behalf Of aserdean@ovn.org
Sent: Friday, March 22, 2019 4:26 PM
To: 'Timothy Redaelli' <tredaelli@redhat.com>; dev@openvswitch.org
Cc: Lucian Petrut <lpetrut@cloudbasesolutions.com>
Subject: Re: [ovs-dev] [PATCH v2] python: Fix package requirements with old
setuptools

Acked-by: Alin Gabriel Serdean <aserdean@ovn.org>

-----Original Message-----
From: Timothy Redaelli <tredaelli@redhat.com>
Sent: Friday, March 22, 2019 4:02 PM
To: dev@openvswitch.org
Cc: Alin Serdean <aserdean@cloudbasesolutions.com>; Lucian Petrut
<lpetrut@cloudbasesolutions.com>
Subject: [PATCH v2] python: Fix package requirements with old setuptools

Commit 00fcc832d598 ("Update Python package requirements") added a PEP 508
environment marker to install pywin32 on Windows systems.

This requires a new setuptools version (>= 20.5), but (at least)
RHEL/CentOS7 and Debian Jessie are using an older version of setuptools and
so python extension failed to build.

This commit adds "extras_require" instead of the PEP 508 environment markers
in order to have the conditional dependency of pywin32, but by remaining
compatible with the old setuptools versions.

CC: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
CC: Lucian Petrut <lpetrut@cloudbasesolutions.com>
Fixes: 00fcc832d598 ("Update Python package requirements")
Signed-off-by: Timothy Redaelli <tredaelli@redhat.com>
---
v1 -> v2:
    - Use the more compatible PEP 496 environment marker "sys_platform"
      instead of "platform_system".
---
 python/setup.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/python/setup.py b/python/setup.py index 14814ca4a..b7252800c
100644
--- a/python/setup.py
+++ b/python/setup.py
@@ -82,8 +82,8 @@ setup_args = dict(
     ext_modules=[setuptools.Extension("ovs._json", sources=["ovs/_json.c"],
                                       libraries=['openvswitch'])],
     cmdclass={'build_ext': try_build_ext},
-    install_requires=['sortedcontainers',
-                      'pywin32>=1.0;platform_system=="Windows"'],
+    install_requires=['sortedcontainers'],
+    extras_require={':sys_platform == "win32"': ['pywin32 >= 1.0']},
 )
 
 try:
--
2.20.1
diff mbox series

Patch

diff --git a/python/setup.py b/python/setup.py
index 14814ca4a..b7252800c 100644
--- a/python/setup.py
+++ b/python/setup.py
@@ -82,8 +82,8 @@  setup_args = dict(
     ext_modules=[setuptools.Extension("ovs._json", sources=["ovs/_json.c"],
                                       libraries=['openvswitch'])],
     cmdclass={'build_ext': try_build_ext},
-    install_requires=['sortedcontainers',
-                      'pywin32>=1.0;platform_system=="Windows"'],
+    install_requires=['sortedcontainers'],
+    extras_require={':sys_platform == "win32"': ['pywin32 >= 1.0']},
 )
 
 try: