aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Kahn Gillmor <dkg@fifthhorseman.net>2019-09-15 14:02:03 -0400
committerDavid Bremner <david@tethera.net>2019-10-13 09:31:50 -0300
commit7eb9615b30274033cc0c828244569c709906c40b (patch)
treec9016404be42a867ec65a85d50c958ad6f4e4196
parent1979145b91fa85d6952b94db561a46238265d910 (diff)
Drop devel/printmimestructure (it is in mailscripts 0.11)
mailscripts 0.11 now ships a derivative of devel/printmimestructure called email-print-mime-structure. Maintenance for that utility will happen in mailscripts from now on, so we should not track an independent copy of it in notmuch's source tree. See https://bugs.debian.org/939993 for more details about the adoption. Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
-rwxr-xr-xdevel/printmimestructure69
1 files changed, 0 insertions, 69 deletions
diff --git a/devel/printmimestructure b/devel/printmimestructure
deleted file mode 100755
index 70e0a5c0..00000000
--- a/devel/printmimestructure
+++ /dev/null
@@ -1,69 +0,0 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-
-# Author: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
-# License: GPLv3+
-
-# This script reads a MIME message from stdin and produces a treelike
-# representation on it stdout.
-
-# Example:
-#
-# 0 dkg@alice:~$ printmimestructure < 'Maildir/cur/1269025522.M338697P12023.monkey,S=6459,W=6963:2,Sa'
-# └┬╴multipart/signed 6546 bytes
-# ├─╴text/plain inline 895 bytes
-# └─╴application/pgp-signature inline [signature.asc] 836 bytes
-# 0 dkg@alice:~$
-
-
-# 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
-
-def print_part(z, prefix):
- fname = '' if z.get_filename() is None else ' [' + z.get_filename() + ']'
- cset = '' if z.get_charset() is None else ' (' + z.get_charset() + ')'
- disp = z.get_params(None, header='Content-Disposition')
- if (disp is None):
- disposition = ''
- else:
- disposition = ''
- for d in disp:
- if d[0] in [ 'attachment', 'inline' ]:
- disposition = ' ' + d[0]
- if z.is_multipart():
- nbytes = len(z.as_string())
- else:
- nbytes = len(z.get_payload())
-
- print('{}{}{}{}{} {:d} bytes'.format(
- prefix,
- z.get_content_type(),
- cset,
- disposition,
- fname,
- nbytes,
- ))
-
-def test(z, prefix=''):
- if (z.is_multipart()):
- print_part(z, prefix+'┬╴')
- if prefix.endswith('└'):
- prefix = prefix.rpartition('└')[0] + ' '
- if prefix.endswith('├'):
- prefix = prefix.rpartition('├')[0] + '│'
- parts = z.get_payload()
- i = 0
- while (i < parts.__len__()-1):
- test(parts[i], prefix + '├')
- i += 1
- test(parts[i], prefix + '└')
- # FIXME: show epilogue?
- else:
- print_part(z, prefix+'─╴')
-
-test(email.message_from_file(sys.stdin), '└')