Bug#1067796: mailscripts: FTBFS: email-print-mime-structure:51: error: Unused "type: ignore" comment

2024-04-07 Thread Daniel Kahn Gillmor
On Sat 2024-04-06 16:20:33 +0800, Sean Whitton wrote:
> Thanks!  Just to note that I also had to add python3-gssapi as a b-d.

That sounds reasonable.  thanks for taking care of that, Sean!

 --dkg


signature.asc
Description: PGP signature


Bug#1067796: mailscripts: FTBFS: email-print-mime-structure:51: error: Unused "type: ignore" comment

2024-04-06 Thread Sean Whitton
control: tag -1 + pending

Hello,

On Sat 06 Apr 2024 at 01:23am -04, Daniel Kahn Gillmor wrote:

> On Sat 2024-04-06 11:40:14 +0800, Sean Whitton wrote:
>> On Thu 04 Apr 2024 at 06:37pm -04, Daniel Kahn Gillmor wrote:
>>
>>> On Wed 2024-04-03 13:03:19 +0800, Sean Whitton wrote:
 Thanks, but can you sign this off?  Ty!
>>>
>>> Sure, attached.  Let me know if you need anything different.
>>
>> Thanks.  Unfortunately, it doesn't seem to fix the FTBFS, on sid.
>
> Here is a replacement patch, tested now against mypy 1.9.0-4.  It also
> updates the typechecking for imap-dl for the same version of mypy.

Thanks!  Just to note that I also had to add python3-gssapi as a b-d.

-- 
Sean Whitton


signature.asc
Description: PGP signature


Bug#1067796: mailscripts: FTBFS: email-print-mime-structure:51: error: Unused "type: ignore" comment

2024-04-05 Thread Daniel Kahn Gillmor
On Sat 2024-04-06 11:40:14 +0800, Sean Whitton wrote:
> On Thu 04 Apr 2024 at 06:37pm -04, Daniel Kahn Gillmor wrote:
>
>> On Wed 2024-04-03 13:03:19 +0800, Sean Whitton wrote:
>>> Thanks, but can you sign this off?  Ty!
>>
>> Sure, attached.  Let me know if you need anything different.
>
> Thanks.  Unfortunately, it doesn't seem to fix the FTBFS, on sid.

Here is a replacement patch, tested now against mypy 1.9.0-4.  It also
updates the typechecking for imap-dl for the same version of mypy.

 --dkg

From 6d27aa566d64a3e8cbc6afa4e61f5f8178edb14e Mon Sep 17 00:00:00 2001
From: Daniel Kahn Gillmor 
Date: Tue, 30 Jan 2024 15:40:58 -0500
Subject: [PATCH] email-print-mime-structure, imap-dl: clean types with mypy
 1.9.0

(and, update copyright years)

Signed-off-by: Daniel Kahn Gillmor 
---
 email-print-mime-structure | 22 ++
 imap-dl| 14 +-
 2 files changed, 23 insertions(+), 13 deletions(-)

diff --git a/email-print-mime-structure b/email-print-mime-structure
index b7646e0..3263da9 100755
--- a/email-print-mime-structure
+++ b/email-print-mime-structure
@@ -2,7 +2,7 @@
 # PYTHON_ARGCOMPLETE_OK
 # -*- coding: utf-8 -*-
 
-# Copyright (C) 2019 Daniel Kahn Gillmor
+# Copyright (C) 2019-2024 Daniel Kahn Gillmor
 #
 # This program is free software: you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -39,6 +39,7 @@ import subprocess
 
 from argparse import ArgumentParser, Namespace
 from typing import Optional, Union, List, Tuple, Any
+from types import ModuleType
 from email.charset import Charset
 from email.message import Message
 
@@ -47,8 +48,9 @@ try:
 except ImportError:
 pgpy = None
 
+argcomplete:Optional[ModuleType]
 try:
-import argcomplete #type: ignore
+import argcomplete
 except ImportError:
 argcomplete = None
 
@@ -74,7 +76,7 @@ class MimePrinter(object):
 # FIXME: it looks like we are counting chars here, not bytes:
 nbytes = len(z.as_string())
 else:
-payload:Union[List[Message], str, bytes, None] = z.get_payload()
+payload = z.get_payload()
 if not isinstance(payload, (str,bytes)):
 raise TypeError(f'expected payload to be either str or bytes, got {type(payload)}')
 # FIXME: it looks like we are counting chars here, not bytes:
@@ -106,7 +108,7 @@ class MimePrinter(object):
 else:
 if z.get_content_type().lower() == 'application/pkcs7-mime' and \
