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

python3Packages.gpgme: enable python3 support #46304

Merged
merged 1 commit into from Oct 19, 2018
Merged

Conversation

teto
Copy link
Member

@teto teto commented Sep 7, 2018

when calling python3Packages.gpgme, it was still picking python2.
Changed withPython into pythonSupport since it's the convention.

I had to enable ncurses too because of this error when configuring:

configure:19858: checking for Python include path
configure:19874: result: -I/nix/store/hy65mn4wjswqih75gfr6g4q3xgqdm325-python3-3.6.6/include/python3.6m
configure:19881: checking for Python library path
configure:19958: result: -L/nix/store/hy65mn4wjswqih75gfr6g4q3xgqdm325-python3-3.6.6/lib -lpython3.6m
configure:19965: checking for Python site-packages path
configure:19971: result: /nix/store/hy65mn4wjswqih75gfr6g4q3xgqdm325-python3-3.6.6/lib/python3.6/site-packages
configure:19978: checking python extra libraries
configure:19985: result: -lpthread -ldl -lcrypt -lncurses -lutil -lm
configure:19992: checking python extra linking flags
configure:19999: result: -Xlinker -export-dynamic
configure:20006: checking consistency of all components of python development environment
configure:20032: gcc -o conftest -g -O2  -I/nix/store/hy65mn4wjswqih75gfr6g4q3xgqdm325-python3-3.6.6/include/python3.6m  conftest.c  -L/nix/store/hy65mn4wjswqih75gfr6g4q3xgqdm325-python3-3.6.6/lib -lpython3.6m -Xlinker -export-dynamic -lpthread -ldl -lcrypt -lncurses -lutil -lm >&5
/nix/store/h0lbngpv6ln56hjj59i6l77vxq25flbz-binutils-2.30/bin/ld: cannot find -lncurses
collect2: error: ld returned 1 exit status
configure:20032: $? = 1
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME "gpgme"
| #define PACKAGE_TARNAME "gpgme"
| #define PACKAGE_VERSION "1.11.1"
| #define PACKAGE_STRING "gpgme 1.11.1"
| #define PACKAGE_BUGREPORT "http://bugs.gnupg.org"
| #define PACKAGE_URL ""
| #define PACKAGE "gpgme"
| #define VERSION "1.11.1"
| #define STDC_HEADERS 1
| #define HAVE_SYS_TYPES_H 1
| #define HAVE_SYS_STAT_H 1
| #define HAVE_STDLIB_H 1
| #define HAVE_STRING_H 1
| #define HAVE_MEMORY_H 1
| #define HAVE_STRINGS_H 1
| #define HAVE_INTTYPES_H 1
| #define HAVE_STDINT_H 1
| #define HAVE_UNISTD_H 1
| #define __EXTENSIONS__ 1
| #define _ALL_SOURCE 1
| #define _GNU_SOURCE 1
| #define _POSIX_PTHREAD_SEMANTICS 1
| #define _TANDEM_SOURCE 1
| #define PACKAGE "gpgme"
| #define VERSION "1.11.1"
| #define HAVE_DLFCN_H 1
| #define LT_OBJDIR ".libs/"
| #define FIXED_SEARCH_PATH "/nix/store/cf1fwlgilrv4z45qw5zvqkkvb1bv6zyv-gnupg-2.2.9/bin"
| /* end confdefs.h.  */
| 
| 		#include <Python.h>
| int
| main ()
| {
| Py_Initialize();
|   ;
|   return 0;
| }
| 
configure:20049: result: no
configure:20062: WARNING:
  Could not link test program to Python. Maybe the main Python library has been
  installed in some non-standard library path. If so, pass it to configure,
  via the LDFLAGS environment variable.
  Example: ./configure LDFLAGS="-L/usr/non-standard-path/python/lib"
  ============================================================================
   You probably have to install the development version of the Python package
   for your distribution.  The exact name of this package varies among them.
  ============================================================================
	   

Motivation for this change

Need python3 bindings for my mail agent "alot"

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/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Fits CONTRIBUTING.md.

@teto
Copy link
Member Author

teto commented Sep 25, 2018

@FRidh should I put this into staging ?

@teto teto mentioned this pull request Oct 10, 2018
9 tasks
@dtzWill
Copy link
Member

dtzWill commented Oct 10, 2018

LGTM! I actually did largely the same thing to get gpgme working w/py3 for use with recent alot:

dtzWill@70c4b8f

(commit not intended for upstream inclusion as-is, but even so it's what I've been using and works for me--yours looks the same but better ;))

@teto teto changed the title pythonPackages.gpgme: enable python3 support python3Packages.gpgme: enable python3 support Oct 15, 2018
@teto
Copy link
Member Author

teto commented Oct 15, 2018

@GrahamcOfBorg build python3Packages.gpgme

@GrahamcOfBorg
Copy link

