From c836a9e3390b967f16b42fd081c2c2160e0b1e23 Mon Sep 17 00:00:00 2001 From: Scott K Logan Date: Fri, 31 May 2024 15:28:35 -0500 Subject: [PATCH] Drop support for Python 2 (#183) * The minimum Python version is now 3.6 * Shebangs now use python3 specifically * Use of the 'mock' backport package has been removed --- scripts/rosdistro | 2 +- scripts/rosdistro_build_cache | 2 +- scripts/rosdistro_convert | 2 +- scripts/rosdistro_freeze_source | 2 +- scripts/rosdistro_generate_cache | 2 +- scripts/rosdistro_migrate_to_rep_141 | 2 +- scripts/rosdistro_migrate_to_rep_143 | 2 +- scripts/rosdistro_reformat | 2 +- setup.py | 4 ++-- stdeb.cfg | 18 ++++-------------- test/test_manifest_providers.py | 6 +----- 11 files changed, 15 insertions(+), 29 deletions(-) diff --git a/scripts/rosdistro b/scripts/rosdistro index ac721e3fd..bfaec7694 100755 --- a/scripts/rosdistro +++ b/scripts/rosdistro @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 import optparse import sys diff --git a/scripts/rosdistro_build_cache b/scripts/rosdistro_build_cache index d6efd3c81..e66077128 100755 --- a/scripts/rosdistro_build_cache +++ b/scripts/rosdistro_build_cache @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Software License Agreement (BSD License) # diff --git a/scripts/rosdistro_convert b/scripts/rosdistro_convert index b7782296e..c511b52bb 100755 --- a/scripts/rosdistro_convert +++ b/scripts/rosdistro_convert @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Software License Agreement (BSD License) # diff --git a/scripts/rosdistro_freeze_source b/scripts/rosdistro_freeze_source index f51ecefa6..d698f8488 100755 --- a/scripts/rosdistro_freeze_source +++ b/scripts/rosdistro_freeze_source @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Software License Agreement (BSD License) # diff --git a/scripts/rosdistro_generate_cache b/scripts/rosdistro_generate_cache index 2992f8cf2..04d7766b9 100755 --- a/scripts/rosdistro_generate_cache +++ b/scripts/rosdistro_generate_cache @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 import optparse import sys diff --git a/scripts/rosdistro_migrate_to_rep_141 b/scripts/rosdistro_migrate_to_rep_141 index 8f5523097..2596b73e6 100755 --- a/scripts/rosdistro_migrate_to_rep_141 +++ b/scripts/rosdistro_migrate_to_rep_141 @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 from __future__ import print_function diff --git a/scripts/rosdistro_migrate_to_rep_143 b/scripts/rosdistro_migrate_to_rep_143 index f5596ceb4..d2d6a7780 100755 --- a/scripts/rosdistro_migrate_to_rep_143 +++ b/scripts/rosdistro_migrate_to_rep_143 @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 from __future__ import print_function diff --git a/scripts/rosdistro_reformat b/scripts/rosdistro_reformat index 04eaccbfc..35acd57a9 100755 --- a/scripts/rosdistro_reformat +++ b/scripts/rosdistro_reformat @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Software License Agreement (BSD License) # diff --git a/setup.py b/setup.py index 995c4b023..cbcda9f1c 100755 --- a/setup.py +++ b/setup.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 import os @@ -11,6 +11,7 @@ # - stdeb.cfg 'version': '0.9.1', 'install_requires': ['PyYAML', 'setuptools'], + 'python_requires': '>=3.6', 'packages': find_packages('src'), 'package_dir': {'': 'src'}, 'scripts': [ @@ -25,7 +26,6 @@ ], 'extras_require': { 'test': [ - "mock; python_version < '3.3'", 'pytest', ]}, 'author': 'Wim Meeussen, Dirk Thomas', diff --git a/stdeb.cfg b/stdeb.cfg index de1c20449..4e7fdd76f 100644 --- a/stdeb.cfg +++ b/stdeb.cfg @@ -3,30 +3,20 @@ Debian-Version: 100 ; rosdistro-modules same version as in: ; - setup.py ; - src/rosdistro/__init__.py -Depends: ca-certificates, python-rosdistro-modules (>= 0.9.1), python-setuptools, python-yaml -; rosdistro-modules same version as in: -; - setup.py -; - src/rosdistro/__init__.py Depends3: ca-certificates, python3-rosdistro-modules (>= 0.9.1), python3-setuptools, python3-yaml -Conflicts: python3-rosdistro Conflicts3: python-rosdistro Copyright-File: LICENSE.txt -Suite: bionic cosmic disco eoan buster Suite3: focal jammy noble bookworm trixie -Python2-Depends-Name: python -X-Python3-Version: >= 3.4 +No-Python2: +X-Python3-Version: >= 3.6 Setup-Env-Vars: SKIP_PYTHON_MODULES=1 [rosdistro_modules] -Depends: ca-certificates, python-catkin-pkg-modules, python-rospkg-modules, python-setuptools, python-yaml Depends3: ca-certificates, python3-catkin-pkg-modules, python3-rospkg-modules, python3-setuptools, python3-yaml -Conflicts: python-rosdistro (<< 0.6.0) Conflicts3: python3-rosdistro (<< 0.6.0) -Replaces: python-rosdistro (<< 0.6.0) Replaces3: python3-rosdistro (<< 0.6.0) Copyright-File: LICENSE.txt -Suite: bionic cosmic disco eoan buster Suite3: focal jammy noble bookworm trixie -Python2-Depends-Name: python -X-Python3-Version: >= 3.4 +No-Python2: +X-Python3-Version: >= 3.6 Setup-Env-Vars: SKIP_PYTHON_SCRIPTS=1 diff --git a/test/test_manifest_providers.py b/test/test_manifest_providers.py index b4e5d953b..640f85343 100644 --- a/test/test_manifest_providers.py +++ b/test/test_manifest_providers.py @@ -1,11 +1,7 @@ # -*- coding: utf-8 -*- import os - -try: - from unittest.mock import patch -except ImportError: - from mock import patch +from unittest.mock import patch import rosdistro.manifest_provider.github import rosdistro.vcs