diff --git a/python-colcon-bazel-0.1.0-python-39.patch b/python-colcon-bazel-0.1.0-python-39.patch new file mode 100644 index 0000000..3b2aff3 --- /dev/null +++ b/python-colcon-bazel-0.1.0-python-39.patch @@ -0,0 +1,34 @@ +From b358a894ebd1c6d08160f12824f0cae474b44370 Mon Sep 17 00:00:00 2001 +From: Scott K Logan +Date: Mon, 3 Aug 2020 15:01:34 -0700 +Subject: [PATCH] Fix a failing test with Python 3.9 + +`pytest.raises()` is returning an `ExceptionInfo` instance, not an +`Execption` instance. In Python 3.9, it appears that the string +representation of an `ExceptionInfo` instance is no longer the same as +the string representation of the value it describes, making this test +fail. + +Specifically referencing the exception value property resolves the +issue. I also changed the name of the variable to make it more clear +that this is not an `Exception` instance. +--- + test/test_package_identification_bazel.py | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/test/test_package_identification_bazel.py b/test/test_package_identification_bazel.py +index 855e361..6cdc161 100644 +--- a/test/test_package_identification_bazel.py ++++ b/test/test_package_identification_bazel.py +@@ -48,9 +48,9 @@ def test_identify(): + assert desc.type == 'bazel' + + desc.name = 'other-name' +- with pytest.raises(RuntimeError) as e: ++ with pytest.raises(RuntimeError) as einfo: + extension.identify(desc) +- assert str(e).endswith('Package name already set to different value') ++ assert str(einfo.value).endswith('Package name already set to different value') + + (basepath / 'BUILD.bazel').write_text( + 'java_binary(\n' diff --git a/python-colcon-bazel-0.1.0-regex-escapes.patch b/python-colcon-bazel-0.1.0-regex-escapes.patch new file mode 100644 index 0000000..33b1eea --- /dev/null +++ b/python-colcon-bazel-0.1.0-regex-escapes.patch @@ -0,0 +1,44 @@ +From ec6810612c4ebfcc3221c828eb44a9a67aae361e Mon Sep 17 00:00:00 2001 +From: Scott K Logan +Date: Mon, 3 Aug 2020 15:55:29 -0700 +Subject: [PATCH] Use raw strings for each part a regex + +The backslashes in this regex are causing `DeprecationWarning`s to +appear because they aren't valid escape sequences. Clearly they're meant +as literal backslashes given the context, so using raw strings makes +sense. I set the other parts of the regex as raw strings as well since +escape characters are far less common in regular expressions than +backslash characters, and it's easy to forget to make the string raw +when modifying an existing one to contain a new backslash. +--- + colcon_bazel/package_identification/bazel.py | 12 ++++++------ + 1 file changed, 6 insertions(+), 6 deletions(-) + +diff --git a/colcon_bazel/package_identification/bazel.py b/colcon_bazel/package_identification/bazel.py +index cbe5ebc..990e801 100644 +--- a/colcon_bazel/package_identification/bazel.py ++++ b/colcon_bazel/package_identification/bazel.py +@@ -135,17 +135,17 @@ def extract_project_name(content): + # extract project name + match = re.search( + # keyword +- 'name' ++ r'name' + # optional white space +- '\s*' ++ r'\s*' + # equal assignment +- '\=' ++ r'\=' + # optional white space +- '\s*' ++ r'\s*' + # optional "opening" quote +- '("?)' ++ r'("?)' + # project name +- '([a-zA-Z0-9_-]+)' ++ r'([a-zA-Z0-9_-]+)' + # optional "closing" quote (only if an "opening" quote was used) + r'\1', + content) diff --git a/python-colcon-bazel.spec b/python-colcon-bazel.spec index e649b7e..d4ce0fb 100644 --- a/python-colcon-bazel.spec +++ b/python-colcon-bazel.spec @@ -2,13 +2,18 @@ Name: python-%{srcname} Version: 0.1.0 -Release: 9%{?dist} +Release: 10%{?dist} Summary: Extension for colcon to support Bazel packages License: ASL 2.0 URL: https://colcon.readthedocs.io Source0: https://github.com/colcon/%{srcname}/archive/%{version}/%{srcname}-%{version}.tar.gz +# Submitted upstream as colcon/colcon-bazel#15 +Patch0: %{name}-0.1.0-python-39.patch +# Submitted upstream as colcon/colcon-bazel#16 +Patch1: %{name}-0.1.0-regex-escapes.patch + BuildArch: noarch %description @@ -25,11 +30,15 @@ BuildRequires: python%{python3_pkgversion}-pytest BuildRequires: python%{python3_pkgversion}-setuptools >= 30.3.0 %{?python_provide:%python_provide python%{python3_pkgversion}-%{srcname}} +%if !0%{?rhel} || 0%{?rhel} >= 8 +BuildRequires: python%{python3_pkgversion}-pytest-asyncio +%endif + %if %{undefined __pythondist_requires} Requires: python%{python3_pkgversion}-colcon-core >= 0.3.9 Requires: python%{python3_pkgversion}-colcon-library-path Requires: python%{python3_pkgversion}-pyparsing -%endif # __pythondist_requires +%endif %description -n python%{python3_pkgversion}-%{srcname} An extension for colcon-core to support Bazel projects. @@ -62,6 +71,11 @@ An extension for colcon-core to support Bazel projects. %changelog +* Mon Aug 03 2020 Scott K Logan - 0.1.0-10 +- Add a patch to fix a test with Python 3.9 +- Add a patch to resolve some deprecation warnings +- Add a 'pytest_asyncio' build dependency where supported + * Sat Aug 01 2020 Fedora Release Engineering - 0.1.0-9 - Second attempt - Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild