From c46e3748875ba64859fc223d302157df83e74ad8 Mon Sep 17 00:00:00 2001 From: Miroslav Suchý Date: May 25 2020 08:15:36 +0000 Subject: [PATCH 1/2] apply 2to3 script --- diff --git a/rpmfluff/__init__.py b/rpmfluff/__init__.py index e0e00dc..b853c09 100644 --- a/rpmfluff/__init__.py +++ b/rpmfluff/__init__.py @@ -22,7 +22,7 @@ It is intended for use when testing RPM-testers e.g. rpmlint and writing test cases for RPM tools e.g. yum """ -from __future__ import print_function + import unittest import os @@ -511,7 +511,7 @@ defaultChangelogFormat = """* Sun Jul 22 2018 John Doe - %s-% - Initial version """ -sample_man_page = u""".TH FOO "1" "May 2009" "foo 1.00" "User Commands" +sample_man_page = """.TH FOO "1" "May 2009" "foo 1.00" "User Commands" .SH NAME foo \\- Frobnicates the doohickey .SH SYNOPSIS @@ -760,9 +760,9 @@ class SimpleRpmBuild(RpmBuild): def gather_sources(self, sourcesDir): #print(self.sources) - for source in self.sources.values(): + for source in list(self.sources.values()): source.write_file(sourcesDir) - for patch in self.patches.values(): + for patch in list(self.patches.values()): patch.write_file(sourcesDir) def add_summary(self, summaryText): @@ -2045,12 +2045,12 @@ class TestSimpleRpmBuild(unittest.TestCase): self.assertEqual('apache', group) def test_specfile_encoding_utf8(self): - self.rpmbuild.section_changelog = u"* Fri Mar 30 2001 Trond Eivind Glomsr\u00F8d \nDo something" + self.rpmbuild.section_changelog = "* Fri Mar 30 2001 Trond Eivind Glomsr\\u00F8d \nDo something" self.rpmbuild.make() def test_specfile_encoding_iso8859(self): self.rpmbuild.specfileEncoding = 'iso8859_10' - self.rpmbuild.section_changelog = u"* Fri Mar 30 2001 Trond Eivind Glomsr\u00F8d \nDo something" + self.rpmbuild.section_changelog = "* Fri Mar 30 2001 Trond Eivind Glomsr\\u00F8d \nDo something" self.rpmbuild.make() def test_epoch(self): From c0f662f00ddce6005e9cc8fc8c9f338fe0726dd2 Mon Sep 17 00:00:00 2001 From: Miroslav Suchý Date: May 25 2020 08:19:57 +0000 Subject: [PATCH 2/2] remove dead code not needed when we support only python3 and 3.8 is recent version --- diff --git a/rpmfluff/__init__.py b/rpmfluff/__init__.py index b853c09..a94899a 100644 --- a/rpmfluff/__init__.py +++ b/rpmfluff/__init__.py @@ -37,17 +37,6 @@ UTF8ENCODE = None CC = os.getenv("CC", "gcc") -def _which(cmd): - """Hacked Python 3.3+ shutil.which() with limited functionality.""" - path = os.environ.get("PATH", os.defpath) - for p in path.split(os.pathsep): - p = os.path.join(p, cmd) - if os.path.exists(p) and os.access(p, os.F_OK | os.X_OK): - return p - -if sys.version_info < (3, 3): - shutil.which = _which - def _utf8_encode(s): """ RPM now returns all string data as surrogate-escaped utf-8 strings