Failure on aarch64-linux (full log)

Attempted: python3Packages.gpgme

Partial log (click to expand)

   You probably have to install the development version of the Python package
   for your distribution.  The exact name of this package varies among them.
  ============================================================================

configure: error:
***
*** Please install the python development packages.
***
builder for '/nix/store/7y8pxhs5r15h4fp23zjrndr6ka9mi8kh-gpgme-1.12.0.drv' failed with exit code 1
error: build of '/nix/store/7y8pxhs5r15h4fp23zjrndr6ka9mi8kh-gpgme-1.12.0.drv' failed

@GrahamcOfBorg
Copy link

Failure on x86_64-linux (full log)

Attempted: python3Packages.gpgme

Partial log (click to expand)

   You probably have to install the development version of the Python package
   for your distribution.  The exact name of this package varies among them.
  ============================================================================

configure: error:
***
*** Please install the python development packages.
***
builder for '/nix/store/xvviaf9nfjbxy49z5qm9329z1kwz7cvs-gpgme-1.12.0.drv' failed with exit code 1
error: build of '/nix/store/xvviaf9nfjbxy49z5qm9329z1kwz7cvs-gpgme-1.12.0.drv' failed

@teto teto changed the title python3Packages.gpgme: enable python3 support python3Packages.gpgme: enable python3 support [wip] Oct 15, 2018
@teto teto changed the title python3Packages.gpgme: enable python3 support [wip] python3Packages.gpgme: enable python3 support Oct 18, 2018
@teto
Copy link
Member Author

teto commented Oct 18, 2018

Needed to test master version of alot with python3 support @Fuuzetsu @primeos

@primeos
Copy link
Member

primeos commented Oct 18, 2018

Needed to test master version of alot with python3 support @Fuuzetsu @primeos

What do you mean with this comment? According to GrahamcOfBorg gpgme doesn't build with Python(3) support, that should be fixed first. Also: I'm happy to help with gpgme but I'm neither using nor maintaining alot.

@teto
Copy link
Member Author

teto commented Oct 18, 2018

@GrahamcOfBorg build python3Packages.gpgme

@GrahamcOfBorg
Copy link

Success on aarch64-linux (full log)

Attempted: python3Packages.gpgme

Partial log (click to expand)

shrinking /nix/store/72wfnshv009a5m211l0zmgfmlsrpss6q-gpgme-1.12.0-dev/bin/gpgme-tool
strip is /nix/store/p9akxn2sfy4wkhqdqa3li97pc6jaz3r1-binutils-2.30/bin/strip
stripping (with command strip and flags -S) in /nix/store/72wfnshv009a5m211l0zmgfmlsrpss6q-gpgme-1.12.0-dev/bin
patching script interpreter paths in /nix/store/72wfnshv009a5m211l0zmgfmlsrpss6q-gpgme-1.12.0-dev
/nix/store/72wfnshv009a5m211l0zmgfmlsrpss6q-gpgme-1.12.0-dev/bin/gpgme-config: interpreter directive changed from "/bin/sh" to "/nix/store/dsyc1z7ck08ga7l0b1jcxx35wj69qcii-bash-4.4-p23/bin/sh"
checking for references to /build in /nix/store/72wfnshv009a5m211l0zmgfmlsrpss6q-gpgme-1.12.0-dev...
shrinking RPATHs of ELF executables and libraries in /nix/store/b3x9nskcp09jjg51fxcgp49gkdnxqi1z-gpgme-1.12.0-info
strip is /nix/store/p9akxn2sfy4wkhqdqa3li97pc6jaz3r1-binutils-2.30/bin/strip
patching script interpreter paths in /nix/store/b3x9nskcp09jjg51fxcgp49gkdnxqi1z-gpgme-1.12.0-info
checking for references to /build in /nix/store/b3x9nskcp09jjg51fxcgp49gkdnxqi1z-gpgme-1.12.0-info...

@GrahamcOfBorg
Copy link

Success on x86_64-linux (full log)

Attempted: python3Packages.gpgme

Partial log (click to expand)

shrinking /nix/store/p265lww9xk8lzg0fbjlvwg936w67bny9-gpgme-1.12.0-dev/bin/gpgme-json
strip is /nix/store/vcc4svb8gy29g4pam2zja6llkbcwsyiq-binutils-2.30/bin/strip
stripping (with command strip and flags -S) in /nix/store/p265lww9xk8lzg0fbjlvwg936w67bny9-gpgme-1.12.0-dev/bin
patching script interpreter paths in /nix/store/p265lww9xk8lzg0fbjlvwg936w67bny9-gpgme-1.12.0-dev
/nix/store/p265lww9xk8lzg0fbjlvwg936w67bny9-gpgme-1.12.0-dev/bin/gpgme-config: interpreter directive changed from "/bin/sh" to "/nix/store/r47p5pzx52m3n34vdgqpk5rvqgm0m24m-bash-4.4-p23/bin/sh"
checking for references to /build in /nix/store/p265lww9xk8lzg0fbjlvwg936w67bny9-gpgme-1.12.0-dev...
shrinking RPATHs of ELF executables and libraries in /nix/store/lbrvq1bw203d0939c2n16x2ns6gaja13-gpgme-1.12.0-info
strip is /nix/store/vcc4svb8gy29g4pam2zja6llkbcwsyiq-binutils-2.30/bin/strip
patching script interpreter paths in /nix/store/lbrvq1bw203d0939c2n16x2ns6gaja13-gpgme-1.12.0-info
checking for references to /build in /nix/store/lbrvq1bw203d0939c2n16x2ns6gaja13-gpgme-1.12.0-info...

