← Back to team overview

duplicity-team team mailing list archive

[Merge] lp:~mgorse/duplicity/0.8-series into lp:duplicity

 

Mgorse has proposed merging lp:~mgorse/duplicity/0.8-series into lp:duplicity.

Requested reviews:
  duplicity-team (duplicity-team)

For more details, see:
https://code.launchpad.net/~mgorse/duplicity/0.8-series/+merge/356431

Adorn some remaining strings
-- 
Your team duplicity-team is requested to review the proposed merge of lp:~mgorse/duplicity/0.8-series into lp:duplicity.
=== modified file 'duplicity/__init__.py'
--- duplicity/__init__.py	2018-07-24 11:52:33 +0000
+++ duplicity/__init__.py	2018-10-10 20:27:40 +0000
@@ -20,4 +20,4 @@
 # Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 
 import gettext
-gettext.install('duplicity', unicode=True, names=['ngettext'])
+gettext.install(u'duplicity', unicode=True, names=[u'ngettext'])

=== modified file 'duplicity/statistics.py'
--- duplicity/statistics.py	2018-09-24 17:02:42 +0000
+++ duplicity/statistics.py	2018-10-10 20:27:40 +0000
@@ -112,7 +112,11 @@
             if use_repr:
                 # use repr to quote newlines in relative filename, then
                 # take of leading and trailing quote and quote spaces.
-                filename = self.space_regex.sub(u"\\x20", repr(filename)[1:-1])
+                filename = self.space_regex.sub(u"\\x20", repr(filename))
+                n = 1
+                if filename[0] == u'u':
+                    n = 2
+                filename = filename[n:-1]
         return u" ".join([filename, ] + file_attrs)
 
     def set_stats_from_line(self, line):

=== modified file 'po/duplicity.pot'
--- po/duplicity.pot	2018-10-09 14:16:10 +0000
+++ po/duplicity.pot	2018-10-10 20:27:40 +0000
@@ -8,7 +8,7 @@
 msgstr ""
 "Project-Id-Version: PACKAGE VERSION\n"
 "Report-Msgid-Bugs-To: Kenneth Loafman <kenneth@xxxxxxxxxxx>\n"
-"POT-Creation-Date: 2018-10-08 15:02-0500\n"
+"POT-Creation-Date: 2018-10-10 15:09-0500\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
 "Language-Team: LANGUAGE <LL@xxxxxx>\n"

=== modified file 'testing/overrides/gettext.py'
--- testing/overrides/gettext.py	2015-01-31 23:30:49 +0000
+++ testing/overrides/gettext.py	2018-10-10 20:27:40 +0000
@@ -26,5 +26,5 @@
 def install(*args, **kwargs):
     ZWSP = u"​"  # ZERO WIDTH SPACE, basically an invisible space separator
     import __builtin__
-    __builtin__.__dict__['_'] = lambda x: x + ZWSP
-    __builtin__.__dict__['ngettext'] = lambda one, more, n: one + ZWSP if n == 1 else more + ZWSP
+    __builtin__.__dict__[u'_'] = lambda x: x + ZWSP
+    __builtin__.__dict__[u'ngettext'] = lambda one, more, n: one + ZWSP if n == 1 else more + ZWSP

=== modified file 'testing/test_code.py'
--- testing/test_code.py	2018-09-24 17:02:42 +0000
+++ testing/test_code.py	2018-10-10 20:27:40 +0000
@@ -111,11 +111,7 @@
                          os.path.join(_top_dir, u'docs', u'conf.py'),
                          # TODO Every file from here down needs to be fixed and the exclusion removed
                          os.path.join(_top_dir, u'setup.py'),
-                         os.path.join(_top_dir, u'duplicity', u'__init__.py'),
                          os.path.join(_top_dir, u'duplicity', u'compilec.py'),
-                         os.path.join(_top_dir, u'testing', u'overrides', u'gettext.py'),
-                         os.path.join(_top_dir, u'testing', u'test_unadorned.py'),
-                         os.path.join(_top_dir, u'testing', u'unit', u'test_statistics.py'),
                          ]
 
 

=== modified file 'testing/unit/test_statistics.py'
--- testing/unit/test_statistics.py	2015-02-01 17:37:37 +0000
+++ testing/unit/test_statistics.py	2018-10-10 20:27:40 +0000
@@ -28,13 +28,13 @@
 
 
 class StatsObjTest(UnitTestCase):
-    """Test StatsObj class"""
+    u"""Test StatsObj class"""
     def setUp(self):
         super(StatsObjTest, self).setUp()
         self.unpack_testfiles()
 
     def set_obj(self, s):
-        """Set values of s's statistics"""
+        u"""Set values of s's statistics"""
         s.SourceFiles = 1
         s.SourceFileSize = 2
         s.NewFiles = 3
@@ -50,24 +50,24 @@
         s.EndTime = 14
 
     def test_get_stats(self):
