diff --git a/python-wstool.spec b/python-wstool.spec index 97d6bbe..b3d7458 100644 --- a/python-wstool.spec +++ b/python-wstool.spec @@ -1,17 +1,23 @@ -%global srcname wstool +%{?!_without_python2:%global with_python2 1} +%{?!_without_python3:%global with_python3 0%{?_with_python3:1} || !0%{?rhel} || 0%{?rhel} >= 7} -%global with_python3 1 +%global srcname wstool Name: python-%{srcname} Version: 0.1.17 -Release: 9%{?dist} +Release: 10%{?dist} Summary: Tool for managing a workspace of multiple heterogeneous SCM repositories License: BSD URL: http://www.ros.org/wiki/%{srcname} Source0: https://github.com/vcstools/%{srcname}/archive/%{version}/%{srcname}-%{version}.tar.gz + # Patch to remove a duplicate installed file. Not submitted upstream Patch0: %{srcname}-0.1.9-fedora.patch +# Merged upstream in vcstools/wstool#134 +Patch1: %{srcname}-0.1.17-yaml-safe-load.patch +# Merged upstream in vcstools/wstool#133 +Patch2: %{srcname}-0.1.17-yaml-flow-style.patch BuildArch: noarch @@ -34,10 +40,10 @@ other respects, it behaves the same as rosws. %description %_description -%package -n python2-%{srcname} -Summary: %summary -BuildRequires: python2-coverage +%if 0%{?with_python2} +%package -n python2-%{srcname} +Summary: %{summary} BuildRequires: python2-dateutil BuildRequires: python2-devel BuildRequires: python2-mock @@ -45,61 +51,73 @@ BuildRequires: python2-pyyaml BuildRequires: python2-nose BuildRequires: python2-setuptools BuildRequires: python2-vcstools >= 0.1.38 - Requires: bzr Requires: git Requires: mercurial +Requires: subversion +%{?python_provide:%python_provide python2-%{srcname}} + +%if %{undefined __pythondist_requires} Requires: python2-dateutil Requires: python2-pyyaml Requires: python2-vcstools >= 0.1.38 -Requires: subversion -%{?python_provide:%python_provide python2-%{srcname}} +%endif # __pythondist_requires %description -n python2-%{srcname} %_description +%endif # with_python2 + %if 0%{?with_python3} %package -n python%{python3_pkgversion}-%{srcname} -Summary: %summary - -BuildRequires: python%{python3_pkgversion}-coverage +Summary: %{summary} BuildRequires: python%{python3_pkgversion}-dateutil BuildRequires: python%{python3_pkgversion}-devel BuildRequires: python%{python3_pkgversion}-mock BuildRequires: python%{python3_pkgversion}-nose +BuildRequires: python%{python3_pkgversion}-PyYAML BuildRequires: python%{python3_pkgversion}-setuptools BuildRequires: python%{python3_pkgversion}-vcstools >= 0.1.38 -BuildRequires: python%{python3_pkgversion}-PyYAML - Requires: bzr Requires: git Requires: mercurial -Requires: python%{python3_pkgversion}-dateutil -Requires: python%{python3_pkgversion}-vcstools >= 0.1.38 -Requires: python%{python3_pkgversion}-PyYAML Requires: subversion %{?python_provide:%python_provide python%{python3_pkgversion}-%{srcname}} +%if %{undefined __pythondist_requires} +Requires: python%{python3_pkgversion}-dateutil +Requires: python%{python3_pkgversion}-PyYAML +Requires: python%{python3_pkgversion}-vcstools >= 0.1.38 +%endif # __pythondist_requires + %description -n python%{python3_pkgversion}-%{srcname} %_description %endif # with_python3 + %prep %autosetup -p1 -n %{srcname}-%{version} + %build +%if 0%{?with_python2} %py2_build +%endif # with_python2 %if 0%{?with_python3} %py3_build mv -v build/scripts-%{python3_version}/%{srcname} build/scripts-%{python3_version}/python3-%{srcname} %endif # with_python3 + %install +%if 0%{?with_python2} %py2_install +%endif # with_python2 %if 0%{?with_python3} %py3_install %endif # with_python3 + %check export BZR_EMAIL="Foo Bar " export GIT_AUTHOR_EMAIL="foo@example.com" @@ -107,12 +125,16 @@ export GIT_AUTHOR_NAME="Foo Bar" export GIT_COMMITTER_EMAIL="foo@example.com" export GIT_COMMITTER_NAME="Foo Bar" -%{__python2} -m nose --with-coverage --cover-package=%{srcname} test +%if 0%{?with_python2} +%{__python2} -m nose test +%endif # with_python2 %if 0%{?with_python3} -%{__python3} -m nose --with-coverage --cover-package=%{srcname} test +%{__python3} -m nose test %endif # with_python3 + +%if 0%{?with_python2} %files -n python2-%{srcname} %license LICENSE %doc README.rst doc/changelog.rst @@ -126,6 +148,7 @@ export GIT_COMMITTER_NAME="Foo Bar" %dir %{_datadir}/zsh/ %dir %{_datadir}/zsh/site-functions/ %{_datadir}/zsh/site-functions/_wstool +%endif # with_python2 %if 0%{?with_python3} %files -n python%{python3_pkgversion}-%{srcname} @@ -136,7 +159,13 @@ export GIT_COMMITTER_NAME="Foo Bar" %{_bindir}/python3-%{srcname} %endif # with_python3 + %changelog +* Tue Jul 16 2019 Scott K Logan - 0.1.17-10 +- Add upstream patches for newer PyYAML compatibility (rhbz#1712544) +- Drop test coverage +- Handle automatic dependency generation (f30+) + * Thu Nov 15 2018 Scott K Logan - 0.1.17-9 - Remove rosinstall requriement entirely (not needed after 0.1.1) - Switch from {commit} to {version} for source archive diff --git a/wstool-0.1.17-yaml-flow-style.patch b/wstool-0.1.17-yaml-flow-style.patch new file mode 100644 index 0000000..69f5530 --- /dev/null +++ b/wstool-0.1.17-yaml-flow-style.patch @@ -0,0 +1,35 @@ +From af1a841da2624eb8eb31103db6dcce14fda702ee Mon Sep 17 00:00:00 2001 +From: Scott K Logan +Date: Wed, 10 Jul 2019 14:59:11 -0700 +Subject: [PATCH] Set flow style for non-pretty YAML dumps (#133) + +The default changed from `None` to `False` in 5.1. +--- + src/wstool/config_yaml.py | 2 +- + src/wstool/multiproject_cli.py | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/src/wstool/config_yaml.py b/src/wstool/config_yaml.py +index 19f82e5..e64325b 100644 +--- a/src/wstool/config_yaml.py ++++ b/src/wstool/config_yaml.py +@@ -402,5 +402,5 @@ def generate_config_yaml(config, filename, header, pretty=False, + content = yaml.safe_dump(items, allow_unicode=True, + default_flow_style=False) + else: +- content = yaml.safe_dump(items) ++ content = yaml.safe_dump(items, default_flow_style=None) + f.write(content.encode('UTF-8')) +diff --git a/src/wstool/multiproject_cli.py b/src/wstool/multiproject_cli.py +index 3c652d0..b0148cc 100644 +--- a/src/wstool/multiproject_cli.py ++++ b/src/wstool/multiproject_cli.py +@@ -1217,7 +1217,7 @@ def cmd_info(self, target_path, argv, reverse=True, config=None): + elif options.yaml: + source_aggregate = multiproject_cmd.cmd_snapshot(config, + localnames=args) +- print(yaml.safe_dump(source_aggregate), end='') ++ print(yaml.safe_dump(source_aggregate, default_flow_style=None), end='') + return 0 + + # this call takes long, as it invokes scms. diff --git a/wstool-0.1.17-yaml-safe-load.patch b/wstool-0.1.17-yaml-safe-load.patch new file mode 100644 index 0000000..92dad99 --- /dev/null +++ b/wstool-0.1.17-yaml-safe-load.patch @@ -0,0 +1,50 @@ +From c5cabae2d3249475ad8af88abc32d624549ed687 Mon Sep 17 00:00:00 2001 +From: Scott K Logan +Date: Wed, 10 Jul 2019 15:03:01 -0700 +Subject: [PATCH] Use yaml.safe_load (#134) + +--- + src/wstool/config_yaml.py | 2 +- + src/wstool/multiproject_cli.py | 2 +- + test/local/test_tarfile.py | 2 +- + 3 files changed, 3 insertions(+), 3 deletions(-) + +diff --git a/src/wstool/config_yaml.py b/src/wstool/config_yaml.py +index e64325b..4cd3751 100644 +--- a/src/wstool/config_yaml.py ++++ b/src/wstool/config_yaml.py +@@ -71,7 +71,7 @@ def get_yaml_from_uri(uri): + if not stream: + raise MultiProjectException("couldn't load config uri %s" % uri) + try: +- yamldata = yaml.load(stream) ++ yamldata = yaml.safe_load(stream) + except yaml.YAMLError as yame: + raise MultiProjectException( + "Invalid multiproject yaml format in [%s]: %s" % (uri, yame)) +diff --git a/src/wstool/multiproject_cli.py b/src/wstool/multiproject_cli.py +index b0148cc..7dcb8c1 100644 +--- a/src/wstool/multiproject_cli.py ++++ b/src/wstool/multiproject_cli.py +@@ -545,7 +545,7 @@ def cmd_merge(self, target_path, argv, config=None): + if config_uris[0] == '-': + pipedata = "".join(sys.stdin.readlines()) + try: +- yamldicts = yaml.load(pipedata) ++ yamldicts = yaml.safe_load(pipedata) + except yaml.YAMLError as e: + raise MultiProjectException( + "Invalid yaml format: \n%s \n%s" % (pipedata, e)) +diff --git a/test/local/test_tarfile.py b/test/local/test_tarfile.py +index f915ddf..af9fc0a 100644 +--- a/test/local/test_tarfile.py ++++ b/test/local/test_tarfile.py +@@ -34,7 +34,7 @@ def test_install(self): + self.assertTrue(os.path.isdir(os.path.join(self.directory, "temptar"))) + self.assertTrue(os.path.isfile(os.path.join(self.directory, ".rosinstall"))) + stream = open(os.path.join(self.directory, '.rosinstall'), 'r') +- yamlsrc = yaml.load(stream) ++ yamlsrc = yaml.safe_load(stream) + stream.close() + self.assertEqual(1, len(yamlsrc)) + self.assertEqual('tar', list(yamlsrc[0].keys())[0])