str(z.get_param('smime-type')).lower() == 'signed-data':
-bodypart:Union[List[Message],str,bytes,None] = z.get_payload(decode=True)
+bodypart = z.get_payload(decode=True)
 if isinstance(bodypart, bytes):
 unwrapped = self.pipe_transform(bodypart, ['certtool', '--p7-show-data', '--p7-info', '--inder'])
 if unwrapped:
@@ -118,7 +120,7 @@ class MimePrinter(object):
 
 
 def decrypt_part(self, msg:Message, flavor:EncType) -> Optional[Message]:
-ciphertext:Union[List[Message],str,bytes,None] = msg.get_payload(decode=True)
+ciphertext = msg.get_payload(decode=True)
 cryptopayload:Optional[Message] = None
 if not isinstance(ciphertext, bytes):
 logging.warning('encrypted part was not a leaf mime part somehow')
@@ -178,14 +180,18 @@ class MimePrinter(object):
 prefix = prefix.rpartition('└')[0] + ' '
 if prefix.endswith('├'):
 prefix = prefix.rpartition('├')[0] + '│'
-parts:Union[List[Message], str, bytes, None] = z.get_payload()
+parts = z.get_payload()
 if not isinstance(parts, list):
 raise TypeError(f'parts was {type(parts)}, expected List[Message]')
 i = 0
 while (i < len(parts)-1):
-self.print_tree(parts[i], prefix + '├', z, i+1)
+msg = parts[i]
+if isinstance(msg, Message):
+self.print_tree(msg, prefix + '├', z, i+1)
 i += 1
-self.print_tree(parts[i], prefix + '└', z, i+1)
+msg = parts[i]
+if isinstance(msg, Message):
+self.print_tree(msg, prefix + '└', z, i+1)
 # FIXME: show epilogue?
 else:
 self.print_part(z, prefix+'─╴', parent, num)
diff --git a/imap-dl b/imap-dl
index fac7487..824c21d 100755
--- a/imap-dl
+++ b/imap-dl
@@ -2,7 +2,7 @@
 # PYTHON_ARGCOMPLETE_OK
 # -*- coding: utf-8 -*-
 
-# Copyright (C) 2019-2020 Daniel Kahn Gillmor
+# Copyright (C) 2019-2024 Daniel Kahn Gillmor
 # Copyright (C) 2020  Red Hat, Inc.
 #
 # This program is free software: you can redistribute it and/or modify
@@ -52,14 +52,17 @@ import statistics
 import configparser
 
 from typing import Dict, List, Optional, Tuple, Union
+from types import ModuleType
 
+argcomplete:Optional[ModuleType]
 

Bug#1067796: mailscripts: FTBFS: email-print-mime-structure:51: error: Unused "type: ignore" comment

2024-04-05 Thread Sean Whitton
Hello,

On Thu 04 Apr 2024 at 06:37pm -04, Daniel Kahn Gillmor wrote:

> On Wed 2024-04-03 13:03:19 +0800, Sean Whitton wrote:
>> Thanks, but can you sign this off?  Ty!
>
> Sure, attached.  Let me know if you need anything different.

Thanks.  Unfortunately, it doesn't seem to fix the FTBFS, on sid.

-- 
Sean Whitton


signature.asc
Description: PGP signature


Bug#1067796: mailscripts: FTBFS: email-print-mime-structure:51: error: Unused "type: ignore" comment

2024-04-04 Thread Daniel Kahn Gillmor
On Wed 2024-04-03 13:03:19 +0800, Sean Whitton wrote:
> Thanks, but can you sign this off?  Ty!

Sure, attached.  Let me know if you need anything different.

  --dkg

From b522c1cc6201f75ab6103954016bbb719d4dd2fa Mon Sep 17 00:00:00 2001
From: Daniel Kahn Gillmor 
Date: Tue, 30 Jan 2024 15:40:58 -0500
Subject: [PATCH] email-print-mime-structure: clean up typechecking
 (argcomplete types are known)

(and, update copyright years)

Signed-off-by: Daniel Kahn Gillmor 
---
 email-print-mime-structure | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/email-print-mime-structure b/email-print-mime-structure
index b7646e0..7635f53 100755
--- a/email-print-mime-structure
+++ b/email-print-mime-structure
@@ -2,7 +2,7 @@
 # PYTHON_ARGCOMPLETE_OK
 # -*- coding: utf-8 -*-
 
-# Copyright (C) 2019 Daniel Kahn Gillmor
+# Copyright (C) 2019-2024 Daniel Kahn Gillmor
 #
 # This program is free software: you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -39,6 +39,7 @@ import subprocess
 
 from argparse import ArgumentParser, Namespace
 from typing import Optional, Union, List, Tuple, Any
