aboutsummaryrefslogtreecommitdiffstats
path: root/lang/python/setup.py
diff options
context:
space:
mode:
authorJustus Winter <[email protected]>2016-05-11 09:42:00 +0000
committerJustus Winter <[email protected]>2016-05-11 11:33:05 +0000
commita29babd07cf9f9625d2b5aa2eb6b7bc9d1828359 (patch)
tree5d59f8ab48f2d2f3db1ef70dcb9ca760444635cc /lang/python/setup.py
parentpython: PEP8 fixes. (diff)
downloadgpgme-a29babd07cf9f9625d2b5aa2eb6b7bc9d1828359.tar.gz
gpgme-a29babd07cf9f9625d2b5aa2eb6b7bc9d1828359.zip
python: Integrate into the build system.
* configure.ac: Make Python bindings configurable, add new Makefile. * lang/python/Makefile.am: New file. * lang/python/setup.py: Integrate into the build system. * m4/ax_pkg_swig.m4: New file from the autoconf archive. * m4/m4_ax_swig_python.m4: Likewise. Signed-off-by: Justus Winter <[email protected]>
Diffstat (limited to '')
-rwxr-xr-xlang/python/setup.py42
1 files changed, 12 insertions, 30 deletions
diff --git a/lang/python/setup.py b/lang/python/setup.py
index 562c08f4..f3d91431 100755
--- a/lang/python/setup.py
+++ b/lang/python/setup.py
@@ -22,31 +22,23 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
# END OF COPYRIGHT #
-
from distutils.core import setup, Extension
-from distutils.command.build_ext import build_ext
import os, os.path, sys
import subprocess
-sys.path.append("pyme")
-import version
+sys.path.insert(0, os.path.dirname(__file__))
+import pyme.version
def getconfig(what):
- try:
- process = subprocess.Popen(["gpgme-config", "--%s" % what],
- stdout=subprocess.PIPE)
- confdata = process.communicate()[0]
- except OSError as e:
- if e.errno == os.errno.ENOENT:
- raise RuntimeError("Could not call gpgme-config, perhaps install libgpgme-dev")
- else:
- raise
+ confdata = subprocess.Popen(["../../src/gpgme-config", "--%s" % what],
+ stdout=subprocess.PIPE).communicate()[0]
return [x for x in confdata.decode('utf-8').split() if x != '']
include_dirs = [os.getcwd()]
define_macros = []
-library_dirs = []
+library_dirs = ["../../src/.libs"] # XXX uses libtool internals
libs = getconfig('libs')
+
for item in getconfig('cflags'):
if item.startswith("-I"):
include_dirs.append(item[2:])
@@ -82,16 +74,6 @@ if uname_s.startswith("MINGW32"):
library_dirs.append(os.path.join(tgt, item))
break
-try:
- subprocess.call("swig")
-except OSError as e:
- if e.errno == os.errno.ENOENT:
- raise RuntimeError("Could not call swig, perhaps install swig.")
- else:
- raise
-
-subprocess.call(["make swig"], shell=True)
-
swige = Extension("pyme._pygpgme", ["gpgme_wrap.c", "helpers.c"],
include_dirs = include_dirs,
define_macros = define_macros,
@@ -99,15 +81,15 @@ swige = Extension("pyme._pygpgme", ["gpgme_wrap.c", "helpers.c"],
extra_link_args = libs)
setup(name = "pyme",
- version = version.versionstr,
- description = version.description,
- author = version.author,
- author_email = version.author_email,
- url = version.homepage,
+ version=pyme.version.versionstr,
+ description=pyme.version.description,
+ author=pyme.version.author,
+ author_email=pyme.version.author_email,
+ url=pyme.version.homepage,
ext_modules=[swige],
packages = ['pyme', 'pyme.constants', 'pyme.constants.data',
'pyme.constants.keylist', 'pyme.constants.sig'],
- license = version.copyright + \
+ license=pyme.version.copyright + \
", Licensed under the GPL version 2 and the LGPL version 2.1"
)