Using MailWrap on macOS Monterey

Apple’s Mail Plug-In system is quite amazing, and has led to some innovative and brave developments as an MUA (Mail User Agent). These brave developments include: wrapping long lines like a decent MUA, quoting messages in replies correctly like a decent MUA, and an option to Wrap Text like a decent MUA.

I actually forgot to install MailWrap on my M1 when I built it up, and haven’t noticed mostly because I haven’t been posting to mailing lists lately. However, I feel deep personal shame for posting on lkml without remembering to install it first. Look at those long lines!

So I set out to install MailWrap. It certainly is a lot more difficult than it used to be.

#1: Allowing the installer to access ~/Library/Mail

The first time I tried to install MailWrap, I received the unhelpful message that access to ~/Library/Mail/Bundles was denied. This is because I had to grant Terminal the Full Disk Access permission.

You can do this in System Preferences under Security & Privacy. You’ll be helpfully reminded that you have to restart Terminal. Hope you don’t have six active SSH connections open, like I did!

#2: Using the correct UUID

Now we need to add the correct UUID to the Info.plist file. Open ~/Library/Mail/Bundles/MailWrap.mailbundle/Contents/Info.plist in your favourite plain-text editor. Scroll to where you’ll find “Supported10.16PluginCompatibilityUUIDs” and then add the following lines under the “</array>” line:

        <key>Supported12.2PluginCompatibilityUUIDs</key>
<array>
<string>6FF8B077-81FA-45A4-BD57-17CDE79F13A5</string>
<string>25288CEF-7D9B-49A8-BE6B-E41DA6277CF3</string>
</array>

Note that this says “12.2”; when 12.3 comes out, we will need to change this again.

#3: Sign and allow the bundle to run

Gatekeeper will try to keep you safe from untrusted code, which is generally a good thing. We can sign our bundle now:

$ cd ~/Library/Mail/Bundles
$ codesign -f -s - MailWrap.mailbundle

And now that it is signed properly, we can tell Gatekeeper to trust the signature:

$ sudo spctl --add --label “MailExtensions” MailWrap.mailbundle
$ sudo spctl --enable --label “MailExtensions”

Troubleshooting

Incompatible Plug-ins Disabled.  Mail has disabled the following plug-ins: MailWrap.mailbundle Contact the makers of these plug-ins for versions that are compatible with Mail 15.0.
Incompatible Plug-ins Disabled

If you receive this Incompatible Plug-ins Disabled message, then something has gone wrong with your UUIDs. You’ll need to try again and make sure that you’ve pasted those lines in the correct spot.

“MailWrap.mailbundle” is damaged and can’t be opened.  You should move it to the Bin.  Mail created this file on an unknown date.
“MailWrap.mailbundle” is damaged and can’t be opened.

I received this message when I edited the Info.plist file after running codesign. It means the CodeSignature doesn’t match the contents. You need to re-run the codesign command every time you change any file in the bundle to keep the signature updated.

“Mail” needs to be updated.  This app will not work with future versions of macOS and needs to be updated to improve compatibility.  Contact the developer for more information.
“Mail” needs to be updated.

This message is because MailWrap uses Python 2.7. Hopefully I will have some time to update it to Python 3 before the eventual removal of Python 2.7 from macOS. I’ve had success doing this before, so hopefully it goes well.

In conclusion

Now my emails are nice and wrapped and I’m not breaking a bunch of email clients in faraway lands. And all was quiet in the world. (Except not: the kernel is still broken, and Ukraine is still being invaded.)

I hope this post was useful to you. Happy hacking!

Musings: More Python 3 compat, Project Sunrise, InspIRCd modules and Portage

Some good news: as I eix-sync’d this morning, I noticed that dev-python/ndg-httpsclient and dev-python/ipaddress now have Python 3 compatibility. That means two of the packages I had thought had no chance of being upgraded actually have been. As for my own efforts, I have been very busy with work and musl support patches lately, but I have been looking at fixing up the htop package next.

I’ve found Project Sunrise, a way for me to be able to contribute ebuilds to Gentoo in hopes of someday getting them in the master Portage repository. I’m hoping to add a few Python libraries first, then moving up to packaging SuperGameHerm and PyIRC once they’ve matured enough to be useable by external users.

While testing PyIRC, I needed to be able to use a few modules that are not a part of InspIRCd’s main package. Since Portage didn’t allow any way of including them in the installed package, I simply checked out the source code package, ran modulemanager to add the modules, then built only those modules. I copied them to the /usr/lib64/inspircd/modules directory and added them to modules.conf, and voila! Now I can do more IRCv3.2 testing.

Python 2 -> 3 upgrade: status update

More Python projects ported to Python 3.

This is a small update on my bringing packages in Gentoo to Python 3.

I haven’t had time to contribute as much to this effort as I had hoped, but I have successfully finished with two packages and the patches are now in the hands of upstream maintainers. I’ve been toying with the musl C library as an alternative to glibc (and I’ll be posting about my experiences with that later), which has distracted me a bit from Python 3 work.

app-misc/ca-certificates
Required a bit of effort. Debian #789753 filed. Maintainer seems happy enough with it, but it’s not in master yet.
dev-libs/evdev
This was simple enough; libevdev has had upstream support for Python 3 since 2013. Gentoo #553110 filed with a patch to update the ebuild accordingly. No response as of post time.

Removing Python 2.7 from Gentoo, one port at a time.

Trying to find all the packages I could try to port to be compatible with Python 3.

I’m highly motivated, as a Pythonista who loves Python 3 and all of the new features, syntax, and improvements, to help the rest of the community upgrade to Python 3 and enjoy all of its benefits.

To that end, I would like to end the dependence of Python 2 in the general community. Since I feel I am a fairly average power user of Gentoo, I figured I would start with the packages on my own system, and this is what I found:

  dev-lang/python-2.7.10 pulled in by:
    app-emulation/qemu-2.3.0-r2
    app-emulation/virtualbox-4.3.28
    app-misc/ca-certificates-20141019.3.19
    app-text/gnome-doc-utils-0.20.10-r1
    dev-lang/spidermonkey-1.8.5-r4
    dev-lang/spidermonkey-17.0.0-r3
    dev-lang/spidermonkey-24.2.0-r2
    dev-lang/yasm-1.3.0
    dev-libs/glib-2.44.1
    dev-libs/gobject-introspection-1.44.0
    dev-libs/libevdev-1.4
    dev-libs/libgamin-0.1.10-r5
    dev-libs/libnatspec-0.2.6-r1
    dev-libs/libxslt-1.1.28-r4
    dev-libs/protobuf-2.6.1-r3
    dev-libs/zziplib-0.13.62
    dev-python/google-apputils-0.4.0
    dev-python/ipaddress-1.0.7
    dev-python/librsvg-python-2.32.0-r1
    dev-python/m2crypto-0.22.3-r3
    dev-python/ndg-httpsclient-0.3.2
    dev-python/pygobject-2.28.6-r55
    dev-python/pygoocanvas-0.14.1-r1
    dev-python/python-gflags-2.0
    dev-python/twisted-core-15.2.1
    dev-python/wxpython-3.0.2.0
    dev-util/boost-build-1.56.0
    dev-util/scons-2.3.4
    dev-vcs/git-2.4.3
    dev-vcs/mercurial-3.4.1
    games-emulation/m64py-0.2.1-r1
    gnome-base/gconf-3.2.6-r3
    gnome-base/libglade-2.6.4-r2
    kde-apps/kajongg-4.14.3
    kde-base/krosspython-4.14.3
    kde-base/plasma-workspace-4.11.20
    media-gfx/gimp-2.8.14
    media-libs/alsa-lib-1.0.29
    media-libs/avidemux-plugins-2.6.8
    media-libs/libcaca-0.99_beta19
    media-libs/libgpod-0.8.3
    media-video/openshot-1.4.3
    net-analyzer/nmap-6.49_beta1
    net-dns/avahi-0.6.31-r7
    net-libs/farstream-0.1.2-r2
    net-libs/gupnp-0.20.14
    net-libs/libproxy-0.4.11-r2
    net-print/cups-2.0.2-r2
    net-wireless/crda-3.18
    sys-apps/usbutils-008-r1
    sys-devel/llvm-3.5.2
    sys-process/audit-2.4.1-r1
    sys-process/htop-1.0.3
    www-client/firefox-38.0.1
    x11-libs/xpyb-1.3.1-r3
    x11-plugins/purple-plugin_pack-2.7.0-r1

Not terrible for a world that has 1,277 packages. Now, we can wipe some of those off:

dev-lang/spidermonkey, www-client/firefox
The Mozilla build system…
dev-libs/protobuf, dev-python/google-apputils, dev-python/ipaddress, dev-python/python-gflags-2.0
I can’t make Google care about Python 3. I’m just a lone fox.
dev-python/ndg-httpsclient
This is apparently only pulled in because I have 2.7 compatibility enabled on other packages, and it also appears abandoned upstream.
dev-python/m2crypto
All but deprecated upstream. dev-python/cryptography pretty cleanly replaces it. I simply need to change dependencies to use that instead.
dev-python/twisted-*
The Twisted project is large, and already has a Python 3 objective. No need to worry about that until later, since they have others working on it.
dev-python/wxpython
They, too, are working on an official Python 3 port already. I’ve even used it; though it is ridiculously unstable, there has been a lot of progress made.
dev-util/scons
As of August 2014, they are officially porting to Python 3. Same as Twisted, then.
dev-vcs/mercurial
This is a very large codebase with a lot of issues related to 2->3. Not something one fox can help with either, I’m afraid.
any gnome package
Not really interested in contributing to the ever-dying and unmaintained GTK 2, and definitely not interested in contributing to the abomination of GTK 3.
KDE 4
As KDE 5 nears stability, this will become less and less maintained, so it probably isn’t worth it either.
net-print/cups, sys-devel/llvm
I doubt there is any hope of getting Python 3 code into Apple projects, since they seem to enjoy clinging to 1990-era development tech 😦

After doing some sorting to show the order I’d like to work on these, this leaves us with:

    app-misc/ca-certificates-20141019.3.19
    app-emulation/virtualbox-4.3.28
    dev-libs/libevdev-1.4
    media-libs/libcaca-0.99_beta19
    media-libs/libgpod-0.8.3
    media-libs/alsa-lib-1.0.29
    dev-libs/libxslt-1.1.28-r4
    net-wireless/crda-3.18
    dev-vcs/git-2.4.3
    sys-apps/usbutils-008-r1
    dev-lang/yasm-1.3.0
    x11-plugins/purple-plugin_pack-2.7.0-r1
    sys-process/audit-2.4.1-r1
    net-dns/avahi-0.6.31-r7
    sys-process/htop-1.0.3
    games-emulation/m64py-0.2.1-r1
    net-libs/libproxy-0.4.11-r2
    dev-libs/zziplib-0.13.62
    dev-libs/libnatspec-0.2.6-r1
    app-emulation/qemu-2.3.0-r2
    net-analyzer/nmap-6.49_beta1
    dev-util/boost-build-1.56.0
    media-video/openshot-1.4.3
    media-libs/avidemux-plugins-2.6.8
    x11-libs/xpyb-1.3.1-r3

I would really like to do at least one per week, but there’s no guarantees of course. Wish me luck!