Skip to content

Commit

Permalink
Merge branch 'master' into add/copyright_file_generation
Browse files Browse the repository at this point in the history
Signed-off-by: Christian Henkel <[email protected]>
  • Loading branch information
ct2034 committed Jan 15, 2025
2 parents b1089be + b42a1dd commit 0fa9da5
Show file tree
Hide file tree
Showing 18 changed files with 119 additions and 97 deletions.
45 changes: 13 additions & 32 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -1,38 +1,19 @@
name: bloom-ci
---
name: Run tests

on:
on: # yamllint disable-line rule:truthy
push:
branches: ['master']
pull_request:
branches: ['*']
schedule:
- cron: '40 7 * * 0'
workflow_call:

jobs:
build:
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
python: [3.7, 3.8, 3.9]
include:
- os: ubuntu-18.04
python: 2.7
- os: ubuntu-18.04
python: 3.6
name: bloom tests
runs-on: ${{matrix.os}}

steps:
- uses: actions/checkout@v2
- name: Set up Python ${{matrix.python}}
uses: actions/setup-python@v1
with:
python-version: ${{matrix.python}}
- name: Install dependencies
run: |
python -m pip install --upgrade pip setuptools
python -m pip install PyYAML argparse empy rosdep vcstools catkin-pkg python-dateutil packaging
python -m pip install nose coverage pep8
- name: Run tests
run: |
BLOOM_VERBOSE=1 python setup.py nosetests -s --tests test
pytest:
uses: ros-infrastructure/ci/.github/workflows/pytest.yaml@main
with:
matrix-filter: del(.matrix.os[] | select(contains("windows")))
yamllint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: yamllint -f github .
10 changes: 10 additions & 0 deletions .github/workflows/scheduled.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
name: Run tests periodically

on: # yamllint disable-line rule:truthy
schedule:
- cron: '40 7 * * 0'

jobs:
pytest:
uses: ./.github/workflows/ci.yaml
22 changes: 22 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,25 @@
0.12.0 (2024-03-29 17:20:00 -0500)
----------------------------------
- Fix regression in RHEL 8 / Python3.6 support. `#700 <https://github.com/ros-infrastructure/bloom/issues/700>`_
- Drop support for Python <2.7, simplify setup.py. `#733 <https://github.com/ros-infrastructure/bloom/issues/733>`_
- Add dh_shlibdeps entry for libraries installed by ament_vendor `#732 <https://github.com/ros-infrastructure/bloom/issues/732>`_
- Fix template file inclusion in Python package. `#731 <https://github.com/ros-infrastructure/bloom/issues/731>`_
- Use raw strings for regular expressions. `#730 <https://github.com/ros-infrastructure/bloom/issues/730>`_
- Update deb platforms and drop python2 packaging. `#724 <https://github.com/ros-infrastructure/bloom/issues/724>`_
- Switch from SafeConfigParser to ConfigParser. `#728 <https://github.com/ros-infrastructure/bloom/issues/728>`_
- Restore weekly CI job. `#729 <https://github.com/ros-infrastructure/bloom/issues/729>`_
- Create a fake rosdistro index for better test isolation. `#727 <https://github.com/ros-infrastructure/bloom/issues/727>`_
- Switch to unified ros-infrastructure CI. `#726 <https://github.com/ros-infrastructure/bloom/issues/726>`_
- Pin to empy < 4. `#726 <https://github.com/ros-infrastructure/bloom/issues/726>`_
- Use extras_require.test and pytest for test dependencies. `#726 <https://github.com/ros-infrastructure/bloom/issues/726>`_
- Add weekly scheduled run to make sure that CI stays green. `#695 <https://github.com/ros-infrastructure/bloom/issues/695>`_
- Add debian package dependency for new packaging dependency. `#698 <https://github.com/ros-infrastructure/bloom/issues/698>`_
- Replace pkg_resources.parse_version with packaging.version.parse. `#693 <https://github.com/ros-infrastructure/bloom/issues/693>`_
- Fix typo 'tempate' -> 'template'. `#694 <https://github.com/ros-infrastructure/bloom/issues/694>`_
- Dry-run with specific remote target, in case remote repo isn't initialized yet. `#684 <https://github.com/ros-infrastructure/bloom/pull/684>`_
- Add Defaults for src/doc information. `#686 <https://github.com/ros-infrastructure/bloom/issues/686>`_
- Ensure subparser is required. `#683 <https://github.com/ros-infrastructure/bloom/issues/683>`_

0.11.2 (2022-07-18 14:18:10 -0700)
----------------------------------
- Use inspect.getfullargspec where available. `#682 <https://github.com/ros-infrastructure/bloom/issues/682>`_
Expand Down
2 changes: 0 additions & 2 deletions MANIFEST.in

This file was deleted.

16 changes: 9 additions & 7 deletions bloom/commands/generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,15 @@ def load_generator_description(generator_name):

