From 5822f996b490e2a8527ca951d52240a121491ab3 Mon Sep 17 00:00:00 2001
From: Daniele Tricoli <eriol@mornie.org>
Date: Mon, 12 Oct 2015 02:20:57 +0200
Subject: Grab version from the source code instead of importing pywt to

 build documentation at package build time.
Forwarded: not-needed
Last-Update: 2015-09-13

Patch-Name: 01-get_version_from_source.patch
---
 doc/source/conf.py | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/doc/source/conf.py b/doc/source/conf.py
index 21d21ee..9c4ae7a 100644
--- a/doc/source/conf.py
+++ b/doc/source/conf.py
@@ -48,9 +48,16 @@ copyright = jinja2.filters.do_mark_safe('2006-%s, <a href="https://groups.google
 
 # The default replacements for |version| and |release|, also used in various
 # other places throughout the built documents.
-import pywt
-version = re.sub(r'\.dev0+.*$', r'.dev', pywt.__version__)
-release = pywt.__version__
+
+# On Debian we want to build docs at package build time, when pywt is not
+# installed.
+import os
+base_path = os.path.dirname(__file__)
+fp = open(os.path.abspath(os.path.join(base_path, '..', '..', 'pywt', 'version.py')))
+VERSION = re.compile(r".*full_version = '(.*?)'",
+                     re.S).match(fp.read()).group(1)
+version = re.sub(r'\.dev0+.*$', r'.dev', VERSION)
+release = VERSION
 
 print "PyWavelets (VERSION %s)" % (version,)
 
