Skip to content

Commit

Permalink
Drop support for Python 2 (#1067)
Browse files Browse the repository at this point in the history
  • Loading branch information
cottsay authored Nov 1, 2024
1 parent 12c18c3 commit 0cc78ed
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 28 deletions.
5 changes: 2 additions & 3 deletions ros_buildfarm/jenkins.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,9 +274,8 @@ def _diff_configs(remote_config, new_config, context_lines):
if ElementTree.tostring(remote_root) == ElementTree.tostring(new_root):
return []

encoding_type = 'utf-8' if sys.version_info[0] < 3 else 'unicode'
xml1 = ElementTree.tostring(remote_root, encoding=encoding_type)
xml2 = ElementTree.tostring(new_root, encoding=encoding_type)
xml1 = ElementTree.tostring(remote_root, encoding='unicode')
xml2 = ElementTree.tostring(new_root, encoding='unicode')
lines1 = xml1.splitlines()
lines2 = xml2.splitlines()

Expand Down
19 changes: 9 additions & 10 deletions ros_buildfarm/status_page.py
Original file line number Diff line number Diff line change
Expand Up @@ -582,16 +582,15 @@ def _version_is_gt_other(version, other_version):
def _get_comparable_loose_versions(version_str1, version_str2):
loose_version1 = LooseVersion(version_str1)
loose_version2 = LooseVersion(version_str2)
if sys.version_info[0] > 2:
# might raise TypeError in Python 3: http://bugs.python.org/issue14894
version_parts1 = loose_version1.version
version_parts2 = loose_version2.version
for i in range(min(len(version_parts1), len(version_parts2))):
try:
version_parts1[i] < version_parts2[i]
except TypeError:
version_parts1[i] = str(version_parts1[i])
version_parts2[i] = str(version_parts2[i])
# might raise TypeError in Python 3: http://bugs.python.org/issue14894
version_parts1 = loose_version1.version
version_parts2 = loose_version2.version
for i in range(min(len(version_parts1), len(version_parts2))):
try:
version_parts1[i] < version_parts2[i]
except TypeError:
version_parts1[i] = str(version_parts1[i])
version_parts2[i] = str(version_parts2[i])
return loose_version1, loose_version2


Expand Down
4 changes: 1 addition & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
# - ros_buildfarm/__init__.py
# - stdeb.cfg
'version': '3.0.1-master',
'python_requires': '>=3.6',
'packages': find_packages(exclude=['test']),
'package_data': {
'ros_buildfarm.templates': [
Expand Down Expand Up @@ -72,9 +73,6 @@
'license': 'Apache 2.0',
}

if os.sys.version_info[0] == 2:
kwargs['install_requires'].append('configparser')

if 'SKIP_PYTHON_MODULES' in os.environ:
kwargs['packages'] = []
elif 'SKIP_PYTHON_SCRIPTS' in os.environ:
Expand Down
16 changes: 4 additions & 12 deletions stdeb.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,18 @@ Debian-Version: 100
; ros-buildfarm-modules same version (without the branch suffix) as in:
; - ros_buildfarm/__init__.py
; - setup.py
Depends: python-argparse, python-catkin-pkg-modules, python-ros-buildfarm-modules (>= 3.0.0), python-rosdistro-modules (>= 1.0.0), python-yaml
; ros-buildfarm-modules same version (without the branch suffix) as in:
; - ros_buildfarm/__init__.py
; - setup.py
Depends3: python3-catkin-pkg-modules, python3-ros-buildfarm-modules (>= 3.0.0), python3-rosdistro-modules (>= 1.0.0), python3-yaml
Conflicts: python3-ros-buildfarm
Conflicts3: python-ros-buildfarm
Suite: xenial yakkety zesty artful bionic cosmic disco eoan stretch buster
Suite3: xenial yakkety zesty artful bionic cosmic disco eoan focal stretch buster
Python2-Depends-Name: python
No-Python2:
X-Python3-Version: >= 3.6
Setup-Env-Vars: SKIP_PYTHON_MODULES=1

[ros_buildfarm_modules]
Depends: python-catkin-pkg-modules, python-configparser, python-empy, python-rosdistro-modules (>= 1.0.0), python-yaml, python3-empy, python3-vcstool (>= 0.1.37)
Depends3: python3-catkin-pkg-modules, python3-empy, python3-rosdistro-modules (>= 1.0.0), python3-vcstool (>= 0.1.37), python3-yaml
Conflicts: python-ros-buildfarm (<< 1.3.0)
Conflicts3: python3-ros-buildfarm (<< 1.3.0)
Replaces: python-ros-buildfarm (<< 1.3.0)
Replaces3: python3-ros-buildfarm (<< 1.3.0)
Suite: xenial yakkety zesty artful bionic cosmic disco eoan stretch buster
Suite3: xenial yakkety zesty artful bionic cosmic disco eoan focal stretch buster
Python2-Depends-Name: python
No-Python2:
X-Python3-Version: >= 3.6
Setup-Env-Vars: SKIP_PYTHON_SCRIPTS=1

0 comments on commit 0cc78ed

Please sign in to comment.