@teto
Copy link
Member Author

teto commented Oct 18, 2018

@primeos true my comment was a bit cryptic. I just looked for the gpgme maintainers to see if I could do anything to merge this. GrahamcOfBorg didn't trigger on my force push but it now compiles (and works with the mail client alot)

, autoreconfHook
, git
, texinfo
, qtbase ? null
, withPython ? false, swig2 ? null, python ? null
, pythonSupport ? false, swig2 ? null, python ? null
Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure about this change. It obviously makes sense to stick to conventions but I'm also against backward incompatible changes that could break setups (I don't know how many users override withPython). I also wonder if this convention is documented somewhere (didn't find anything inside the manuals).

But pythonSupport is definitely used more often:

$ git grep withPython | wc -l
31
$ git grep pythonSupport | wc -l
89

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 remember a PR to improve python docs where I suggested to add it but can't find it again. Another suggestion is 39e9de1#r29184438 .
I am for changing the parameter name as my main grip with nixpkgs is its lack of consistency (across languages mainly).
People needing the python support must have been using pythonPackages.gpgme so it should impact 0 or few people.

I am not sure quite why we need ncurses except for this command line done by gpgme.

configure:20006: checking consistency of all components of python development environment
configure:20032: gcc -o conftest -g -O2  -I/nix/store/hy65mn4wjswqih75gfr6g4q3xgqdm325-python3-3.6.6/include/python3.6m  conftest.c  -L/nix/store/hy65mn4wjswqih75gfr6g4q3xgqdm325-python3-3.6.6/lib -lpython3.6m -Xlinker -export-dynamic -lpthread -ldl -lcrypt -lncurses -lutil -lm >&5
/nix/store/h0lbngpv6ln56hjj59i6l77vxq25flbz-binutils-2.30/bin/ld: cannot find -lncurses

anyway I request ncurses only when python is used.

Copy link
Member

Choose a reason for hiding this comment

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

Ok, thanks for elaborating. You're right, due to pythonPackages.gpgme this shouldn't cause much problems :)

@@ -28,8 +28,8 @@ stdenv.mkDerivation rec {
[ libgpgerror glib libassuan pth ]
++ lib.optional (qtbase != null) qtbase;

nativeBuildInputs = [ file pkgconfig gnupg autoreconfHook git texinfo ]
++ lib.optionals withPython [ python swig2 which ];
nativeBuildInputs = [ file pkgconfig gnupg autoreconfHook git texinfo ncurses ]
Copy link
Member

Choose a reason for hiding this comment

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

Can you move ncurses to the next line (only add it for Python support) or is there a reason to always add it (I couldn't find a dependency on ncurses in the source code)?

when calling python3Packages.gpgme, it was still picking python2.
Changed withPython into pythonSupport since it's the convention.

I had to enable ncurses too because of this error when configuring:

configure:19978: checking python extra libraries
configure:19985: result: -lpthread -ldl -lcrypt -lncurses -lutil -lm
configure:19992: checking python extra linking flags
configure:19999: result: -Xlinker -export-dynamic
configure:20006: checking consistency of all components of python development environment
configure:20032: gcc -o conftest -g -O2  -I/nix/store/hy65mn4wjswqih75gfr6g4q3xgqdm325-python3-3.6.6/include/python3.6m  conftest.c  -L/nix/store/hy65mn4wjswqih75gfr6g4q3xgqdm325-python3-3.6.6/lib -lpython3.6m -Xlinker -export-dynamic -lpthread -ldl -lcrypt -lncurses -lutil -lm >&5
/nix/store/h0lbngpv6ln56hjj59i6l77vxq25flbz-binutils-2.30/bin/ld: cannot find -lncurses
collect2: error: ld returned 1 exit status
configure:20032: $? = 1
Copy link
Member

@primeos primeos left a comment

Choose a reason for hiding this comment

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

Thanks, all rebuilds still succeed :)

@primeos primeos merged commit 02b5f4f into NixOS:master Oct 19, 2018
@teto teto deleted the gpgme_python3 branch May 13, 2020 09:52
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