0 | |
From: =?UTF-8?q?Picca=20Fr=C3=A9d=C3=A9ric-Emmanuel?= <picca@debian.org>
|
1 | |
Date: Sun, 20 Oct 2013 08:48:49 +0200
|
2 | |
Subject: feature forwarded add the build_doc target
|
3 | |
|
4 | |
---
|
5 | |
setup.py | 31 ++++++++++++++++++++++++++++++-
|
6 | |
1 file changed, 30 insertions(+), 1 deletion(-)
|
7 | |
|
8 | |
diff --git a/setup.py b/setup.py
|
9 | |
index 556ac85..7376d5f 100644
|
10 | |
--- a/setup.py
|
11 | |
+++ b/setup.py
|
12 | |
@@ -64,6 +64,8 @@ class build_ext_subclass( build_ext ):
|
13 | |
e.extra_link_args = lopt[ c ]
|
14 | |
build_ext.build_extensions(self)
|
15 | |
|
16 | |
+cmdclass = {'build_ext': build_ext_subclass}
|
17 | |
+
|
18 | |
with open('README.txt') as f:
|
19 | |
long_description = f.read()
|
20 | |
|
21 | |
@@ -76,6 +78,33 @@ extmodul = Extension('xrayutilities.cxrayutilities',
|
22 | |
os.path.join('xrayutilities','src','gridder3d.c')],
|
23 | |
define_macros = user_macros)
|
24 | |
|
25 | |
+try:
|
26 | |
+ import sphinx
|
27 | |
+ import sys
|
28 | |
+
|
29 | |
+ from sphinx.setup_command import BuildDoc
|
30 | |
+
|
31 | |
+ class build_doc(BuildDoc):
|
32 | |
+ def run(self):
|
33 | |
+ # make sure the python path is pointing to the newly built
|
34 | |
+ # code so that the documentation is built on this and not a
|
35 | |
+ # previously installed version
|
36 | |
+ build = self.get_finalized_command('build')
|
37 | |
+ sys.path.insert(0, os.path.abspath(build.build_lib))
|
38 | |
+ try:
|
39 | |
+ sphinx.setup_command.BuildDoc.run(self)
|
40 | |
+ except UnicodeDecodeError:
|
41 | |
+ print("ERROR: unable to build documentation"
|
42 | |
+ " because Sphinx do not handle"
|
43 | |
+ " source path with non-ASCII characters. Please"
|
44 | |
+ " try to move the source package to another"
|
45 | |
+ " location (path with *only* ASCII characters)")
|
46 | |
+ sys.path.pop(0)
|
47 | |
+
|
48 | |
+ cmdclass['build_doc'] = build_doc
|
49 | |
+except ImportError:
|
50 | |
+ pass
|
51 | |
+
|
52 | |
setup(name="xrayutilities",
|
53 | |
version="1.0.2",
|
54 | |
author="Eugen Wintersberger, Dominik Kriegner",
|
55 | |
@@ -96,7 +125,7 @@ setup(name="xrayutilities",
|
56 | |
requires=['numpy','scipy','matplotlib','tables'],
|
57 | |
include_dirs = [numpy.get_include()],
|
58 | |
ext_modules = [extmodul],
|
59 | |
- cmdclass = {'build_ext': build_ext_subclass },
|
60 | |
+ cmdclass = cmdclass,
|
61 | |
url="http://xrayutilities.sourceforge.net",
|
62 | |
license="GPLv2",
|
63 | |
script_args = args
|