def create_subparsers(parser, generator_cmds):
metavar = '[' + ' | '.join(generator_cmds) + ']'
subparsers = parser.add_subparsers(
title='generate commands',
metavar=metavar,
description='Call `bloom-generate {0} -h` for help on a each generate command.'.format(metavar),
dest='generator_cmd',
required=True
)
subparsers_kwargs = {
'title': 'generate commands',
'metavar': metavar,
'description': 'Call `bloom-generate {0} -h` for help on a each generate command.'.format(metavar),
'dest': 'generator_cmd'
}
if sys.version_info >= (3, 7):
subparsers_kwargs['required'] = True
subparsers = parser.add_subparsers(**subparsers_kwargs)
for generator_cmd in generator_cmds:
desc = load_generator_description(generator_cmd)
cmd_parser = subparsers.add_parser(desc['title'], description=desc['description'])
Expand Down
2 changes: 1 addition & 1 deletion bloom/commands/git/patch/trim_cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def _set_trim_sub_dir(sub_dir, force, config, directory):
sub_dir + ", but it is already set to " +
config['trim'] + ".")
if not force:
warning("Changing the sud directory is not advised. "
warning("Changing the sub directory is not advised. "
"If you are sure you want to do this, use "
"'--force'")
return None
Expand Down
8 changes: 4 additions & 4 deletions bloom/generators/debian/generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@

# Python 2/3 support.
try:
from configparser import SafeConfigParser
from configparser import ConfigParser
except ImportError:
from ConfigParser import SafeConfigParser
from ConfigParser import SafeConfigParser as ConfigParser
from dateutil import tz
from packaging.version import parse as parse_version

Expand Down Expand Up @@ -402,7 +402,7 @@ def generate_substitutions_from_package(
setup_cfg_path = os.path.join(package_path, 'setup.cfg')
data['pass_install_scripts'] = True
if os.path.isfile(setup_cfg_path):
setup_cfg = SafeConfigParser()
setup_cfg = ConfigParser()
setup_cfg.read([setup_cfg_path])
if (
setup_cfg.has_option('install', 'install-scripts') or
Expand Down Expand Up @@ -612,7 +612,7 @@ def get_package_from_branch(branch):
def debianize_string(value):
markup_remover = re.compile(r'<.*?>')
value = markup_remover.sub('', value)
value = re.sub('\s+', ' ', value)
value = re.sub(r'\s+', ' ', value)
value = value.strip()
return value

Expand Down
2 changes: 1 addition & 1 deletion bloom/generators/debian/templates/ament_cmake/rules.em
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ override_dh_shlibdeps:
# in the install tree and source it. It will set things like
# CMAKE_PREFIX_PATH, PKG_CONFIG_PATH, and PYTHONPATH.
if [ -f "@(InstallationPrefix)/setup.sh" ]; then . "@(InstallationPrefix)/setup.sh"; fi && \
dh_shlibdeps -l$(CURDIR)/debian/@(Package)/@(InstallationPrefix)/lib/
dh_shlibdeps -l$(CURDIR)/debian/@(Package)/@(InstallationPrefix)/lib/:$(CURDIR)/debian/@(Package)/@(InstallationPrefix)/opt/@(Name)/lib/

override_dh_auto_install:
# In case we're installing to a non-standard location, look for a setup.sh
Expand Down
7 changes: 1 addition & 6 deletions bloom/generators/rpm/generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,6 @@
import traceback
import textwrap

# Python 2/3 support.
try:
from configparser import SafeConfigParser
except ImportError:
from ConfigParser import SafeConfigParser
from dateutil import tz
from distutils.version import LooseVersion
from time import strptime
Expand Down Expand Up @@ -447,7 +442,7 @@ def get_package_from_branch(branch):
def rpmify_string(value):
markup_remover = re.compile(r'<.*?>')
value = markup_remover.sub('', value)
value = re.sub('\s+', ' ', value)
value = re.sub(r'\s+', ' ', value)
value = '\n'.join([v.strip() for v in
textwrap.TextWrapper(width=80, break_long_words=False, replace_whitespace=False).wrap(value)])
return value
Expand Down
4 changes: 2 additions & 2 deletions docs/bump_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@
args = parser.parse_args()
with open(args.file, 'r') as f:
lines = f.read()
version_line_regex = re.compile(".*version='\d*[.]\d*[.]\d*'.*")
version_line_regex = re.compile(r".*version='\d*[.]\d*[.]\d*'.*")
version_line = version_line_regex.findall(lines)
version_line = version_line[0]
version_regex = re.compile('\d*[.]\d*[.]\d*')
version_regex = re.compile(r'\d*[.]\d*[.]\d*')
version_str = version_regex.findall(version_line)[0]
version_str = version_str.split('.')
version_str[-1] = str(int(version_str[-1]) + 1)
Expand Down
9 changes: 2 additions & 7 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,5 @@ all_files = 1
[upload_sphinx]
upload-dir = doc/build/html

# [nosetests]
# where=test
# with-coverage=0
# cover-package=nose
# debug=nose.loader
# pdb=0
# pdb-failures=0
[tool:pytest]
junit_suite_name = bloom
47 changes: 22 additions & 25 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,40 +3,37 @@
import sys
from setuptools import find_packages, setup

install_requires = [
'catkin_pkg >= 0.4.3',
'setuptools',
'empy',
'packaging',
'python-dateutil',
'PyYAML',
'rosdep >= 0.15.0',
'rosdistro >= 0.8.0',
'ros_license_toolkit >= 1.2.2',
'vcstools >= 0.1.22',
]

# argparse got moved into the stdlib in py2.7, so we only
# need to install the pypi version if we're on an older
# python.
if sys.version_info[0] == 2 and sys.version_info[1] <= 6:
install_requires.append('argparse')

setup(
name='bloom',
version='0.11.2',
version='0.12.0',
packages=find_packages(exclude=['test', 'test.*']),
package_data={
'bloom.generators.debian': [
'bloom/generators/debian/templates/*',
'bloom/generators/debian/templates/source/*'
'templates/*/*',
'templates/*/source/*',
],
'bloom.generators.rpm': [
'bloom/generators/rpm/templates/*'
]
'templates/*/*.em',
],
},
include_package_data=True,
install_requires=install_requires,
install_requires=[
'catkin_pkg >= 0.4.3',
'setuptools',
'empy < 4',
'packaging',
'python-dateutil',
'PyYAML',
'ros_license_toolkit >= 2.0.0',
'rosdep >= 0.15.0',
'rosdistro >= 0.8.0',
'vcstools >= 0.1.22',
],
extras_require={
'test': [
'pep8',
'pytest',
]},
author='Tully Foote, William Woodall',
author_email='[email protected], [email protected]',
maintainer='William Woodall',
Expand Down
8 changes: 2 additions & 6 deletions stdeb.cfg
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
[DEFAULT]
; release with a high debinc to avoid conflict with upstream debian of the same release version
Debian-Version: 100
Depends: python-yaml, python-empy, python-argparse, python-packaging, python-rosdep (>= 0.15.0), python-rosdistro (>= 0.8.0), python-vcstools (>= 0.1.22), python-setuptools, python-catkin-pkg (>= 0.4.3)
Depends3: python3-yaml, python3-empy, python3-packaging, python3-rosdep (>= 0.15.0), python3-rosdistro (>= 0.8.0), python3-vcstools (>= 0.1.22), python3-setuptools, python3-catkin-pkg (>= 0.4.3)
Conflicts: python3-bloom
Conflicts3: python-bloom
Copyright-File: LICENSE.txt
Suite: bionic buster
Suite3: bionic focal jammy buster bullseye
Python2-Depends-Name: python
Suite3: focal jammy noble bookworm trixie
Dh-python3-params: --no-guessing-deps
X-Python3-Version: >= 3.4
X-Python3-Version: >= 3.6
6 changes: 6 additions & 0 deletions test/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@
scripts = os.path.abspath(scripts)
os.environ['PATH'] = scripts + ':' + os.environ['PATH']

os.environ['ROSDISTRO_INDEX_URL'] = 'file://' + os.path.join(
os.path.dirname(os.path.abspath(__file__)),
'fake_rosdistro',
'index-v4.yaml',
)

user_email = '[email protected]'
user_name = 'Test User'

Expand Down
10 changes: 10 additions & 0 deletions test/fake_rosdistro/index-v4.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
%YAML 1.1
---
distributions:
melodic:
distribution: [melodic/distribution.yaml]
distribution_status: end-of-life
distribution_type: ros1
python_version: 2
type: index
version: 4
10 changes: 10 additions & 0 deletions test/fake_rosdistro/melodic/distribution.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
%YAML 1.1
---
release_platforms:
debian:
- buster
ubuntu:
- bionic
repositories: []
type: distribution
version: 2
2 changes: 1 addition & 1 deletion test/system_tests/test_catkin_release.py
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ def test_multi_package_repository(directory=None):
package_xml = f.read()
assert package_xml.count('<name>' + pkg + '</name>'), \
"incorrect package.xml for " + str(pkg)
format_version = int(re.search('format="(\d+)"',
format_version = int(re.search(r'format="(\d+)"',
package_xml).group(1))
# Is there a copyright file for this pkg?
with open('debian/copyright', 'r') as f:
Expand Down
6 changes: 3 additions & 3 deletions test/utils/package_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def bump_version(version, bump='patch'):
parts reset to 0
"""
# split the version number
match = re.match('^(\d+)\.(\d+)\.(\d+)$', version)
match = re.match(r'^(\d+)\.(\d+)\.(\d+)$', version)
if match is None:
raise ValueError(
'Invalid version string, must be int.int.int: "%s"' % version
Expand All @@ -75,8 +75,8 @@ def _replace_version(package_str, new_version):
"""
# try to replace contens
new_package_str, number_of_subs = re.subn(
'<version([^<>]*)>[^<>]*</version>',
'<version\g<1>>%s</version>' % new_version, package_str
r'<version([^<>]*)>[^<>]*</version>',
r'<version\g<1>>%s</version>' % new_version, package_str
)
if number_of_subs != 1:
raise RuntimeError(
Expand Down

0 comments on commit 0fa9da5

Please sign in to comment.