* Moved the build import back up where it belongs.
* Included comments indicating how to build and install for multiple
Python versions beyond the first 2 on the same system.
* lang/python/version.py.in: Fixed most things, but there's still an
issue near the build portion with the existing Python bugs referenced.
* lang/python/setup.py.in: Now PEP8 compliant.
* Bindings confirmed to work with the newly released 3.7.0.
* Updated M4 file to reflect this change and correct the Python binary
search order (3.7 is not yet given priority, but will still be found
first via the more generic python3 executable).
* Updated setup.py.in, bindings documentation and README to reflect this.
* lang/python/setup.py.in: Copy gpgme.h instead of parsing it.
--
The python bindings tried to parse deprecated functions
out of gpgme.h. This fails for the current gpgme.h in
that it removes an entire field in the key sig struct (_obsolete_class).
Hence, the fields were off by an int and the bindings accessed struct
members via the wrong offset. That caused python program to crash.
At least on 32bit platforms, the crash can be easily triggered by
accessing key.uids[0].signatures. On 64bit platforms the compiler
probably aligns the struct so that the missing 4 bytes are not noticed.
With this change, the python bindings will expose all functions
that gpgme exposes, including the deprecated ones.
Credits go to Justus Winter for debugging and identying the issue.
Signed-off-by: Tobias Mueller <muelli@cryptobitch.de>
GnuPG-bug-id: 3892
* lang/python/setup.py.in: Prepend the Python build dir to the list of
include directories so that it takes precedence over any other include
directory.
--
Fixes the build in case an older 'gpgme.h' is installed and is picked
up by the compiler when compiling the Python module.
Signed-off-by: Justus Winter <justus@g10code.com>
* lang/python/setup.py.in: Read gpg-error.h using the pre-processor.
--
The libgpg-error may be installed in multilib configuration in which
there is a wrapper header at /usr/include that includes the actual
header at /usr/include/*. This causes invalid errors.i generation.
Let the pre-processor extract the header content instead reading it
explicitly.
Signed-off-by: Alon Bar-Lev <alon.barlev@gmail.com>
* lang/python/setup.py.in: Do not parse arguments.
--
The distutils settings can come from either command-line or
configuration file. Parsing parameters is not working in all cases.
Signed-off-by: Alon Bar-Lev <alon.barlev@gmail.com>
* lang/python/gpg/version.py.in: Rename to lang/python/version.py.in.
configure.ac: Generate version.py.in in lang/python.
* lang/python/MANIFEST.in: Include version.py explicitly.
* lang/python/gpg: Rename to 'src'.
* lang/python/Makefile.am: Do not copy source files, do not use absolute
directories, support lib64 in uninstall, clean also dist directory, use
symlink for gpg src.
* lang/python/setup.py.in: Use builddir, copy sources into builddir,
copy version.py into module.
--
Simplify build to symlink the gpg sources into builddir instead of
copying. This requires handling of version.py as generated file.
In addition apply some cleanups: Drop the absolution pathes, clean the
dist directory as well, support lib64 for sitelib at uninstall.
Signed-off-by: Alon Bar-Lev <alon.barlev@gmail.com>
* lang/python/gpgme-h-clean.py: Delete file.
* lang/python/MANIFEST.in: Adapt accordingly.
* lang/python/Makefile.am (EXTRA_DIST): Likewise.
(COPY_FILES_GPG): Bring variable back.
(copystamp): Copy files.
(clean-local): Delete copied files.
(install-exec-local): Do not create and install list of installed
files.
(uninstall-local): Instead, create some explicit rules to uninstall
the extension.
* lang/python/setup.py.in: Parse arguments. Locate files either in
the source directory, or in the build base directory. Inline the code
from 'gpgme-h-clean.py'. Copy 'helpers.c', add source directory as
include directory.
Fixes-commit: 801d7d8c5d
Signed-off-by: Justus Winter <justus@g10code.com>
* lang/python/setup.py.in: Generate files within BuildExtFirstHack
adjust build flags at this point instead of global.
* lang/python/Makefile.am: Remove logic of separate source directory per
python version in favor of build directory.
* lang/python/tests/run-tests.py: Adjust build directory location.
--
Generate files into build directory, leaving the source directory clean.
Use the same source directory for multiple python version build. Result
of 'prepare' target is a standard distutil layout that can be used
easily by downstream to build all python targets in-place.
Signed-off-by: Alon Bar-Lev <alon.barlev@gmail.com>
* lang/python/Makefile.am: Fix 'prepare' target.
* lang/python/setup.py.in: Use 'abs_top_builddir' instead of guessing
the path.
--
'prepare' will prepare target at PREPAREDIR. The automake integration
will also make use of prepare target. Downstream distributors may
also make use of prepare target.
Signed-off-by: Alon Bar-Lev <alon.barlev@gmail.com>
* lang/python/Makefile.am (copystamp): Also copy the setup script, and
link the header files.
(all-local): Use local setup script.
(sdist): Fix Python source distribution creation.
(CLEANFILES): Remove now obsolete files.
(install-exec-local): Use local setup script.
* lang/python/setup.py.in: Adjust relative paths to in-tree files.
Fixes-commit: fe65a26ab5
Signed-off-by: Justus Winter <justus@g10code.com>
* lang/python/setup.py.in: Call SWIG without the builtin flag.
--
The SWIG documentation
<http://www.swig.org/Doc2.0/Python.html#Python_nn28> leaves the
impression that -builtin is solely for increasing performance:
New in SWIG version 2.0.4: The use of Python proxy classes has
performance implications that may be unacceptable for a high-
performance library. The new -builtin option instructs SWIG to
forego the use of proxy classes, and instead create wrapped types as
new built-in Python types. When this option is used, the following
section ("Proxy classes") does not apply. Details on the use of the
-builtin option are in the Built-in Types section.
While not wasting CPU cycles is good, it also prevents Python code being
written in the wrapper itself. That, however, may be useful to make it
easier to extend the wrapper.
Partially reverts: 856bcfe293
Signed-off-by: Tobias Mueller <muelli@cryptobitch.de>
* lang/python/setup.py.in: Only call with -py3 when we run under python3
or higher.
--
If we ever remove the -builtin flag and leave the the -py3 flag, SWIG
will generate Python code which will be incompatible with Python 2,
because the py3 flag generates python3 code which is incompatible with
python2.
So we conditionally generate SWIG bindings with -py3.
Signed-off-by: Tobias Mueller <muelli@cryptobitch.de>
This follows weeks of discussion on the gnupg-devel mailing list.
Hopefully it will make it easier for people using Python to use GnuPG
in the future.
Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
* lang/python/Makefile.am: Link to the files.
* lang/python/gpgme.i: Update path.
* lang/python/setup.py.in: Do not add the top builddir to the include
path.
--
To make it easy to build the subpackage using standard tools without
altering environment or CFLAGS, symlink the required artifacts from
source tree into subpackage directory when preparing sources.
Signed-off-by: Alon Bar-Lev <alon.barlev@gmail.com>
* lang/python/Makefile.am: Pass 'top_builddir' to 'setup.py'.
* lang/python/gpgme.i: Include 'config.h'.
* lang/python/helpers.c: Likewise.
* lang/python/helpers.h: Likewise.
* lang/python/setup.py.in: Make sure that 'config.h' can be found.
--
Fixes build on 32 bit platforms with large file support.
Signed-off-by: Justus Winter <justus@g10code.com>
Avoid the name pygpgme, as this is the name of another popular Python
binding for GPGME.
This commit renames the compiled Python module produced by SWIG.
* lang/python/Makefile.am: Rename the compiled Python module.
* lang/python/gpgme.i: Likewise.
* lang/python/pyme/core.py: Likewise.
* lang/python/pyme/errors.py: Likewise.
* lang/python/pyme/util.py: Likewise.
* lang/python/pyme/version.py.in: Likewise.
* lang/python/setup.py.in: Likewise.
Signed-off-by: Justus Winter <justus@g10code.com>
* configure.ac: Generate 'setup.py' and 'version.py'.
* lang/python/Makefile.am: Use generated setup script.
* lang/python/pyme/version.py: Turn it into a template, and get
version information from the build system. Also drop some variables.
* lang/python/setup.py: Likewise. This way we can avoid importing the
version module, which is frowned upon and actually caused a problem.
Signed-off-by: Justus Winter <justus@g10code.com>