unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* [PATCH] python: replace hardcoding of SONAME version
@ 2015-03-07  7:31 David Bremner
  2015-03-07 10:42 ` Tomi Ollila
  2015-03-08  7:35 ` David Bremner
  0 siblings, 2 replies; 3+ messages in thread
From: David Bremner @ 2015-03-07  7:31 UTC (permalink / raw)
  To: notmuch

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.
---
 Makefile.local                     | 4 +++-
 bindings/python/notmuch/globals.py | 5 +++--
 bindings/python/notmuch/version.py | 1 +
 3 files changed, 7 insertions(+), 3 deletions(-)

After hitting the mismatch again while working on the count API, I
decided to try to fix it.

diff --git a/Makefile.local b/Makefile.local
index 81ee347..6d54742 100644
--- a/Makefile.local
+++ b/Makefile.local
@@ -107,7 +107,9 @@ dist: $(TAR_FILE)
 .PHONY: 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
 # targets in the case of parallel invocation of make (-j).
diff --git a/bindings/python/notmuch/globals.py b/bindings/python/notmuch/globals.py
index 24b25d3..4c49d51 100644
--- a/bindings/python/notmuch/globals.py
+++ b/bindings/python/notmuch/globals.py
@@ -18,15 +18,16 @@ Copyright 2010 Sebastian Spaeth <Sebastian@SSpaeth.de>
 """
 
 from ctypes import CDLL, Structure, POINTER
+from version import SOVERSION
 
 #-----------------------------------------------------------------------------
 #package-global instance of the notmuch library
 try:
     from os import uname
     if uname()[0] == 'Darwin':
-        nmlib = CDLL("libnotmuch.4.dylib")
+        nmlib = CDLL("libnotmuch.{0:s}.dylib".format(SOVERSION))
     else:
-        nmlib = CDLL("libnotmuch.so.4")
+        nmlib = CDLL("libnotmuch.so.{0:s}".format(SOVERSION))
 except:
     raise ImportError("Could not find shared 'notmuch' library.")
 
diff --git a/bindings/python/notmuch/version.py b/bindings/python/notmuch/version.py
index f719fdf..35744d3 100644
--- a/bindings/python/notmuch/version.py
+++ b/bindings/python/notmuch/version.py
@@ -1,2 +1,3 @@
 # this file should be kept in sync with ../../../version
 __VERSION__ = '0.19'
+SOVERSION = '4'
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] python: replace hardcoding of SONAME version
  2015-03-07  7:31 [PATCH] python: replace hardcoding of SONAME version David Bremner
@ 2015-03-07 10:42 ` Tomi Ollila
  2015-03-08  7:35 ` David Bremner
  1 sibling, 0 replies; 3+ messages in thread
From: Tomi Ollila @ 2015-03-07 10:42 UTC (permalink / raw)
  To: David Bremner, notmuch

On Sat, Mar 07 2015, David Bremner <david@tethera.net> wrote:

> 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.

Looks sensible me -- anyone knowing more how 'pythonic' the variable
convention used is (i.e. is plain SOVERSION -- or any other issues) good?

Tomi


> ---
>  Makefile.local                     | 4 +++-
>  bindings/python/notmuch/globals.py | 5 +++--
>  bindings/python/notmuch/version.py | 1 +
>  3 files changed, 7 insertions(+), 3 deletions(-)
>
> After hitting the mismatch again while working on the count API, I
> decided to try to fix it.
>
> diff --git a/Makefile.local b/Makefile.local
> index 81ee347..6d54742 100644
> --- a/Makefile.local
> +++ b/Makefile.local
> @@ -107,7 +107,9 @@ dist: $(TAR_FILE)
>  .PHONY: 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
>  # targets in the case of parallel invocation of make (-j).
> diff --git a/bindings/python/notmuch/globals.py b/bindings/python/notmuch/globals.py
> index 24b25d3..4c49d51 100644
> --- a/bindings/python/notmuch/globals.py
> +++ b/bindings/python/notmuch/globals.py
> @@ -18,15 +18,16 @@ Copyright 2010 Sebastian Spaeth <Sebastian@SSpaeth.de>
>  """
>  
>  from ctypes import CDLL, Structure, POINTER
> +from version import SOVERSION
>  
>  #-----------------------------------------------------------------------------
>  #package-global instance of the notmuch library
>  try:
>      from os import uname
>      if uname()[0] == 'Darwin':
> -        nmlib = CDLL("libnotmuch.4.dylib")
> +        nmlib = CDLL("libnotmuch.{0:s}.dylib".format(SOVERSION))
>      else:
> -        nmlib = CDLL("libnotmuch.so.4")
> +        nmlib = CDLL("libnotmuch.so.{0:s}".format(SOVERSION))
>  except:
>      raise ImportError("Could not find shared 'notmuch' library.")
>  
> diff --git a/bindings/python/notmuch/version.py b/bindings/python/notmuch/version.py
> index f719fdf..35744d3 100644
> --- a/bindings/python/notmuch/version.py
> +++ b/bindings/python/notmuch/version.py
> @@ -1,2 +1,3 @@
>  # this file should be kept in sync with ../../../version
>  __VERSION__ = '0.19'
> +SOVERSION = '4'
> -- 
> 2.1.4
>
> _______________________________________________
> notmuch mailing list
> notmuch@notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] python: replace hardcoding of SONAME version
  2015-03-07  7:31 [PATCH] python: replace hardcoding of SONAME version David Bremner
  2015-03-07 10:42 ` Tomi Ollila
@ 2015-03-08  7:35 ` David Bremner
  1 sibling, 0 replies; 3+ messages in thread
From: David Bremner @ 2015-03-08  7:35 UTC (permalink / raw)
  To: notmuch

David Bremner <david@tethera.net> writes:

> 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.

pushed.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-03-08  7:36 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-07  7:31 [PATCH] python: replace hardcoding of SONAME version David Bremner
2015-03-07 10:42 ` Tomi Ollila
2015-03-08  7:35 ` David Bremner

Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).