+from types import ModuleType
 from email.charset import Charset
 from email.message import Message
 
@@ -47,8 +48,9 @@ try:
 except ImportError:
 pgpy = None
 
+argcomplete:Optional[ModuleType]
 try:
-import argcomplete #type: ignore
+import argcomplete
 except ImportError:
 argcomplete = None
 
-- 
2.43.0



signature.asc
Description: PGP signature


Bug#1067796: mailscripts: FTBFS: email-print-mime-structure:51: error: Unused "type: ignore" comment

2024-04-02 Thread Sean Whitton
Thanks, but can you sign this off?  Ty!
-- 
Sean Whitton



Bug#1067796: mailscripts: FTBFS: email-print-mime-structure:51: error: Unused "type: ignore" comment

2024-04-02 Thread Daniel Kahn Gillmor
Control: tags 1067796 + patch

On Thu 2024-03-28 13:09:48 +0800, Sean Whitton wrote:
> Please take a look into this test suite failure for your script.

The attached patch should clean things up now that argcomplete is
annotated.  in my local tests, the script runs and exits cleanly.

This patch is worth applying generally, but given the flux around mypy
typing, i would also be fine with just recording the output of mypy
--strict instead of failing hard on it.

 --dkg

From b522c1cc6201f75ab6103954016bbb719d4dd2fa Mon Sep 17 00:00:00 2001
From: Daniel Kahn Gillmor 
Date: Tue, 30 Jan 2024 15:40:58 -0500
Subject: [PATCH] email-print-mime-structure: clean up typechecking
 (argcomplete types are known)

(and, update copyright years)
---
 email-print-mime-structure | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/email-print-mime-structure b/email-print-mime-structure
index b7646e0..7635f53 100755
--- a/email-print-mime-structure
+++ b/email-print-mime-structure
@@ -2,7 +2,7 @@
 # PYTHON_ARGCOMPLETE_OK
 # -*- coding: utf-8 -*-
 
-# Copyright (C) 2019 Daniel Kahn Gillmor
+# Copyright (C) 2019-2024 Daniel Kahn Gillmor
 #
 # This program is free software: you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -39,6 +39,7 @@ import subprocess
 
 from argparse import ArgumentParser, Namespace
 from typing import Optional, Union, List, Tuple, Any
+from types import ModuleType
 from email.charset import Charset
 from email.message import Message
 
@@ -47,8 +48,9 @@ try:
 except ImportError:
 pgpy = None
 
+argcomplete:Optional[ModuleType]
 try:
-import argcomplete #type: ignore
+import argcomplete
 except ImportError:
 argcomplete = None
 
-- 
2.43.0



signature.asc
Description: PGP signature


Bug#1067796: mailscripts: FTBFS: email-print-mime-structure:51: error: Unused "type: ignore" comment

2024-03-27 Thread Sean Whitton
Hello dkg,

Please take a look into this test suite failure for your script.

Thanks!

On Tue 26 Mar 2024 at 10:25pm +01, Santiago Vila wrote:

