diff -Nru ros-rospkg-1.3.0/CHANGELOG.rst ros-rospkg-1.4.0/CHANGELOG.rst --- ros-rospkg-1.3.0/CHANGELOG.rst 2021-03-31 17:20:14.000000000 +0000 +++ ros-rospkg-1.4.0/CHANGELOG.rst 2022-02-25 04:43:17.000000000 +0000 @@ -1,3 +1,49 @@ +1.4.0 (2022-02-24) +------------------ +- Add OS_RASPBIAN definition. + - https://github.com/ros-infrastructure/rospkg/pull/244 +- Add Conda OS detection. + - https://github.com/ros-infrastructure/rospkg/pull/224 + - Fix syntax error in Conda detector + - https://github.com/ros-infrastructure/rospkg/pull/249 +- Avoid use of deprectated distro.linux_distribution() function. + - https://github.com/ros-infrastructure/rospkg/pull/248 +- Enable tests on python 3.10, bump actions/setup-python version. + - https://github.com/ros-infrastructure/rospkg/pull/246 +- Run tests with pytest instead of nose. + - https://github.com/ros-infrastructure/rospkg/pull/247 +- Drop support for python < 2.6. + - https://github.com/ros-infrastructure/rospkg/pull/242 +- Only add pypi dependency on distro with python >= 3.8. + - https://github.com/ros-infrastructure/rospkg/pull/245 +- Use unittest.mock where possible. + - https://github.com/ros-infrastructure/rospkg/pull/240 +- Update debian codename mapping. + - https://github.com/ros-infrastructure/rospkg/pull/238 +- Refactor CI platforms. + - https://github.com/ros-infrastructure/rospkg/pull/237 +- Fix test for riscv machines. + - https://github.com/ros-infrastructure/rospkg/pull/234 +- Add macOS Monterey to OS detection. + - https://github.com/ros-infrastructure/rospkg/pull/229 +- Remove legacy rosbuild files. + - https://github.com/ros-infrastructure/rospkg/pull/231 +- Add rosversion option to show all ROS package names and their versions. + - https://github.com/ros-infrastructure/rospkg/pull/221 +- Address problems with CI + - Require PyYAML < 6.0 for Python 2. + - Drop Travis CI configuration and Python 3.4. + - Use yaml.safe_load + - https://github.com/ros-infrastructure/rospkg/pull/228 +- Update release distributions. + - Drop support for EOL Ubuntu distros. + - Drop support for EOL Debian distros. + - Add Ubuntu Jammy and Debian Bullseye for python3 releases. + - https://github.com/ros-infrastructure/rospkg/pull/227 + - https://github.com/ros-infrastructure/rospkg/pull/236 +- Return list from ManifestManager.list(). + - https://github.com/ros-infrastructure/rospkg/pull/220 + 1.3.0 (2021-03-31) ------------------- - Fix for detecting big sur (and newer) versions of macOS diff -Nru ros-rospkg-1.3.0/CMakeLists.txt ros-rospkg-1.4.0/CMakeLists.txt --- ros-rospkg-1.3.0/CMakeLists.txt 2021-03-31 17:20:14.000000000 +0000 +++ ros-rospkg-1.4.0/CMakeLists.txt 1970-01-01 00:00:00.000000000 +0000 @@ -1,11 +0,0 @@ -cmake_minimum_required(VERSION 2.8.0) -project(rospkg) -find_package(catkin) -catkin_stack() -catkin_project(rospkg - ) -catkin_python_setup() - -install(FILES stack.yaml DESTINATION share/${PROJECT_NAME}) - -add_nosetests(${PROJECT_SOURCE_DIR}) diff -Nru ros-rospkg-1.3.0/debian/changelog ros-rospkg-1.4.0/debian/changelog --- ros-rospkg-1.3.0/debian/changelog 2021-09-02 15:41:11.000000000 +0000 +++ ros-rospkg-1.4.0/debian/changelog 2022-02-25 12:58:31.000000000 +0000 @@ -1,3 +1,15 @@ +ros-rospkg (1.4.0-1) unstable; urgency=medium + + [ Jochen Sprickerhof ] + * Drop gitlab-ci + * Drop old Breaks/Replaces + + [ Timo Röhling ] + * New upstream version 1.4.0 + * Add myself as uploader + + -- Timo Röhling Fri, 25 Feb 2022 13:58:31 +0100 + ros-rospkg (1.3.0-1) unstable; urgency=medium * Team upload. diff -Nru ros-rospkg-1.3.0/debian/control ros-rospkg-1.4.0/debian/control --- ros-rospkg-1.3.0/debian/control 2021-09-02 15:41:11.000000000 +0000 +++ ros-rospkg-1.4.0/debian/control 2022-02-25 12:58:31.000000000 +0000 @@ -2,8 +2,8 @@ Section: python Priority: optional Maintainer: Debian Science Maintainers -Uploaders: Jochen Sprickerhof , Leopold Palomo-Avellaneda -Build-Depends: debhelper-compat (= 13), dh-sequence-python3, python3-all, python3-setuptools, python3-mock, python3-nose , python3-distro , python3-catkin-pkg , python3-yaml +Uploaders: Jochen Sprickerhof , Leopold Palomo-Avellaneda , Timo Röhling +Build-Depends: debhelper-compat (= 13), dh-sequence-python3, python3-all, python3-setuptools, python3-mock , python3-pytest , python3-distro , python3-catkin-pkg , python3-yaml Standards-Version: 4.6.0 Rules-Requires-Root: no Homepage: https://wiki.ros.org/rospkg @@ -14,8 +14,6 @@ Package: python3-rospkg Architecture: all Depends: ${python3:Depends}, ${misc:Depends} -Breaks: python-rospkg (<< 1.1.10-2) -Replaces: python-rospkg (<< 1.1.10-2) Description: Robot OS package library (Python 3) This package is part of Robot OS (ROS). It is a library for retrieving information about ROS packages and stacks. The rospkg diff -Nru ros-rospkg-1.3.0/debian/gitlab-ci.yml ros-rospkg-1.4.0/debian/gitlab-ci.yml --- ros-rospkg-1.3.0/debian/gitlab-ci.yml 2021-09-02 14:59:31.000000000 +0000 +++ ros-rospkg-1.4.0/debian/gitlab-ci.yml 1970-01-01 00:00:00.000000000 +0000 @@ -1,3 +0,0 @@ -include: - - https://salsa.debian.org/salsa-ci-team/pipeline/raw/master/salsa-ci.yml - - https://salsa.debian.org/salsa-ci-team/pipeline/raw/master/pipeline-jobs.yml diff -Nru ros-rospkg-1.3.0/debian/patches/0003-Set-rosversion-to-Debian.patch ros-rospkg-1.4.0/debian/patches/0003-Set-rosversion-to-Debian.patch --- ros-rospkg-1.3.0/debian/patches/0003-Set-rosversion-to-Debian.patch 2021-09-02 15:41:11.000000000 +0000 +++ ros-rospkg-1.4.0/debian/patches/0003-Set-rosversion-to-Debian.patch 2022-02-25 12:58:31.000000000 +0000 @@ -7,10 +7,10 @@ 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rospkg/rosversion.py b/src/rospkg/rosversion.py -index e8ef820..f6bca76 100644 +index 4c41d73..65f815f 100644 --- a/src/rospkg/rosversion.py +++ b/src/rospkg/rosversion.py -@@ -95,7 +95,7 @@ def main(): +@@ -121,7 +121,7 @@ def main(): else: distro_name = get_distro_name_from_roscore() if not distro_name: diff -Nru ros-rospkg-1.3.0/debian/rules ros-rospkg-1.4.0/debian/rules --- ros-rospkg-1.3.0/debian/rules 2021-09-02 15:41:11.000000000 +0000 +++ ros-rospkg-1.4.0/debian/rules 2022-02-25 12:58:31.000000000 +0000 @@ -1,6 +1,4 @@ #!/usr/bin/make -f -export PYBUILD_TEST_NOSE=1 - %: dh $@ --buildsystem=pybuild diff -Nru ros-rospkg-1.3.0/doc/developers_guide.rst ros-rospkg-1.4.0/doc/developers_guide.rst --- ros-rospkg-1.3.0/doc/developers_guide.rst 2021-03-31 17:20:14.000000000 +0000 +++ ros-rospkg-1.4.0/doc/developers_guide.rst 2022-02-25 04:43:17.000000000 +0000 @@ -45,11 +45,11 @@ :: - pip install nose + pip install pytest pip install mock -rospkg uses `Python nose `_ +rospkg uses `pytest `_ for testing, which is a fairly simple and straightfoward test framework. You just have to write a function start with the name ``test`` and use normal ``assert`` statements for your tests. @@ -62,7 +62,7 @@ :: cd rospkg - nosetests test/*.py --with-coverage --cover-package=rospkg + pytest test --cov=rospkg Documentation diff -Nru ros-rospkg-1.3.0/.github/workflows/ci.yaml ros-rospkg-1.4.0/.github/workflows/ci.yaml --- ros-rospkg-1.3.0/.github/workflows/ci.yaml 2021-03-31 17:20:14.000000000 +0000 +++ ros-rospkg-1.4.0/.github/workflows/ci.yaml 2022-02-25 04:43:17.000000000 +0000 @@ -4,56 +4,35 @@ push: branches: [master] pull_request: - branches: ['*'] jobs: build: strategy: matrix: - os: [ubuntu-16.04, ubuntu-18.04, ubuntu-20.04, macos-latest] - python: [2.7, 3.5, 3.6, 3.7, 3.8, 3.9] - exclude: - - os: ubuntu-16.04 - python: 3.6 - - os: ubuntu-16.04 - python: 3.7 - - os: ubuntu-16.04 - python: 3.8 - - os: ubuntu-16.04 - python: 3.9 + os: [ubuntu-latest, macos-latest] + python: ['3.7', '3.8', '3.9', '3.10'] + include: - os: ubuntu-18.04 - python: 3.5 + python: '2.7' - os: ubuntu-18.04 - python: 3.6 - - os: ubuntu-20.04 - python: 2.7 - - os: ubuntu-20.04 - python: 3.5 - - os: ubuntu-20.04 - python: 3.6 - - os: ubuntu-20.04 - python: 3.7 - - os: macos-latest - python: 3.5 - - os: macos-latest - python: 3.6 + python: '3.6' name: rospkg tests runs-on: ${{matrix.os}} steps: - uses: actions/checkout@v2 - name: Set up Python ${{matrix.python}} - uses: actions/setup-python@v1 + uses: actions/setup-python@v2 with: python-version: ${{matrix.python}} - name: Install dependencies run: | if test ${{matrix.python}} = 2.7; then - python -m pip install pyparsing==2.4.7 + python -m pip install pyparsing==2.4.7 'PyYAML<6.0' fi python -m pip install --upgrade pip setuptools - python -m pip install nose coverage mock + python -m pip install mock pytest pytest-cov python setup.py build develop - name: Run tests run: | - python -m nose --with-coverage --cover-package=rospkg --with-xunit test + python -m pytest --cov=rospkg test diff -Nru ros-rospkg-1.3.0/.gitignore ros-rospkg-1.4.0/.gitignore --- ros-rospkg-1.3.0/.gitignore 2021-03-31 17:20:14.000000000 +0000 +++ ros-rospkg-1.4.0/.gitignore 2022-02-25 04:43:17.000000000 +0000 @@ -6,7 +6,6 @@ *~ *.log .coverage -nosetests.xml src/rospkg.egg-info syntax: regexp (target|build|dist)/.* diff -Nru ros-rospkg-1.3.0/Makefile ros-rospkg-1.4.0/Makefile --- ros-rospkg-1.3.0/Makefile 2021-03-31 17:20:14.000000000 +0000 +++ ros-rospkg-1.4.0/Makefile 2022-02-25 04:43:17.000000000 +0000 @@ -27,4 +27,4 @@ echo "running rospkg tests" test: testsetup - cd test && nosetests && nosetests3 + cd test && pytest && pytest-3 diff -Nru ros-rospkg-1.3.0/manifest.xml ros-rospkg-1.4.0/manifest.xml --- ros-rospkg-1.3.0/manifest.xml 2021-03-31 17:20:14.000000000 +0000 +++ ros-rospkg-1.4.0/manifest.xml 1970-01-01 00:00:00.000000000 +0000 @@ -1,19 +0,0 @@ - - - - - Standalone Python library for the ROS package system. - - - Ken Conley/kwc@willowgarage.com - BSD - - http://ros.org/wiki/rospkg - - - - - - - - diff -Nru ros-rospkg-1.3.0/setup.py ros-rospkg-1.4.0/setup.py --- ros-rospkg-1.3.0/setup.py 2021-03-31 17:20:14.000000000 +0000 +++ ros-rospkg-1.4.0/setup.py 2022-02-25 04:43:17.000000000 +0000 @@ -1,7 +1,6 @@ #!/usr/bin/env python import os -import sys from setuptools import setup @@ -11,14 +10,14 @@ 'SKIP_PYTHON_MODULES' not in os.environ and 'SKIP_PYTHON_SCRIPTS' not in os.environ ): - install_requires.append('distro') + install_requires.append("distro >= 1.4.0; python_version >= '3.8'") kwargs = { 'name': 'rospkg', # same version as in: # - src/rospkg/__init__.py # - stdeb.cfg - 'version': '1.3.0', + 'version': '1.4.0', 'packages': ['rospkg'], 'package_dir': {'': 'src'}, 'entry_points': { @@ -39,9 +38,6 @@ 'license': 'BSD' } -if sys.version_info[0] == 2 and sys.version_info[1] < 7: - kwargs['install_requires'].append('argparse') - if 'SKIP_PYTHON_MODULES' in os.environ: kwargs['packages'] = [] kwargs['package_dir'] = {} diff -Nru ros-rospkg-1.3.0/src/rospkg/distro.py ros-rospkg-1.4.0/src/rospkg/distro.py --- ros-rospkg-1.3.0/src/rospkg/distro.py 2021-03-31 17:20:14.000000000 +0000 +++ ros-rospkg-1.4.0/src/rospkg/distro.py 2022-02-25 04:43:17.000000000 +0000 @@ -192,14 +192,14 @@ if os.path.isfile(source_uri): # load rosdistro file with open(source_uri) as f: - raw_data = yaml.load(f.read()) + raw_data = yaml.safe_load(f.read()) else: try: request = urlopen(source_uri) except Exception as e: raise ResourceNotFound('%s (%s)' % (str(e), source_uri)) try: - raw_data = yaml.load(request) + raw_data = yaml.safe_load(request) except ValueError: raise ResourceNotFound(source_uri) if not type(raw_data) == dict: diff -Nru ros-rospkg-1.3.0/src/rospkg/__init__.py ros-rospkg-1.4.0/src/rospkg/__init__.py --- ros-rospkg-1.3.0/src/rospkg/__init__.py 2021-03-31 17:20:14.000000000 +0000 +++ ros-rospkg-1.4.0/src/rospkg/__init__.py 2022-02-25 04:43:17.000000000 +0000 @@ -45,7 +45,7 @@ # same version as in: # - setup.py # - stdeb.cfg -__version__ = '1.3.0' +__version__ = '1.4.0' __all__ = ( 'MANIFEST_FILE', 'ResourceNotFound', 'STACK_FILE', diff -Nru ros-rospkg-1.3.0/src/rospkg/os_detect.py ros-rospkg-1.4.0/src/rospkg/os_detect.py --- ros-rospkg-1.3.0/src/rospkg/os_detect.py 2021-03-31 17:20:14.000000000 +0000 +++ ros-rospkg-1.4.0/src/rospkg/os_detect.py 2022-02-25 04:43:17.000000000 +0000 @@ -138,7 +138,9 @@ """ def __init__(self, lsb_name, get_version_fn=None): self.lsb_name = lsb_name - if hasattr(distro, "linux_distribution"): + if distro.__name__ == "distro": + self.lsb_info = (distro.id(), distro.version(), distro.codename()) + elif hasattr(distro, "linux_distribution"): self.lsb_info = distro.linux_distribution(full_distribution_name=0) elif hasattr(distro, "dist"): self.lsb_info = distro.dist() @@ -169,16 +171,17 @@ def get_codename(self): if self.is_os(): - v = self.get_version() - if v.startswith('7.'): - return 'wheezy' - if v.startswith('8.'): - return 'jessie' - if v.startswith('9.'): - return 'stretch' - if v.startswith('10.'): - return 'buster' - return '' + v = self.get_version().split('.', 1)[0] + return { + '7': 'wheezy', + '8': 'jessie', + '9': 'stretch', + '10': 'buster', + '11': 'bullseye', + '12': 'bookworm', + '13': 'trixie', + 'unstable': 'sid', + }.get(v, '') class FdoDetect(OsDetector): @@ -242,6 +245,26 @@ raise OsNotDetected('called in incorrect OS') +class Conda(OsDetector): + """ + Detect Conda. + """ + def is_os(self): + return "ROS_OS_OVERRIDE" in os.environ and \ + (os.environ["ROS_OS_OVERRIDE"].lower().startswith("robostack") or + os.environ["ROS_OS_OVERRIDE"].lower().startswith("conda")) + + def get_version(self): + if self.is_os(): + return "" + raise OsNotDetected('called in incorrect OS') + + def get_codename(self): + if self.is_os(): + return "" + raise OsNotDetected('called in incorrect OS') + + class OpenSuse(OsDetector): """ Detect OpenSuse OS. @@ -292,7 +315,8 @@ '10.13': 'high sierra', '10.14': 'mojave', '10.15': 'catalina', - '11': 'big sur' + '11': 'big sur', + '12': 'monterey' } @@ -645,11 +669,13 @@ OS_OPENSUSE = 'opensuse' OS_OPENSUSE13 = 'opensuse' OS_ORACLE = 'oracle' +OS_CONDA = 'conda' OS_TIZEN = 'tizen' OS_SAILFISHOS = 'sailfishos' OS_OSX = 'osx' OS_POP = 'pop' OS_QNX = 'qnx' +OS_RASPBIAN = 'raspbian' OS_RHEL = 'rhel' OS_ROCKY = 'rocky' OS_SLACKWARE = 'slackware' @@ -686,6 +712,7 @@ OsDetect.register_default(OS_OPENSUSE, FdoDetect("opensuse-leap")) OsDetect.register_default(OS_OPENSUSE, FdoDetect("opensuse")) OsDetect.register_default(OS_ORACLE, FdoDetect("ol")) +OsDetect.register_default(OS_CONDA, Conda()) OsDetect.register_default(OS_TIZEN, FdoDetect("tizen")) OsDetect.register_default(OS_SAILFISHOS, FdoDetect("sailfishos")) OsDetect.register_default(OS_OSX, OSX()) diff -Nru ros-rospkg-1.3.0/src/rospkg/rospack.py ros-rospkg-1.4.0/src/rospkg/rospack.py --- ros-rospkg-1.3.0/src/rospkg/rospack.py 2021-03-31 17:20:14.000000000 +0000 +++ ros-rospkg-1.4.0/src/rospkg/rospack.py 2022-02-25 04:43:17.000000000 +0000 @@ -194,7 +194,7 @@ :returns: complete list of package names in ROS environment, ``[str]`` """ self._update_location_cache() - return self._location_cache.keys() + return list(self._location_cache.keys()) def get_path(self, name): """ diff -Nru ros-rospkg-1.3.0/src/rospkg/rosversion.py ros-rospkg-1.4.0/src/rospkg/rosversion.py --- ros-rospkg-1.3.0/src/rospkg/rosversion.py 2021-03-31 17:20:14.000000000 +0000 +++ ros-rospkg-1.4.0/src/rospkg/rosversion.py 2022-02-25 04:43:17.000000000 +0000 @@ -69,6 +69,29 @@ print(argtext, end='') +def get_version_from_package_name(package): + rosstack = RosStack() + try: + version = rosstack.get_stack_version(package) + except ResourceNotFound as e: + try: + # hack to make it work with wet packages + mm = ManifestManager(PACKAGE_FILE) + path = mm.get_path(package) + package_manifest = os.path.join(path, 'package.xml') + if os.path.exists(package_manifest): + from xml.etree.ElementTree import ElementTree + try: + root = ElementTree(None, package_manifest) + version = root.findtext('version') + except Exception: + pass + except ResourceNotFound as e: + print('Cannot locate [%s]' % package) + sys.exit(1) + return version + + def main(): parser = argparse.ArgumentParser( description='rosversion -d: Output the version of the given package\n' @@ -84,6 +107,9 @@ group.add_argument( '-d', '--distro', action='store_true', help='Output the ROS distribution name') + group.add_argument( + '-a', '--all', action='store_true', + help='Show all ROS package names and their versions') args = parser.parse_args() @@ -99,26 +125,15 @@ printer(distro_name) sys.exit(0) - rosstack = RosStack() - try: - version = rosstack.get_stack_version(args.package) - except ResourceNotFound as e: - try: - # hack to make it work with wet packages - mm = ManifestManager(PACKAGE_FILE) - path = mm.get_path(args.package) - package_manifest = os.path.join(path, 'package.xml') - if os.path.exists(package_manifest): - from xml.etree.ElementTree import ElementTree - try: - root = ElementTree(None, package_manifest) - version = root.findtext('version') - except Exception: - pass - except ResourceNotFound as e: - print('Cannot locate [%s]' % args.package) - sys.exit(1) + if args.all: + rospack = RosPack() + for package in rospack.list(): + printer( + '{}: {}'.format( + package, get_version_from_package_name(package))) + sys.exit(0) + version = get_version_from_package_name(args.package) if version is None: version = '' printer(version) diff -Nru ros-rospkg-1.3.0/stdeb.cfg ros-rospkg-1.4.0/stdeb.cfg --- ros-rospkg-1.3.0/stdeb.cfg 2021-03-31 17:20:14.000000000 +0000 +++ ros-rospkg-1.4.0/stdeb.cfg 2022-02-25 04:43:17.000000000 +0000 @@ -3,28 +3,28 @@ ; rospkg-modules same version as in: ; - setup.py ; - src/rospkg/__init__.py -Depends: python-argparse, python-rospkg-modules (>= 1.3.0) +Depends: python-rospkg-modules (>= 1.4.0) ; rospkg-modules same version as in: ; - setup.py ; - src/rospkg/__init__.py -Depends3: python3-rospkg-modules (>= 1.3.0) +Depends3: python3-rospkg-modules (>= 1.4.0) Conflicts: python3-rospkg Conflicts3: python-rospkg -Suite: xenial yakkety zesty artful bionic cosmic disco eoan jessie stretch buster -Suite3: xenial yakkety zesty artful bionic cosmic disco eoan focal jessie stretch buster +Suite: bionic buster +Suite3: bionic focal jammy buster bullseye Python2-Depends-Name: python X-Python3-Version: >= 3.4 Setup-Env-Vars: SKIP_PYTHON_MODULES=1 [rospkg_modules] Depends: python-catkin-pkg-modules, python-yaml, lsb-release -Depends3: python3-catkin-pkg-modules, python3-distro | python3 (<< 3.8), python3-yaml, lsb-release +Depends3: python3-catkin-pkg-modules, python3-distro (>= 1.4.0) | python3 (<< 3.8), python3-yaml, lsb-release Conflicts: python-rospkg (<< 1.1.0) Conflicts3: python3-rospkg (<< 1.1.0) Replaces: python-rospkg (<< 1.1.0) Replaces3: python3-rospkg (<< 1.1.0) -Suite: xenial yakkety zesty artful bionic cosmic disco eoan jessie stretch buster -Suite3: xenial yakkety zesty artful bionic cosmic disco eoan focal jessie stretch buster +Suite: bionic buster +Suite3: bionic focal jammy buster bullseye Python2-Depends-Name: python X-Python3-Version: >= 3.4 Setup-Env-Vars: SKIP_PYTHON_SCRIPTS=1 diff -Nru ros-rospkg-1.3.0/test/setup.cfg ros-rospkg-1.4.0/test/setup.cfg --- ros-rospkg-1.3.0/test/setup.cfg 2021-03-31 17:20:14.000000000 +0000 +++ ros-rospkg-1.4.0/test/setup.cfg 1970-01-01 00:00:00.000000000 +0000 @@ -1,4 +0,0 @@ -[nosetests] -with-coverage=1 -cover-package=rospkg -with-xunit=1 diff -Nru ros-rospkg-1.3.0/test/test_rospkg_distro.py ros-rospkg-1.4.0/test/test_rospkg_distro.py --- ros-rospkg-1.3.0/test/test_rospkg_distro.py 2021-03-31 17:20:14.000000000 +0000 +++ ros-rospkg-1.4.0/test/test_rospkg_distro.py 2022-02-25 04:43:17.000000000 +0000 @@ -315,7 +315,7 @@ assert distro.release_name == 'simple', distro.release_name assert distro.version == '1', distro.version - assert yaml.load(open(p)) == distro.raw_data, distro.raw_data + assert yaml.safe_load(open(p)) == distro.raw_data, distro.raw_data assert set(distro.variants.keys()) == set(['base']) assert set(distro.stacks.keys()) == set(['stack1']) @@ -334,7 +334,7 @@ assert distro.release_name == 'diamondback', distro.release_name assert distro.version == 'r8596', distro.version - assert yaml.load(open(p)) == distro.raw_data, distro.raw_data + assert yaml.safe_load(open(p)) == distro.raw_data, distro.raw_data assert set(distro.variants.keys()) == set(diamondback_variants) assert set(distro.stacks.keys()) == set(diamondback_stacks), set(distro.stacks.keys()) ^ set(diamondback_stacks) @@ -350,7 +350,7 @@ def test__load_variants(): from rospkg.distro import _load_variants - raw_data = yaml.load("""variants: + raw_data = yaml.safe_load("""variants: - ros-base: stacks: [ros, ros_comm] - ros-full: diff -Nru ros-rospkg-1.3.0/test/test_rospkg_os_detect.py ros-rospkg-1.4.0/test/test_rospkg_os_detect.py --- ros-rospkg-1.3.0/test/test_rospkg_os_detect.py 2021-03-31 17:20:14.000000000 +0000 +++ ros-rospkg-1.4.0/test/test_rospkg_os_detect.py 2022-02-25 04:43:17.000000000 +0000 @@ -34,8 +34,10 @@ import os -import mock -from mock import patch +try: + from unittest.mock import Mock, patch +except ImportError: + from mock import Mock, patch class TrueOs(): @@ -108,10 +110,20 @@ else: import platform as distro - distro.linux_distribution = mock.Mock() - distro.linux_distribution.return_value = ('Ubuntu', '10.04', 'lucid') - distro.dist = mock.Mock() - distro.dist.return_value = ('Ubuntu', '10.04', 'lucid') + # Mock different interfaces based on the module used. + if distro.__name__ == 'distro': + distro.id = Mock() + distro.id.return_value = 'Ubuntu' + distro.version = Mock() + distro.version.return_value = '10.04' + distro.codename = Mock() + distro.codename.return_value = 'lucid' + elif hasattr(distro, 'linux_distribution'): + distro.linux_distribution = Mock() + distro.linux_distribution.return_value = ('Ubuntu', '10.04', 'lucid') + elif hasattr(distro, 'dist'): + distro.dist = Mock() + distro.dist.return_value = ('Ubuntu', '10.04', 'lucid') detect = LsbDetect('Ubuntu') assert detect.is_os(), "should be Ubuntu" @@ -391,7 +403,7 @@ def test_tripwire_uname_get_machine(): from rospkg.os_detect import uname_get_machine retval = uname_get_machine() - assert retval in [None, 'aarch64', 'armv7l', 'armv8l', 'i386', 'i686', 'ppc', 'ppc64', 'ppc64le', 's390', 's390x', 'x86_64'] + assert retval in [None, 'aarch64', 'armv7l', 'armv8l', 'i386', 'i686', 'ppc', 'ppc64', 'ppc64le', 'riscv32', 'riscv64', 's390', 's390x', 'x86_64'] def test_tripwire_rhel(): diff -Nru ros-rospkg-1.3.0/test/test_rospkg_packages.py ros-rospkg-1.4.0/test/test_rospkg_packages.py --- ros-rospkg-1.3.0/test/test_rospkg_packages.py 2021-03-31 17:20:14.000000000 +0000 +++ ros-rospkg-1.4.0/test/test_rospkg_packages.py 2022-02-25 04:43:17.000000000 +0000 @@ -314,13 +314,15 @@ from rospkg import __version__ from rospkg import get_package_name - # test dir is a subdirectory of this package test_dir = get_package_test_path() - assert get_package_name(test_dir) in ['rospkg', 'rospkg-%s' % __version__], get_package_name(test_dir) test_dir_foo = os.path.join(test_dir, 'p1', 'foo') assert 'foo' == get_package_name(test_dir_foo) + # baz dir is a subdirectory of foo package + test_dir_foo_baz = os.path.join(test_dir_foo, 'baz') + assert 'foo' == get_package_name(test_dir_foo_baz) + # test with path outside of our hierarchy assert get_package_name(tempfile.tempdir) is None diff -Nru ros-rospkg-1.3.0/.travis.yml ros-rospkg-1.4.0/.travis.yml --- ros-rospkg-1.3.0/.travis.yml 2021-03-31 17:20:14.000000000 +0000 +++ ros-rospkg-1.4.0/.travis.yml 1970-01-01 00:00:00.000000000 +0000 @@ -1,14 +0,0 @@ -language: python -python: - - "3.4" -# command to install dependencies -install: -# develop seems to be required by travis since 02/2013 - - if [ $TRAVIS_PYTHON_VERSION == "2.7" -o $TRAVIS_PYTHON_VERSION == "3.4" ]; then pip install pyparsing==2.4.7; fi - - python setup.py build develop - - pip install nose coverage -# command to run tests -script: - - nosetests --with-coverage --cover-package=rospkg --with-xunit test -notifications: - email: false