[PATCH] mail: handle renamed email.Header
Augie Fackler
raf at durin42.com
Sat Oct 8 06:01:00 EDT 2016
> On Oct 8, 2016, at 11:53, Augie Fackler <raf at durin42.com> wrote:
>
> Queued this, thanks.
>
>> On Oct 8, 2016, at 10:24, Pulkit Goyal <7895pulkit at gmail.com> wrote:
>>
>> # HG changeset patch
>> # User Pulkit Goyal <7895pulkit at gmail.com>
>> # Date 1475854211 -7200
>> # Fri Oct 07 17:30:11 2016 +0200
>> # Node ID 2a61396608bcbba3d3f4e50002b19563741d2fb5
>> # Parent 6ffb7e0249f44ab120b4437ae7d65020d03927ba
>> mail: handle renamed email.Header
>>
>> We are still using email.Header which was renamed to email.header back in
>> Python 2.5. References: https://hg.python.org/cpython/file/2.4/Lib/email
>> and https://hg.python.org/cpython/file/2.5/Lib/email
>>
>> diff -r 6ffb7e0249f4 -r 2a61396608bc mercurial/mail.py
>> --- a/mercurial/mail.py Fri Oct 07 08:32:18 2016 -0400
>> +++ b/mercurial/mail.py Fri Oct 07 17:30:11 2016 +0200
>> @@ -23,7 +23,7 @@
>> util,
>> )
>>
>> -_oldheaderinit = email.Header.Header.__init__
>> +_oldheaderinit = email.header.Header.__init__
Hm. Can you look at this?
--- /home/augie/hg/tests/test-hgwebdir-paths.py.out
+++ /home/augie/hg/tests/test-hgwebdir-paths.py.err
@@ -0,0 +1,20 @@
+Traceback (most recent call last):
+ File "/home/augie/hg/tests/test-hgwebdir-paths.py", line 4, in <module>
+ from mercurial import (
+ File "/tmp/hgtests.z8vTiR/install/lib/python/mercurial/hg.py", line 19, in <module>
+ from . import (
+ File "/tmp/hgtests.z8vTiR/install/lib/python/mercurial/bundlerepo.py", line 23, in <module>
+ from . import (
+ File "/tmp/hgtests.z8vTiR/install/lib/python/mercurial/changelog.py", line 19, in <module>
+ from . import (
+ File "/tmp/hgtests.z8vTiR/install/lib/python/mercurial/revlog.py", line 31, in <module>
+ from . import (
+ File "/tmp/hgtests.z8vTiR/install/lib/python/mercurial/templatefilters.py", line 15, in <module>
+ from . import (
+ File "/tmp/hgtests.z8vTiR/install/lib/python/mercurial/templatekw.py", line 11, in <module>
+ from . import (
+ File "/tmp/hgtests.z8vTiR/install/lib/python/mercurial/patch.py", line 28, in <module>
+ from . import (
+ File "/tmp/hgtests.z8vTiR/install/lib/python/mercurial/mail.py", line 26, in <module>
+ _oldheaderinit = email.header.Header.__init__
+AttributeError: 'module' object has no attribute 'header'
ERROR: test-hgwebdir-paths.py output changed
>> def _unifiedheaderinit(self, *args, **kw):
>> """
>> Python 2.7 introduces a backwards incompatible change
>> @@ -279,7 +279,7 @@
>> if not display:
>> # split into words?
>> s, cs = _encode(ui, s, charsets)
>> - return str(email.Header.Header(s, cs))
>> + return str(email.header.Header(s, cs))
>> return s
>>
>> def _addressencode(ui, name, addr, charsets=None):
>> @@ -330,7 +330,7 @@
>> def headdecode(s):
>> '''Decodes RFC-2047 header'''
>> uparts = []
>> - for part, charset in email.Header.decode_header(s):
>> + for part, charset in email.header.decode_header(s):
>> if charset is not None:
>> try:
>> uparts.append(part.decode(charset))
>> diff -r 6ffb7e0249f4 -r 2a61396608bc tests/test-check-py3-compat.t
>> --- a/tests/test-check-py3-compat.t Fri Oct 07 08:32:18 2016 -0400
>> +++ b/tests/test-check-py3-compat.t Fri Oct 07 17:30:11 2016 +0200
>> @@ -121,7 +121,6 @@
>> mercurial/i18n.py: error importing module: <TypeError> bytes expected, not str (line *)
>> mercurial/keepalive.py: error importing module: <AttributeError> module 'mercurial.util' has no attribute 'httplib' (line *)
>> mercurial/localrepo.py: error importing: <TypeError> a bytes-like object is required, not 'str' (error at revset.py:*)
>> - mercurial/mail.py: error importing module: <AttributeError> module 'email' has no attribute 'Header' (line *)
>> mercurial/manifest.py: error importing: <TypeError> a bytes-like object is required, not 'str' (error at revset.py:*)
>> mercurial/merge.py: error importing: <TypeError> a bytes-like object is required, not 'str' (error at revset.py:*)
>> mercurial/namespaces.py: error importing: <TypeError> a bytes-like object is required, not 'str' (error at revset.py:*)
>> _______________________________________________
>> Mercurial-devel mailing list
>> Mercurial-devel at mercurial-scm.org
>> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
>
More information about the Mercurial-devel
mailing list