> Package: src:mailscripts
> Version: 28-1
> Severity: serious
> Tags: ftbfs
>
> Dear maintainer:
>
> During a rebuild of all packages in unstable, your package failed to build:
>
> 
> [...]
>  debian/rules build
> dh build --with elpa --with bash-completion
>dh_update_autotools_config
>dh_autoreconf
>dh_auto_configure
>dh_auto_build
>   make -j2
> make[1]: Entering directory '/<>'
> pod2man --section=1 --date="Debian Project" --center="User Commands" \
>   --utf8 \
>   --name=mdmv \
>   mdmv.1.pod mdmv.1
> pod2man --section=1 --date="Debian Project" --center="User Commands" \
>   --utf8 \
>   --name=mbox2maildir \
>   mbox2maildir.1.pod mbox2maildir.1
> pod2man --section=1 --date="Debian Project" --center="User Commands" \
>   --utf8 \
>   --name=notmuch-slurp-debbug \
>   notmuch-slurp-debbug.1.pod notmuch-slurp-debbug.1
> pod2man --section=1 --date="Debian Project" --center="User Commands" \
>   --utf8 \
>   --name=notmuch-extract-patch \
>   notmuch-extract-patch.1.pod notmuch-extract-patch.1
> pod2man --section=1 --date="Debian Project" --center="User Commands" \
>   --utf8 \
>   --name=maildir-import-patch \
>   maildir-import-patch.1.pod maildir-import-patch.1
> pod2man --section=1 --date="Debian Project" --center="User Commands" \
>   --utf8 \
>   --name=mbox-extract-patch \
>   mbox-extract-patch.1.pod mbox-extract-patch.1
> pod2man --section=1 --date="Debian Project" --center="User Commands" \
>   --utf8 \
>   --name=imap-dl \
>   imap-dl.1.pod imap-dl.1
> pod2man --section=1 --date="Debian Project" --center="User Commands" \
>   --utf8 \
>   --name=email-extract-openpgp-certs \
>   email-extract-openpgp-certs.1.pod email-extract-openpgp-certs.1
> pod2man --section=1 --date="Debian Project" --center="User Commands" \
>   --utf8 \
>   --name=email-print-mime-structure \
>   email-print-mime-structure.1.pod email-print-mime-structure.1
> pod2man --section=1 --date="Debian Project" --center="User Commands" \
>   --utf8 \
>   --name=notmuch-import-patch \
>   notmuch-import-patch.1.pod notmuch-import-patch.1
> pod2man --section=1 --date="Debian Project" --center="User Commands" \
>   --utf8 \
>   --name=gmi2email \
>   gmi2email.1.pod gmi2email.1
> mkdir -p completions/bash
> register-python-argcomplete email-print-mime-structure 
> >completions/bash/email-print-mime-structure.tmp
> mv completions/bash/email-print-mime-structure.tmp 
> completions/bash/email-print-mime-structure
> mkdir -p completions/bash
> register-python-argcomplete imap-dl >completions/bash/imap-dl.tmp
> mv completions/bash/imap-dl.tmp completions/bash/imap-dl
> make[1]: Leaving directory '/<>'
>dh_auto_test
>   make -j2 check
> make[1]: Entering directory '/<>'
> ./tests/email-print-mime-structure.sh
> Testing alternative.eml
> Testing attachment.eml
> Testing encrypted.eml (PGPy)
> /usr/lib/python3/dist-packages/pgpy/constants.py:192: 
> CryptographyDeprecationWarning: IDEA has been deprecated and will be removed 
> in a future release
>   bs = {SymmetricKeyAlgorithm.IDEA: algorithms.IDEA,
> /usr/lib/python3/dist-packages/pgpy/constants.py:194: 
> CryptographyDeprecationWarning: CAST5 has been deprecated and will be removed 
> in a future release
>   SymmetricKeyAlgorithm.CAST5: algorithms.CAST5,
> /usr/lib/python3/dist-packages/pgpy/constants.py:195: 
> CryptographyDeprecationWarning: Blowfish has been deprecated and will be 
> removed in a future release
>   SymmetricKeyAlgorithm.Blowfish: algorithms.Blowfish,
> Testing encrypted.eml (GnuPG PGP/MIME)
> Testing simple.eml
> Testing smime-encrypted.eml (OpenSSL)
> Testing smime-encrypted.eml (GnuPG S/MIME)
> gpgsm: issuer certificate (#/CN=Sample LAMPS Certificate Authority) not found
> Testing smime-signed.eml
> mypy --strict ./email-print-mime-structure
> email-print-mime-structure:51: error: Unused "type: ignore" comment  
> [unused-ignore]
> email-print-mime-structure:53: error: Incompatible types in assignment 
> (expression has type "None", variable has type Module)  [assignment]
> email-print-mime-structure:77: error: Incompatible types in assignment 
> (expression has type "Message | str | list[Message | str] | Any", variable 
> has type "list[Message] | str | bytes | None")  [assignment]
> email-print-mime-structure:109: error: Incompatible types in assignment 
> (expression has type "Message | bytes | Any", variable has type 
> "list[Message] | str | bytes | None")  [assignment]
> email-print-mime-structure:121: error: Incompatible types in assignment 
> (expression has type "Message | bytes | Any", variable has type 
> "list[Message] | str | bytes | None")  [assignment]
> 

Bug#1067796: mailscripts: FTBFS: email-print-mime-structure:51: error: Unused "type: ignore" comment

2024-03-26 Thread Santiago Vila

Package: src:mailscripts
Version: 28-1
Severity: serious
Tags: ftbfs

Dear maintainer:

During a rebuild of all packages in unstable, your package failed to build:


[...]
 debian/rules build
dh build --with elpa --with bash-completion
   dh_update_autotools_config
   dh_autoreconf
   dh_auto_configure
   dh_auto_build
make -j2
make[1]: Entering directory '/<>'
pod2man --section=1 --date="Debian Project" --center="User Commands" \
--utf8 \
--name=mdmv \
mdmv.1.pod mdmv.1
pod2man --section=1 --date="Debian Project" --center="User Commands" \
--utf8 \
--name=mbox2maildir \
mbox2maildir.1.pod mbox2maildir.1
pod2man --section=1 --date="Debian Project" --center="User Commands" \
--utf8 \
--name=notmuch-slurp-debbug \
notmuch-slurp-debbug.1.pod notmuch-slurp-debbug.1
pod2man --section=1 --date="Debian Project" --center="User Commands" \
--utf8 \
--name=notmuch-extract-patch \
notmuch-extract-patch.1.pod notmuch-extract-patch.1
pod2man --section=1 --date="Debian Project" --center="User Commands" \
--utf8 \
--name=maildir-import-patch \
maildir-import-patch.1.pod maildir-import-patch.1
pod2man --section=1 --date="Debian Project" --center="User Commands" \
--utf8 \
--name=mbox-extract-patch \
mbox-extract-patch.1.pod mbox-extract-patch.1
pod2man --section=1 --date="Debian Project" --center="User Commands" \
--utf8 \
--name=imap-dl \
imap-dl.1.pod imap-dl.1
pod2man --section=1 --date="Debian Project" --center="User Commands" \
--utf8 \
--name=email-extract-openpgp-certs \
email-extract-openpgp-certs.1.pod email-extract-openpgp-certs.1
pod2man --section=1 --date="Debian Project" --center="User Commands" \
--utf8 \
--name=email-print-mime-structure \
email-print-mime-structure.1.pod email-print-mime-structure.1
pod2man --section=1 --date="Debian Project" --center="User Commands" \
--utf8 \
--name=notmuch-import-patch \
notmuch-import-patch.1.pod notmuch-import-patch.1
pod2man --section=1 --date="Debian Project" --center="User Commands" \
--utf8 \
--name=gmi2email \
gmi2email.1.pod gmi2email.1
mkdir -p completions/bash
register-python-argcomplete email-print-mime-structure 
>completions/bash/email-print-mime-structure.tmp
mv completions/bash/email-print-mime-structure.tmp 
completions/bash/email-print-mime-structure
mkdir -p completions/bash
register-python-argcomplete imap-dl >completions/bash/imap-dl.tmp
mv completions/bash/imap-dl.tmp completions/bash/imap-dl
make[1]: Leaving directory '/<>'
   dh_auto_test
make -j2 check
make[1]: Entering directory '/<>'
./tests/email-print-mime-structure.sh
Testing alternative.eml
Testing attachment.eml
Testing encrypted.eml (PGPy)
/usr/lib/python3/dist-packages/pgpy/constants.py:192: 
CryptographyDeprecationWarning: IDEA has been deprecated and will be removed in 
a future release
  bs = {SymmetricKeyAlgorithm.IDEA: algorithms.IDEA,
/usr/lib/python3/dist-packages/pgpy/constants.py:194: 
CryptographyDeprecationWarning: CAST5 has been deprecated and will be removed 
in a future release
  SymmetricKeyAlgorithm.CAST5: algorithms.CAST5,
/usr/lib/python3/dist-packages/pgpy/constants.py:195: 
CryptographyDeprecationWarning: Blowfish has been deprecated and will be 
removed in a future release
  SymmetricKeyAlgorithm.Blowfish: algorithms.Blowfish,
Testing encrypted.eml (GnuPG PGP/MIME)
Testing simple.eml
Testing smime-encrypted.eml (OpenSSL)
Testing smime-encrypted.eml (GnuPG S/MIME)
gpgsm: issuer certificate (#/CN=Sample LAMPS Certificate Authority) not found
Testing smime-signed.eml
mypy --strict ./email-print-mime-structure
email-print-mime-structure:51: error: Unused "type: ignore" comment  
[unused-ignore]
email-print-mime-structure:53: error: Incompatible types in assignment (expression has 
type "None", variable has type Module)  [assignment]
email-print-mime-structure:77: error: Incompatible types in assignment (expression has type 
"Message | str | list[Message | str] | Any", variable has type "list[Message] | str 
| bytes | None")  [assignment]
email-print-mime-structure:109: error: Incompatible types in assignment (expression has type 
"Message | bytes | Any", variable has type "list[Message] | str | bytes | 
None")  [assignment]
email-print-mime-structure:121: error: Incompatible types in assignment (expression has type 
"Message | bytes | Any", variable has type "list[Message] | str | bytes | 
None")  [assignment]
email-print-mime-structure:181: error: Incompatible types in assignment (expression has type 
"Message | str | list[Message | str] | Any", variable has type "list[Message] | str 
| bytes | None")  [assignment]
Found 6 errors in 1 file (checked 1 source file)
make[1]: *** [Makefile:15: check] Error 1
make[1]: