Re: [PATCH v2 1/3] devel: make printmimestructure py3 compatible

2018-06-14 Thread David Bremner
Daniel Kahn Gillmor  writes:

> Make printmimestructure work in python3 as well as python2.
>
> PEP 394 suggests that python scripts that work with both python2 and
> python3 should have a #!/usr/bin/python command line, so do that too.

Series pushed, less that (no longer operative) paragraph ^

d
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH v2 1/3] devel: make printmimestructure py3 compatible

2018-06-12 Thread David Bremner
Daniel Kahn Gillmor  writes:

> Make printmimestructure work in python3 as well as python2.
>
> PEP 394 suggests that python scripts that work with both python2 and
> python3 should have a #!/usr/bin/python command line, so do that too.

I think the second paragraph is vestigal.

d
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


[PATCH v2 1/3] devel: make printmimestructure py3 compatible

2018-06-12 Thread Daniel Kahn Gillmor
Make printmimestructure work in python3 as well as python2.

PEP 394 suggests that python scripts that work with both python2 and
python3 should have a #!/usr/bin/python command line, so do that too.
---
 devel/printmimestructure | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/devel/printmimestructure b/devel/printmimestructure
index 34d12930..a5fc83e7 100755
--- a/devel/printmimestructure
+++ b/devel/printmimestructure
@@ -19,6 +19,8 @@
 # If you want to number the parts, i suggest piping the output through
 # something like "cat -n"
 
+from __future__ import print_function
+
 import email
 import sys
 
@@ -34,7 +36,7 @@ def test(z, prefix=''):
 if d[0] in [ 'attachment', 'inline' ]:
 disposition = ' ' + d[0]
 if (z.is_multipart()):
-print prefix + '┬╴' + z.get_content_type() + cset + disposition + 
fname, z.as_string().__len__().__str__() + ' bytes'
+print(prefix + '┬╴' + z.get_content_type() + cset + disposition + 
fname, z.as_string().__len__().__str__() + ' bytes')
 if prefix.endswith('└'):
 prefix = prefix.rpartition('└')[0] + ' '
 if prefix.endswith('├'):
@@ -47,6 +49,6 @@ def test(z, prefix=''):
 test(parts[i], prefix + '└')
 # FIXME: show epilogue?
 else:
-print prefix + '─╴'+ z.get_content_type() + cset + disposition + 
fname, z.get_payload().__len__().__str__(), 'bytes'
+print(prefix + '─╴'+ z.get_content_type() + cset + disposition + 
fname, z.get_payload().__len__().__str__(), 'bytes')
 
 test(email.message_from_file(sys.stdin), '└')
-- 
2.17.1

___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch