Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

claws-mail: add support for python plugin #41357

Merged
merged 1 commit into from Jun 6, 2018

Conversation

ajs124
Copy link
Member

@ajs124 ajs124 commented Jun 1, 2018

Motivation for this change

I personally use this plugin, since the distribution I migrated from supported it.

Also, it was marked as TODO, so someone wanted to do this at some point but did not get around to it.

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Fits CONTRIBUTING.md.

Admittedly, the solution I chose, patching out their python detection and enabling it anyways, is not very elegant, but it works.

@@ -41,18 +41,19 @@ stdenv.mkDerivation rec {

outputs = [ "out" "dev" ];

patches = [ ./mime.patch ];
patches = [ ./mime.patch ./disable-python-detection.patch ];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens without the patch?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Without the patch, it checks for python and tries to dlopen libpython27.so during configure and fails, therefore disables the python plugin.

Without this check, it still compiles and works fine. The better way might be fixing the check, but on the other hand, we know python will be there, since it's a dependency.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can provide you the config.log, if you want to. The relevant part looks something like:

| #include <dlfcn.h>
|                    #define PYTHON_SO_FILE "libpython2.7.so"
|
| int
| main ()
| {
| if (!dlopen(PYTHON_SO_FILE, RTLD_NOW | RTLD_GLOBAL)) return 1; return 0;
|   ;
|   return 0;
| }
|
configure:22304: result: no
configure:22306: WARNING: Could not find Python shared libary: libpython2.7.so. Maybe you need to install development packages for Python.```

Copy link
Member

@Mic92 Mic92 Jun 2, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok then the following snippet will be slightly shorter and do not require to maintain a patch:

preConfigure = ''
    # autotools check tries to dlopen libpython as a requirement for the python plugin
    export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${python}/lib
'';

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. Thanks for all your input! This is definitely cleaner.

, curl, dbus, dbus-glib, enchant, gtk2, gnutls, gnupg, gpgme, hicolor-icon-theme
, libarchive, libcanberra-gtk2, libetpan, libnotify, libsoup, libxml2, networkmanager
, openldap , perl, pkgconfig, poppler, python, shared-mime-info, webkitgtk24x-gtk2
, openldap, perl, pkgconfig, poppler, python2Packages, shared-mime-info, webkitgtk24x-gtk2
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

python2Packages is the same as python.pkgs, please use python for Python and python.pkgs instead of python2Packages.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done


postPatch = ''
substituteInPlace src/procmime.c \
--subst-var-by MIMEROOTDIR ${shared-mime-info}/share
'';

nativeBuildInputs = [ pkgconfig wrapGAppsHook ];
nativeBuildInputs = [ autoreconfHook pkgconfig wrapGAppsHook python2Packages.wrapPython ];
propagatedBuildInputs = with python2Packages; [ python ] ++ optional enablePluginPython [ pygtk pygobject2 ];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should use optionals with lists.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and done, I think. Maybe I misunderstood you.

@orivej orivej self-assigned this Jun 1, 2018
@Mic92 Mic92 merged commit 5db9181 into NixOS:master Jun 6, 2018
@Mic92
Copy link
Member

Mic92 commented Jun 6, 2018

Thanks!

@ajs124 ajs124 deleted the claws_mail_python branch July 31, 2018 11:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants