Blob Blame History Raw
From f3c8e8eacc4e1f5d53c79fb79bdb75e5bcce8faf Mon Sep 17 00:00:00 2001
From: Scott K Logan <logans@cottsay.net>
Date: Mon, 20 Apr 2020 14:30:24 -0700
Subject: [PATCH] Ensure 'distro' dependency is absent for python < 3.8 (#196)

* Ensure 'distro' dependency is absent for python < 3.8

This approach aligns with the existing approach for `argparse`, while
still maintaining the current behavior when
`SKIP_PYTHON_{MODULE,SCRIPTS}` is specified.

This is a generalized solution to the change made in
e7a154999ffe986b83b4550c516c1b8a79b35142

* keep distro for Python 3.8 modules Debian package

* can't list distro as a dependency in the Debian packages since the same package is used across multiple Python versions

Co-authored-by: Dirk Thomas <dirk-thomas@users.noreply.github.com>
---
 setup.py | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/setup.py b/setup.py
index 19ee4bc..ab629ff 100755
--- a/setup.py
+++ b/setup.py
@@ -5,14 +5,6 @@
 
 from setuptools import setup
 
-install_requires = ['catkin_pkg', 'PyYAML']
-
-if (
-    'SKIP_PYTHON_MODULES' not in os.environ and
-    'SKIP_PYTHON_SCRIPTS' not in os.environ
-):
-    install_requires.append('distro')
-
 kwargs = {
     'name': 'rospkg',
     # same version as in:
@@ -24,7 +16,7 @@
     'entry_points': {
         'console_scripts': ['rosversion=rospkg.rosversion:main'],
     },
-    'install_requires': install_requires,
+    'install_requires': ['catkin_pkg', 'distro', 'PyYAML'],
     'author': 'Ken Conley',
     'author_email': 'kwc@willowgarage.com',
     'url': 'http://wiki.ros.org/rospkg',
@@ -42,6 +34,14 @@
 if sys.version_info[0] == 2 and sys.version_info[1] < 7:
     kwargs['install_requires'].append('argparse')
 
+if (
+    sys.version_info[0] < 3 or
+    (sys.version_info[0] == 3 and sys.version_info[1] < 8) or
+    'SKIP_PYTHON_MODULES' in os.environ or
+    'SKIP_PYTHON_SCRIPTS' in os.environ
+):
+    kwargs['install_requires'].remove('distro')
+
 if 'SKIP_PYTHON_MODULES' in os.environ:
     kwargs['packages'] = []
     kwargs['package_dir'] = {}