python: replace hardcoding of SONAME version

Failing to update this string in globals.py causes failures when the
SONAME changes.  In order to hopefully reduce the number of such
errors, automate the process of setting the SONAME in the python
bindings.
This commit is contained in:
David Bremner 2015-03-07 08:31:14 +01:00
parent a00b4abc27
commit aed5ec4350
3 changed files with 7 additions and 3 deletions

View file

@ -107,7 +107,9 @@ dist: $(TAR_FILE)
.PHONY: update-versions .PHONY: update-versions
update-versions: update-versions:
sed -i "s/^__VERSION__[[:blank:]]*=.*$$/__VERSION__ = \'${VERSION}\'/" $(PV_FILE) sed -i -e "s/^__VERSION__[[:blank:]]*=.*$$/__VERSION__ = \'${VERSION}\'/" \
-e "s/^SOVERSION[[:blank:]]*=.*$$/SOVERSION = \'${LIBNOTMUCH_VERSION_MAJOR}\'/" \
${PV_FILE}
# We invoke make recursively only to force ordering of our phony # We invoke make recursively only to force ordering of our phony
# targets in the case of parallel invocation of make (-j). # targets in the case of parallel invocation of make (-j).

View file

@ -18,15 +18,16 @@ Copyright 2010 Sebastian Spaeth <Sebastian@SSpaeth.de>
""" """
from ctypes import CDLL, Structure, POINTER from ctypes import CDLL, Structure, POINTER
from version import SOVERSION
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
#package-global instance of the notmuch library #package-global instance of the notmuch library
try: try:
from os import uname from os import uname
if uname()[0] == 'Darwin': if uname()[0] == 'Darwin':
nmlib = CDLL("libnotmuch.4.dylib") nmlib = CDLL("libnotmuch.{0:s}.dylib".format(SOVERSION))
else: else:
nmlib = CDLL("libnotmuch.so.4") nmlib = CDLL("libnotmuch.so.{0:s}".format(SOVERSION))
except: except:
raise ImportError("Could not find shared 'notmuch' library.") raise ImportError("Could not find shared 'notmuch' library.")

View file

@ -1,2 +1,3 @@
# this file should be kept in sync with ../../../version # this file should be kept in sync with ../../../version
__VERSION__ = '0.19' __VERSION__ = '0.19'
SOVERSION = '4'