Update upstream source from tag 'upstream/0.5.0'
Update to upstream version '0.5.0'
with Debian dir 9dcd1ad5d9f8719729d302e8a2aae4ff30759fb0
Jochen Sprickerhof
2 years ago
9 | 9 | strategy: |
10 | 10 | matrix: |
11 | 11 | os: [ubuntu-latest, macos-latest] |
12 | python: [3.7, 3.8, 3.9] | |
12 | python: ['3.7', '3.8', '3.9', '3.10'] | |
13 | 13 | include: |
14 | 14 | - os: ubuntu-18.04 |
15 | python: 2.7 | |
16 | - os: macos-latest | |
17 | python: 2.7 | |
15 | python: '2.7' | |
18 | 16 | - os: ubuntu-18.04 |
19 | python: 3.6 | |
17 | python: '3.6' | |
20 | 18 | name: catkin_pkg tests |
21 | 19 | runs-on: ${{matrix.os}} |
22 | 20 | |
23 | 21 | steps: |
24 | 22 | - uses: actions/checkout@v2 |
25 | 23 | - name: Set up Python ${{matrix.python}} |
26 | uses: actions/setup-python@v1 | |
24 | uses: actions/setup-python@v2 | |
27 | 25 | with: |
28 | 26 | python-version: ${{matrix.python}} |
29 | 27 | - name: Install dependencies |
30 | 28 | run: | |
31 | python -m pip install argparse coverage docutils mock nose pyparsing python-dateutil | |
32 | python -m pip install flake8 flake8-blind-except flake8-builtins flake8-class-newline flake8-comprehensions flake8-deprecated flake8-docstrings flake8-import-order flake8-quotes | |
29 | python -m pip install -U -e .[test] | |
33 | 30 | - name: Run tests |
34 | 31 | run: | |
35 | python -m nose -s --tests test | |
32 | python -m pytest -s test |
0 | language: python | |
1 | os: linux | |
2 | dist: xenial | |
3 | python: | |
4 | - "2.7" | |
5 | - "3.4" | |
6 | - "3.5" | |
7 | - "3.6" | |
8 | - "3.7" | |
9 | - "3.8" | |
10 | # command to install dependencies | |
11 | install: | |
12 | # newer versions of docutils dropped support for Python 3.4 | |
13 | - if [ $TRAVIS_PYTHON_VERSION == "3.4" ]; then pip install docutils==0.15.2; else pip install docutils; fi | |
14 | - pip install nose coverage argparse python-dateutil pyparsing | |
15 | - pip install flake8 flake8-blind-except flake8-builtins flake8-class-newline flake8-comprehensions flake8-deprecated flake8-docstrings flake8-import-order flake8-quotes | |
16 | # command to run tests | |
17 | script: | |
18 | - nosetests -s --tests test | |
19 | notifications: | |
20 | email: false |
0 | 0.5.0 (2022-05-10) | |
1 | ================== | |
2 | ||
3 | - Remove references to Travis CI. `#314 <https://github.com/ros-infrastructure/catkin_pkg/pull/314>`_ | |
4 | - Drop python 2.7 on macOS. `#318 <https://github.com/ros-infrastructure/catkin_pkg/pull/318>`_ | |
5 | - Update release suites. `#317 <https://github.com/ros-infrastructure/catkin_pkg/pull/317>`_ | |
6 | - Use unittest.mock where possible. `#321 <https://github.com/ros-infrastructure/catkin_pkg/pull/321>`_ | |
7 | - Declare test dependencies in extras_require.test. `#323 <https://github.com/ros-infrastructure/catkin_pkg/pull/323>`_ | |
8 | - Drop support for Python < 2.7 (2.7 itself is still supported). `#322 <https://github.com/ros-infrastructure/catkin_pkg/pull/322>`_ | |
9 | - Run tests with pytest instead of nose. `#324 <https://github.com/ros-infrastructure/catkin_pkg/pull/324>`_ | |
10 | - Enable Python 3.10 tests, bump actions/setup-python. `#325 <https://github.com/ros-infrastructure/catkin_pkg/pull/325>`_ | |
11 | - Mark linter test and declare cov/junit module name. `#327 <https://github.com/ros-infrastructure/catkin_pkg/pull/327>`_ | |
12 | - Add plaintext_description field to Package. `#305 <https://github.com/ros-infrastructure/catkin_pkg/pull/305>`_ | |
13 | - Use only first line of plaintext description in distutils setup generation. `#326 <https://github.com/ros-infrastructure/catkin_pkg/pull/326>`_ | |
14 | - Update catkin_prepare_release to support setup.py files in ament_python packages. `#331 <https://github.com/ros-infrastructure/catkin_pkg/pull/331>`_ | |
15 | - This pull requests introduces an API change! | |
16 | ``catkin_pkg.package_version.update_packages`` now takes the full dict of package Paths: Package objects instead of just the paths. | |
17 | - Make filenames to be used as ignore markers configurable. `#307 <https://github.com/ros-infrastructure/catkin_pkg/pull/307>`_ | |
18 | - Fix catkin_package_version after API change. `#333 <https://github.com/ros-infrastructure/catkin_pkg/pull/333>`_ | |
19 | ||
20 | Contributors | |
21 | ------------ | |
22 | ||
23 | - Jan Strohbeck | |
24 | - Scott K Logan | |
25 | - Steven! Ragnarök | |
26 | - Tomáš Hrnčiar | |
27 | - William Woodall |
26 | 26 | echo "running ${NAME} tests" |
27 | 27 | |
28 | 28 | test: testsetup |
29 | cd test && nosetests && nosetests3 | |
29 | cd test && pytest && pytest-3 |
15 | 15 | Continuous Integration |
16 | 16 | ---------------------- |
17 | 17 | |
18 | +--------------------------------------------------------------------------+--------------------------------------------------------------------+ | |
19 | | `Build Status <https://travis-ci.org/ros-infrastructure/catkin_pkg>`_. | .. image:: https://travis-ci.org/ros-infrastructure/catkin_pkg.png | | |
20 | +--------------------------------------------------------------------------+--------------------------------------------------------------------+ | |
18 | .. image:: https://github.com/ros-infrastructure/catkin_pkg/actions/workflows/ci.yaml/badge.svg?branch=master&event=push | |
19 | :target: https://github.com/ros-infrastructure/catkin_pkg/actions/workflows/ci.yaml?query=branch%3Amaster+event%3Apush |
0 | [tool:pytest] | |
1 | junit_suite_name = catkin_pkg | |
2 | markers = | |
3 | flake8 | |
4 | linter | |
5 | ||
6 | [coverage:run] | |
7 | source = catkin_pkg |
0 | 0 | #!/usr/bin/env python |
1 | 1 | |
2 | 2 | import os |
3 | import sys | |
4 | 3 | |
5 | 4 | from setuptools import setup |
6 | 5 | |
7 | install_requires = [ | |
8 | 'docutils', | |
9 | 'python-dateutil', | |
10 | 'pyparsing', | |
11 | ] | |
12 | ||
13 | # argparse is part of the standard library since Python 2.7 | |
14 | if sys.version_info[0] == 2 and sys.version_info[1] < 7: | |
15 | install_requires.append('argparse') | |
16 | 6 | |
17 | 7 | kwargs = { |
18 | 8 | 'name': 'catkin_pkg', |
19 | 9 | # same version as in: |
20 | 10 | # - src/catkin_pkg/__init__.py |
21 | 11 | # - stdeb.cfg |
22 | 'version': '0.4.24', | |
12 | 'version': '0.5.0', | |
23 | 13 | 'packages': ['catkin_pkg', 'catkin_pkg.cli'], |
24 | 14 | 'package_dir': {'': 'src'}, |
25 | 15 | 'package_data': {'catkin_pkg': ['templates/*.in']}, |
44 | 34 | 'description': 'catkin package library', |
45 | 35 | 'long_description': 'Library for retrieving information about catkin packages.', |
46 | 36 | 'license': 'BSD', |
47 | 'install_requires': install_requires, | |
37 | 'install_requires': [ | |
38 | 'docutils', | |
39 | 'python-dateutil', | |
40 | 'pyparsing', | |
41 | 'setuptools', | |
42 | ], | |
43 | 'extras_require': { | |
44 | 'test': [ | |
45 | 'flake8', | |
46 | 'flake8-blind-except', | |
47 | 'flake8-builtins', | |
48 | 'flake8-class-newline', | |
49 | 'flake8-comprehensions', | |
50 | 'flake8-deprecated', | |
51 | 'flake8-docstrings', | |
52 | 'flake8-import-order', | |
53 | 'flake8-quotes', | |
54 | "mock; python_version < '3.3'", | |
55 | 'pytest', | |
56 | ]}, | |
48 | 57 | } |
49 | 58 | if 'SKIP_PYTHON_MODULES' in os.environ: |
50 | 59 | kwargs['packages'] = [] |
34 | 34 | # same version as in: |
35 | 35 | # - setup.py |
36 | 36 | # - stdeb.cfg |
37 | __version__ = '0.4.24' | |
37 | __version__ = '0.5.0' |
32 | 32 | else: |
33 | 33 | # bump the version number |
34 | 34 | new_version = bump_version(version, args.bump) |
35 | update_versions(packages.keys(), new_version) | |
35 | update_versions(packages, new_version) | |
36 | 36 | print('%s -> %s' % (version, new_version)) |
37 | 37 | except Exception as e: # noqa: B902 |
38 | 38 | sys.exit(str(e)) |
132 | 132 | def commit_files(base_path, vcs_type, packages, packages_with_changelogs, message, dry_run=False): |
133 | 133 | cmd = [_find_executable(vcs_type), 'commit', '-m', message] |
134 | 134 | cmd += [os.path.join(p, PACKAGE_MANIFEST_FILENAME) for p in packages.keys()] |
135 | cmd += [s for s in [os.path.join(p, 'setup.py') for p in packages.keys()] if os.path.exists(s)] | |
135 | 136 | cmd += [path for path, _, _ in packages_with_changelogs.values()] |
136 | 137 | if not dry_run: |
137 | 138 | try: |
265 | 266 | # complain about packages with upper case character since they won't be releasable with bloom |
266 | 267 | unsupported_pkg_names = [] |
267 | 268 | invalid_pkg_names = [] |
269 | valid_build_types = ['catkin', 'ament_cmake', 'ament_python'] | |
268 | 270 | for package in packages.values(): |
269 | build_types = [export.content for export in package.exports if export.tagname == 'build_type'] | |
270 | build_type = build_types[0] if build_types else 'catkin' | |
271 | if build_type not in ('catkin', 'ament_cmake'): | |
271 | build_type = package.get_build_type() | |
272 | if build_type not in valid_build_types: | |
272 | 273 | unsupported_pkg_names.append(package.name) |
273 | 274 | if package.name != package.name.lower(): |
274 | 275 | invalid_pkg_names.append(package.name) |
275 | 276 | if unsupported_pkg_names: |
276 | 277 | print( |
277 | 278 | fmt( |
278 | "@{yf}Warning: the following package are not of build_type catkin or ament_cmake and may require manual steps to release': %s" % | |
279 | "@{yf}Warning: the following package are not of build_type %s and may require manual steps to release': %s" % | |
280 | str(valid_build_types), | |
279 | 281 | ', '.join([('@{boldon}%s@{boldoff}' % p) for p in sorted(unsupported_pkg_names)]) |
280 | 282 | ), file=sys.stderr) |
281 | 283 | if not args.non_interactive and not prompt_continue('Continue anyway', default=False): |
303 | 305 | raise RuntimeError(fmt( |
304 | 306 | "@{rf}Invalid metapackage at path '@{boldon}%s@{boldoff}':\n %s\n\nSee requirements for metapackages: %s" % |
305 | 307 | (os.path.abspath(pkg_path), str(e), metapackage.DEFINITION_URL))) |
308 | # verify that the setup.py files don't have modifications pending | |
309 | setup_py_path = os.path.join(pkg_path, 'setup.py') | |
310 | if os.path.exists(setup_py_path) and has_changes(base_path, setup_py_path, vcs_type): | |
311 | local_modifications.append(setup_py_path) | |
306 | 312 | |
307 | 313 | # fetch current version and verify that all packages have same version number |
308 | 314 | old_version = verify_equal_package_versions(packages.values()) |
379 | 385 | (new_version, ', '.join([('@{boldon}%s@{boldoff}' % p) for p in sorted(missing_changelogs_but_forthcoming.keys())])))) |
380 | 386 | |
381 | 387 | # bump version number |
382 | update_versions(packages.keys(), new_version) | |
388 | update_versions(packages, new_version) | |
383 | 389 | print(fmt("@{gf}Bump version@{reset} of all packages from '@{bf}%s@{reset}' to '@{bf}@{boldon}%s@{boldoff}@{reset}'" % (old_version, new_version))) |
384 | 390 | |
385 | 391 | pushed = None |
59 | 59 | 'version', |
60 | 60 | 'version_compatibility', |
61 | 61 | 'description', |
62 | 'plaintext_description', | |
62 | 63 | 'maintainers', |
63 | 64 | 'licenses', |
64 | 65 | 'urls', |
623 | 624 | |
624 | 625 | # description |
625 | 626 | pkg.description = _get_node_value(_get_node(root, 'description', filename), allow_xml=True, apply_str=False) |
627 | pkg.plaintext_description = re.sub(' +(\n+) +', r'\1', _get_node_text(_get_node(root, 'description', filename)), flags=re.MULTILINE) | |
626 | 628 | |
627 | 629 | # at least one maintainer, all must have email |
628 | 630 | maintainers = _get_nodes(root, 'maintainer') |
803 | 805 | return value |
804 | 806 | |
805 | 807 | |
808 | def _get_node_text(node, strip=True): | |
809 | value = '' | |
810 | for child in node.childNodes: | |
811 | if child.nodeType == child.TEXT_NODE: | |
812 | value += re.sub(r'\s+', ' ', child.data) | |
813 | elif child.nodeType == child.ELEMENT_NODE: | |
814 | if child.tagName == 'br': | |
815 | value += '\n' | |
816 | else: | |
817 | value += _get_node_text(child, strip=False) | |
818 | else: | |
819 | assert 'unreachable' | |
820 | if strip: | |
821 | value = value.strip() | |
822 | return value | |
823 | ||
824 | ||
806 | 825 | def _get_node_attr(node, attr, default=False): |
807 | 826 | """:param default: False means value is required.""" |
808 | 827 | if node.hasAttribute(attr): |
83 | 83 | return new_package_str |
84 | 84 | |
85 | 85 | |
86 | def _replace_setup_py_version(setup_py_str, new_version): | |
87 | """ | |
88 | Replace the version tag in contents if there is only one instance and it is using a literal as the version. | |
89 | ||
90 | :param str package_str: contents of setup.py | |
91 | :param str new_version: new version number | |
92 | :returns: new setup.py string | |
93 | :rtype: str | |
94 | :raises RuntimeError: | |
95 | """ | |
96 | # try to replace contents | |
97 | new_setup_py_str, number_of_subs = re.subn( | |
98 | r'version=([\'"])\d+\.\d+\.\d+([\'"]),', | |
99 | r'version=\g<1>%s\g<2>,' % new_version, | |
100 | setup_py_str) | |
101 | if number_of_subs == 0: | |
102 | raise RuntimeError("Failed to find a normal version statement, e.g.: version='1.2.3',") | |
103 | if number_of_subs != 1: | |
104 | raise RuntimeError('Illegal number of version statements: %s' % (number_of_subs)) | |
105 | return new_setup_py_str | |
106 | ||
107 | ||
86 | 108 | def _check_for_version_comment(package_str, new_version): |
87 | 109 | """ |
88 | 110 | Check if a comment is present behind the version tag and return it. |
100 | 122 | return comment |
101 | 123 | |
102 | 124 | |
103 | def update_versions(paths, new_version): | |
104 | """ | |
105 | Bulk replace of version: searches for package.xml files directly in given folders and replaces version tag within. | |
106 | ||
107 | :param list paths: folder names | |
125 | def update_versions(packages, new_version): | |
126 | """ | |
127 | Bulk replace of version: searches for package.xml and setup.py files directly in given folders and replaces version tag within. | |
128 | ||
129 | :param dict packages: dict from folder names to package xml objects in those folders | |
108 | 130 | :param str new_version: version string "int.int.int" |
109 | 131 | :raises RuntimeError: if any one package.xml cannot be updated |
110 | 132 | """ |
111 | 133 | files = {} |
112 | for path in paths: | |
134 | for path, package_obj in packages.items(): | |
135 | # Update any package.xml files. | |
113 | 136 | package_path = os.path.join(path, 'package.xml') |
114 | 137 | with open(package_path, 'r') as f: |
115 | 138 | package_str = f.read() |
121 | 144 | except RuntimeError as rue: |
122 | 145 | raise RuntimeError('Could not bump version number in file %s: %s' % (package_path, str(rue))) |
123 | 146 | files[package_path] = new_package_str |
147 | # Update any setup.py files. | |
148 | setup_py_path = os.path.join(path, 'setup.py') | |
149 | if os.path.exists(setup_py_path): | |
150 | # Only update setup.py for ament_python packages. | |
151 | build_type = package_obj.get_build_type() | |
152 | if build_type == 'ament_python': | |
153 | with open(setup_py_path, 'r') as f: | |
154 | setup_py_str = f.read() | |
155 | try: | |
156 | new_setup_py_str = _replace_setup_py_version(setup_py_str, new_version) | |
157 | except RuntimeError as exc: | |
158 | raise RuntimeError('Could not bump version number in file %s: %s' % (setup_py_path, str(exc))) | |
159 | files[setup_py_path] = new_setup_py_str | |
160 | ||
124 | 161 | # if all replacements successful, write back modified package.xml |
125 | 162 | for package_path, new_package_str in files.items(): |
126 | 163 | with open(package_path, 'w') as f: |
139 | 176 | if len(section.children) > 0 and isinstance(section.children[0], docutils.nodes.title): |
140 | 177 | title = section.children[0] |
141 | 178 | if title and len(title.children) > 0 and isinstance(title.children[0], docutils.nodes.Text): |
142 | title_text = title.children[0].rawsource | |
179 | title_text = title.children[0].astext() | |
143 | 180 | if FORTHCOMING_LABEL.lower() in title_text.lower(): |
144 | 181 | if forthcoming_label: |
145 | 182 | raise RuntimeError('Found multiple forthcoming sections') |
39 | 39 | from .package import parse_package_string |
40 | 40 | |
41 | 41 | |
42 | def find_package_paths(basepath, exclude_paths=None, exclude_subspaces=False): | |
42 | DEFAULT_IGNORE_MARKERS = {'AMENT_IGNORE', 'CATKIN_IGNORE', 'COLCON_IGNORE'} | |
43 | ||
44 | ||
45 | def find_package_paths(basepath, exclude_paths=None, exclude_subspaces=False, ignore_markers=DEFAULT_IGNORE_MARKERS): | |
43 | 46 | """ |
44 | 47 | Crawls the filesystem to find package manifest files. |
45 | 48 | |
46 | When a subfolder contains either of the following files it is ignored: | |
49 | When a subfolder contains either of the files mentioned in ``ignore_markers`` it is ignored. By default, these are: | |
47 | 50 | - ``AMENT_IGNORE`` |
48 | 51 | - ``CATKIN_IGNORE`` |
49 | 52 | - ``COLCON_IGNORE`` |
52 | 55 | :param exclude_paths: A list of paths which should not be searched, ``list`` |
53 | 56 | :param exclude_subspaces: The flag is subfolders containing a .catkin file should not be |
54 | 57 | searched, ``bool`` |
58 | :param ignore_markers: Names of files that indicate that a folder should be ignored, ``set`` | |
55 | 59 | :returns: A list of relative paths containing package manifest files ``list`` |
56 | 60 | """ |
57 | 61 | paths = [] |
58 | 62 | real_exclude_paths = [os.path.realpath(p) for p in exclude_paths] if exclude_paths is not None else [] |
59 | 63 | for dirpath, dirnames, filenames in os.walk(basepath, followlinks=True): |
60 | if set(dirnames + filenames) & {'AMENT_IGNORE', 'CATKIN_IGNORE', 'COLCON_IGNORE'} or \ | |
64 | if set(dirnames + filenames) & ignore_markers or \ | |
61 | 65 | os.path.realpath(dirpath) in real_exclude_paths or \ |
62 | 66 | (exclude_subspaces and '.catkin' in filenames): |
63 | 67 | del dirnames[:] |
71 | 75 | return paths |
72 | 76 | |
73 | 77 | |
74 | def find_packages(basepath, exclude_paths=None, exclude_subspaces=False, warnings=None): | |
78 | def find_packages(basepath, exclude_paths=None, exclude_subspaces=False, warnings=None, ignore_markers=DEFAULT_IGNORE_MARKERS): | |
75 | 79 | """ |
76 | 80 | Crawls the filesystem to find package manifest files and parses them. |
77 | 81 | |
79 | 83 | :param exclude_paths: A list of paths which should not be searched, ``list`` |
80 | 84 | :param exclude_subspaces: The flag is subfolders containing a .catkin file should not be |
81 | 85 | searched, ``bool`` |
82 | :param warnings: Print warnings if None or return them in the given list | |
86 | :param warnings: Print warnings if None or return them in the given list, ``bool`` | |
87 | :param ignore_markers: Names of files that indicate that a folder should be ignored, ``set`` | |
83 | 88 | :returns: A dict mapping relative paths to ``Package`` objects ``dict`` |
84 | 89 | :raises: :exc:RuntimeError` If multiple packages have the same name |
85 | 90 | """ |
86 | packages = find_packages_allowing_duplicates(basepath, exclude_paths=exclude_paths, exclude_subspaces=exclude_subspaces, warnings=warnings) | |
91 | packages = find_packages_allowing_duplicates(basepath, exclude_paths=exclude_paths, | |
92 | exclude_subspaces=exclude_subspaces, warnings=warnings, | |
93 | ignore_markers=ignore_markers) | |
87 | 94 | package_paths_by_name = {} |
88 | 95 | for path, package in packages.items(): |
89 | 96 | if package.name not in package_paths_by_name: |
108 | 115 | return (path, parsed_package), warnings |
109 | 116 | |
110 | 117 | |
111 | def find_packages_allowing_duplicates(basepath, exclude_paths=None, exclude_subspaces=False, warnings=None): | |
118 | def find_packages_allowing_duplicates(basepath, exclude_paths=None, exclude_subspaces=False, warnings=None, ignore_markers=DEFAULT_IGNORE_MARKERS): | |
112 | 119 | """ |
113 | 120 | Crawls the filesystem to find package manifest files and parses them. |
114 | 121 | |
117 | 124 | :param exclude_subspaces: The flag is subfolders containing a .catkin file should not be |
118 | 125 | searched, ``bool`` |
119 | 126 | :param warnings: Print warnings if None or return them in the given list |
127 | :param ignore_markers: Names of files that indicate that a folder should be ignored, ``set`` | |
120 | 128 | :returns: A dict mapping relative paths to ``Package`` objects ``dict`` |
121 | 129 | """ |
122 | package_paths = find_package_paths(basepath, exclude_paths=exclude_paths, exclude_subspaces=exclude_subspaces) | |
130 | package_paths = find_package_paths(basepath, exclude_paths=exclude_paths, exclude_subspaces=exclude_subspaces, ignore_markers=ignore_markers) | |
123 | 131 | |
124 | 132 | xmls = {} |
125 | 133 | for path in package_paths: |
56 | 56 | the "url" field. |
57 | 57 | |
58 | 58 | The "description" is taken from the eponymous tag if it does not |
59 | exceed 200 characters. If it does "description" contains the | |
60 | truncated text while "description_long" contains the complete. | |
59 | exceed 200 characters and has no newlines. If it does "description" | |
60 | contains the truncated text while "long_description" contains the | |
61 | complete. | |
61 | 62 | |
62 | 63 | All licenses are merged into the "license" field. |
63 | 64 | |
97 | 98 | elif package.urls: |
98 | 99 | data['url'] = package.urls[0].url |
99 | 100 | |
100 | if len(package.description) <= 200: | |
101 | data['description'] = package.description | |
102 | else: | |
103 | data['description'] = package.description[:197] + '...' | |
104 | data['long_description'] = package.description | |
101 | description = package.plaintext_description.splitlines()[0] | |
102 | if len(description) > 200: | |
103 | description = description[:197] + '...' | |
104 | ||
105 | data['description'] = description | |
106 | if description != package.plaintext_description: | |
107 | data['long_description'] = package.plaintext_description | |
105 | 108 | |
106 | 109 | data['license'] = ', '.join(package.licenses) |
107 | 110 |
2 | 2 | ; catkin-pkg-modules same version as in: |
3 | 3 | ; - setup.py |
4 | 4 | ; - src/catkin_pkg/__init__.py |
5 | Depends: python-argparse, python-catkin-pkg-modules (>= 0.4.24), python-dateutil, python-docutils | |
5 | Depends: python-argparse, python-catkin-pkg-modules (>= 0.5.0), python-dateutil, python-docutils | |
6 | 6 | ; catkin-pkg-modules same version as in: |
7 | 7 | ; - setup.py |
8 | 8 | ; - src/catkin_pkg/__init__.py |
9 | Depends3: python3-catkin-pkg-modules (>= 0.4.24), python3-dateutil, python3-docutils | |
9 | Depends3: python3-catkin-pkg-modules (>= 0.5.0), python3-dateutil, python3-docutils | |
10 | 10 | Conflicts: catkin, python3-catkin-pkg |
11 | 11 | Conflicts3: catkin, python-catkin-pkg |
12 | 12 | Copyright-File: LICENSE |
13 | Suite: xenial yakkety zesty artful bionic cosmic disco eoan jessie stretch buster | |
14 | Suite3: xenial yakkety zesty artful bionic cosmic disco eoan focal jessie stretch buster | |
13 | Suite: bionic cosmic disco eoan jessie stretch buster | |
14 | Suite3: bionic cosmic disco eoan focal jammy buster bullseye | |
15 | 15 | Python2-Depends-Name: python |
16 | 16 | X-Python3-Version: >= 3.4 |
17 | 17 | Setup-Env-Vars: SKIP_PYTHON_MODULES=1 |
25 | 25 | Replaces: python-catkin-pkg (<< 0.3.0) |
26 | 26 | Replaces3: python3-catkin-pkg (<< 0.3.0) |
27 | 27 | Copyright-File: LICENSE |
28 | Suite: xenial yakkety zesty artful bionic cosmic disco eoan jessie stretch buster | |
29 | Suite3: xenial yakkety zesty artful bionic cosmic disco eoan focal jessie stretch buster | |
28 | Suite: bionic cosmic disco eoan jessie stretch buster | |
29 | Suite3: bionic cosmic disco eoan focal jammy buster bullseye | |
30 | 30 | Python2-Depends-Name: python |
31 | 31 | X-Python3-Version: >= 3.4 |
32 | 32 | Setup-Env-Vars: SKIP_PYTHON_SCRIPTS=1 |
0 | 0 | import os |
1 | 1 | import sys |
2 | 2 | |
3 | sys.path.insert(0, os.path.join('..', 'src')) | |
3 | sys.path.insert(0, os.path.join( | |
4 | os.path.dirname(os.path.dirname(os.path.realpath(__file__))), | |
5 | 'src')) |
0 | <?xml version="1.0"?> | |
1 | <package> | |
2 | <name>catkin_ignored</name> | |
3 | <version>1.2.0</version> | |
4 | <description>Package with a CATKIN_IGNORE file.</description> | |
5 | ||
6 | <maintainer email="user@todo.todo">üser</maintainer> | |
7 | <license>BSD</license> | |
8 | <buildtool_depend>catkin</buildtool_depend> | |
9 | </package> |
0 | <?xml version="1.0"?> | |
1 | <package> | |
2 | <name>custom_ignored</name> | |
3 | <version>1.2.0</version> | |
4 | <description>Package with a CUSTOM_IGNORE file.</description> | |
5 | ||
6 | <maintainer email="user@todo.todo">üser</maintainer> | |
7 | <license>BSD</license> | |
8 | <buildtool_depend>catkin</buildtool_depend> | |
9 | </package> |
0 | A package with an XHTML description. | |
1 | ||
2 | This package contains several xhtml tags which are, according to REP-149, meant to be properly handled but "XML tags and multiple whitespaces" may be stripped in some situations. Another sentence in this quasi-paragraph will continue to appear on the same plaintext line because there was no <br/> tag to indicate a newline should appear in the output text. | |
3 | This text should appear on a subsequent line. |
0 | <?xml version="1.0"?> | |
1 | <?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?> | |
2 | <package format="3"> | |
3 | <name>xhtml_descrption</name> | |
4 | <version>0.1.0</version> | |
5 | <description> | |
6 | A package with an XHTML description. | |
7 | <br/><br/> | |
8 | This package contains <em>several</em> xhtml tags which | |
9 | are, according to | |
10 | <a href="https://www.ros.org/reps/rep-0149.html#description">REP-149</a>, | |
11 | meant to be properly handled but "XML tags and multiple | |
12 | whitespaces" may be stripped in some situations. | |
13 | Another sentence in this quasi-paragraph will continue to appear | |
14 | on the same plaintext line because there was no <br/> tag to indicate | |
15 | a newline should appear in the output text. | |
16 | <br/> | |
17 | This text should appear on a subsequent line. | |
18 | </description> | |
19 | ||
20 | <maintainer email="user@todo.todo">üser</maintainer> | |
21 | <license>BSD</license> | |
22 | <buildtool_depend>catkin</buildtool_depend> | |
23 | ||
24 | <exec_depend>foo</exec_depend> | |
25 | <exec_depend>bar</exec_depend> | |
26 | <exec_depend>baz</exec_depend> | |
27 | </package> |
17 | 17 | import sys |
18 | 18 | |
19 | 19 | from flake8.api.legacy import get_style_guide |
20 | import pytest | |
20 | 21 | |
21 | 22 | |
23 | @pytest.mark.flake8 | |
24 | @pytest.mark.linter | |
22 | 25 | def test_flake8(): |
23 | 26 | # Configure flake8 using the .flake8 file in the root of this repository. |
24 | 27 | style_guide = get_style_guide() |
19 | 19 | Person, |
20 | 20 | ) |
21 | 21 | |
22 | from mock import Mock | |
22 | try: | |
23 | from unittest.mock import Mock | |
24 | except ImportError: | |
25 | from mock import Mock | |
23 | 26 | |
24 | 27 | sys.stderr = sys.stdout |
25 | 28 | |
377 | 380 | filename = os.path.join(test_data_dir, 'invalid_package.xml') |
378 | 381 | self.assertRaises(InvalidPackage, parse_package, filename) |
379 | 382 | |
383 | def test_parse_package_xhtml_description(self): | |
384 | filename = os.path.join(test_data_dir, 'xhtml_description.xml') | |
385 | expected_plaintext_description = None | |
386 | with open(os.path.join(test_data_dir, 'xhtml_description.txt'), 'r') as f: | |
387 | # Strip the trailing newline from the data file. | |
388 | expected_plaintext_description = f.read().rstrip('\n') | |
389 | package = parse_package(filename) | |
390 | assert package.description | |
391 | ||
392 | assert package.plaintext_description == expected_plaintext_description | |
393 | ||
380 | 394 | def test_parse_package_string(self): |
381 | 395 | filename = os.path.join(test_data_dir, 'valid_package.xml') |
382 | 396 | xml = _get_package_xml(filename)[0] |
3 | 3 | import tempfile |
4 | 4 | import unittest |
5 | 5 | |
6 | from catkin_pkg.package_version import _replace_setup_py_version | |
6 | 7 | from catkin_pkg.package_version import _replace_version |
7 | 8 | from catkin_pkg.package_version import bump_version |
8 | 9 | from catkin_pkg.package_version import update_changelog_sections |
9 | 10 | from catkin_pkg.package_version import update_versions |
10 | 11 | |
11 | import mock | |
12 | try: | |
13 | from unittest.mock import Mock | |
14 | except ImportError: | |
15 | from mock import Mock | |
12 | 16 | |
13 | 17 | from .util import in_temporary_directory |
14 | 18 | |
41 | 45 | self.assertRaises(RuntimeError, _replace_version, '<package></package>', '0.1.1') |
42 | 46 | self.assertRaises(RuntimeError, _replace_version, '<package><version>0.1.1</version><version>0.1.1</version></package>', '0.1.1') |
43 | 47 | |
48 | def test_replace_setup_py_version(self): | |
49 | self.assertEqual( | |
50 | 'version="1.0.0",', | |
51 | _replace_setup_py_version('version="0.0.1",', '1.0.0')) | |
52 | self.assertEqual( | |
53 | "version='1.0.0',", | |
54 | _replace_setup_py_version("version='0.0.1',", '1.0.0')) | |
55 | self.assertRaises( | |
56 | RuntimeError, | |
57 | _replace_setup_py_version, | |
58 | '', | |
59 | '1.0.0') | |
60 | self.assertRaises( | |
61 | RuntimeError, | |
62 | _replace_setup_py_version, | |
63 | "version='0.1'", | |
64 | '1.0.0') | |
65 | self.assertRaises( | |
66 | RuntimeError, | |
67 | _replace_setup_py_version, | |
68 | 'version=something,', | |
69 | '1.0.0') | |
70 | self.assertRaises( | |
71 | RuntimeError, | |
72 | _replace_setup_py_version, | |
73 | 'version="0.0.1",version="0.0.1",', | |
74 | '1.0.0') | |
75 | ||
44 | 76 | def test_update_versions(self): |
45 | 77 | try: |
46 | 78 | root_dir = tempfile.mkdtemp() |
51 | 83 | with open(os.path.join(sub_dir, 'package.xml'), 'w') as fhand: |
52 | 84 | fhand.write('<package><version>1.5.4</version></package>') |
53 | 85 | |
54 | update_versions([root_dir, sub_dir], '7.6.5') | |
86 | update_versions({root_dir: Mock(), sub_dir: Mock()}, '7.6.5') | |
55 | 87 | |
56 | 88 | with open(os.path.join(root_dir, 'package.xml'), 'r') as fhand: |
57 | 89 | contents = fhand.read() |
68 | 100 | temp_file = os.path.join(directory, 'changelog') |
69 | 101 | missing_changelogs_but_forthcoming = {} |
70 | 102 | # Mock the Changelog object from catkin_pkg |
71 | mock_changelog = mock.Mock() | |
103 | mock_changelog = Mock() | |
72 | 104 | # Create a changelog entry with a unicode char. |
73 | 105 | mock_changelog.rst = ('^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n' |
74 | 106 | 'Changelog for package fake_pkg\n' |
5 | 5 | from catkin_pkg.packages import find_packages_allowing_duplicates |
6 | 6 | |
7 | 7 | from .util import in_temporary_directory |
8 | ||
9 | ||
10 | test_data_dir = os.path.join(os.path.dirname(__file__), 'data', 'ignored_packages') | |
8 | 11 | |
9 | 12 | |
10 | 13 | def _create_pkg_in_dir(path, version='0.1.0'): |
57 | 60 | exception_message = str(e) |
58 | 61 | assert version in exception_message |
59 | 62 | assert path in exception_message |
63 | ||
64 | ||
65 | def test_find_no_ignored_packages(): | |
66 | result = find_packages(test_data_dir) | |
67 | assert 'catkin_ignore' not in result | |
68 | assert 'custom_ignore' in result | |
69 | ||
70 | ||
71 | def test_find_no_ignored_packages_with_custom_ignore(): | |
72 | custom_result = find_packages(test_data_dir, ignore_markers={'CUSTOM_IGNORE'}) | |
73 | assert 'custom_ignore' not in custom_result | |
74 | assert 'catkin_ignore' in custom_result |
7 | 7 | create_cmakelists, create_package_files, create_package_xml, PackageTemplate |
8 | 8 | from catkin_pkg.python_setup import generate_distutils_setup |
9 | 9 | |
10 | from mock import MagicMock, Mock | |
10 | try: | |
11 | from unittest.mock import MagicMock, Mock | |
12 | except ImportError: | |
13 | from mock import MagicMock, Mock | |
11 | 14 | |
12 | 15 | |
13 | 16 | def u(line): |