-        """Test reading and writing stat objects"""
+        u"""Test reading and writing stat objects"""
         s = StatsObj()
-        assert s.get_stat('SourceFiles') is None
+        assert s.get_stat(u'SourceFiles') is None
         self.set_obj(s)
-        assert s.get_stat('SourceFiles') == 1
+        assert s.get_stat(u'SourceFiles') == 1
 
         s1 = StatsDeltaProcess()
-        assert s1.get_stat('SourceFiles') == 0
+        assert s1.get_stat(u'SourceFiles') == 0
 
     def test_get_stats_string(self):
-        """Test conversion of stat object into string"""
+        u"""Test conversion of stat object into string"""
         s = StatsObj()
         stats_string = s.get_stats_string()
-        assert stats_string == "", stats_string
+        assert stats_string == u"", stats_string
 
         self.set_obj(s)
         stats_string = s.get_stats_string()
-        assert stats_string == """\
+        assert stats_string == u"""\
 StartTime 13.00 (Wed Dec 31 18:00:13 1969)
 EndTime 14.00 (Wed Dec 31 18:00:14 1969)
 ElapsedTime 1.00 (1 second)
@@ -82,41 +82,41 @@
 DeltaEntries 10
 RawDeltaSize 11 (11 bytes)
 TotalDestinationSizeChange 12 (12 bytes)
-""", "'%s'" % stats_string
+""", u"'%s'" % stats_string
 
     def test_line_string(self):
-        """Test conversion to a single line"""
+        u"""Test conversion to a single line"""
         s = StatsObj()
         self.set_obj(s)
-        statline = s.get_stats_line(("sample", "index", "w", "new\nline"))
-        assert statline == "sample/index/w/new\\nline 1 2 3 4 5 7 8 9 10 11", \
+        statline = s.get_stats_line((u"sample", u"index", u"w", u"new\nline"))
+        assert statline == u"sample/index/w/new\\nline 1 2 3 4 5 7 8 9 10 11", \
             repr(statline)
 
         statline = s.get_stats_line(())
-        assert statline == ". 1 2 3 4 5 7 8 9 10 11"
+        assert statline == u". 1 2 3 4 5 7 8 9 10 11"
 
-        statline = s.get_stats_line(("file name with spaces",))
-        assert statline == ("file\\x20name\\x20with\\x20spaces "
-                            "1 2 3 4 5 7 8 9 10 11"), repr(statline)
+        statline = s.get_stats_line((u"file name with spaces",))
+        assert statline == (u"file\\x20name\\x20with\\x20spaces "
+                            u"1 2 3 4 5 7 8 9 10 11"), repr(statline)
 
     def test_byte_summary(self):
-        """Test conversion of bytes to strings like 7.23MB"""
+        u"""Test conversion of bytes to strings like 7.23MB"""
         s = StatsObj()
         f = s.get_byte_summary_string
-        assert f(1) == "1 byte"
-        assert f(234.34) == "234 bytes"
-        assert f(2048) == "2.00 KB"
-        assert f(3502243) == "3.34 MB"
-        assert f(314992230) == "300 MB"
-        assert f(36874871216) == "34.3 GB", f(36874871216)
-        assert f(3775986812573450) == "3434 TB"
+        assert f(1) == u"1 byte"
+        assert f(234.34) == u"234 bytes"
+        assert f(2048) == u"2.00 KB"
+        assert f(3502243) == u"3.34 MB"
+        assert f(314992230) == u"300 MB"
+        assert f(36874871216) == u"34.3 GB", f(36874871216)
+        assert f(3775986812573450) == u"3434 TB"
 
     def test_init_stats(self):
-        """Test setting stat object from string"""
+        u"""Test setting stat object from string"""
         s = StatsObj()
-        s.set_stats_from_string("NewFiles 3 hello there")
+        s.set_stats_from_string(u"NewFiles 3 hello there")
         for attr in s.stat_attrs:
-            if attr == 'NewFiles':
+            if attr == u'NewFiles':
                 assert s.get_stat(attr) == 3
             else:
                 assert s.get_stat(attr) is None, (attr, s.__dict__[attr])
@@ -130,8 +130,8 @@
         assert s1.stats_equal(s2)
 
     def test_write_path(self):
-        """Test reading and writing of statistics object"""
-        p = path.Path("testfiles/statstest")
+        u"""Test reading and writing of statistics object"""
+        p = path.Path(u"testfiles/statstest")
         if p.exists():
             p.delete()
         s = StatsObj()
@@ -144,7 +144,7 @@
         assert s2.stats_equal(s)
 
     def testAverage(self):
-        """Test making an average statsobj"""
+        u"""Test making an average statsobj"""
         s1 = StatsObj()
         s1.StartTime = 5
         s1.EndTime = 10
@@ -170,5 +170,5 @@
         assert s3.SourceFiles == 75
 
 
-if __name__ == "__main__":
+if __name__ == u"__main__":
     unittest.main()


Follow ups