[python-xrayutilities] 01/03: create the build_doc taget and use it

Frédéric-Emmanuel Picca picca at alioth.debian.org
Sun Oct 20 16:03:54 UTC 2013


This is an automated email from the git hooks/post-receive script.

picca pushed a commit to branch master
in repository python-xrayutilities.

commit 25008d5d4ce78c78f16d1dcf2b7738fe09af6ca7
Author: Picca Frédéric-Emmanuel <picca at debian.org>
Date:   Sun Oct 20 16:42:13 2013 +0200

    create the build_doc taget and use it
---
 debian/control                                     |   23 ++++---
 ...eature-forwarded-add-the-build_doc-target.patch |   64 ++++++++++++++++++++
 debian/patches/series                              |    1 +
 debian/python-xrayutilities-doc.docs               |    4 +-
 debian/python-xrayutilities.dirs                   |    1 -
 debian/rules                                       |   38 +++---------
 6 files changed, 90 insertions(+), 41 deletions(-)

diff --git a/debian/control b/debian/control
index 893604d..c763235 100644
--- a/debian/control
+++ b/debian/control
@@ -2,11 +2,15 @@ Source: python-xrayutilities
 Maintainer: Eugen Wintersberger <eugen.wintersberger at gmail.com>
 Section: python
 Priority: extra
-Build-Depends: debhelper (>= 9.0.0),
+Build-Depends: debhelper (>= 9),
                python-all-dev,
-               python-setuptools,
                python-numpy,
-               python-sphinx (>= 1.0.7+dfsg)
+               python-setuptools
+Build-Depends-Indep: python-matplotlib,
+                     python-scipy,
+                     python-sphinx (>= 1.0.7+dfsg),
+                     python-tables,
+                     python-tk
 Standards-Version: 3.9.4
 Homepage: http://sourceforge.net/projects/xrayutilities
 X-Python-Version: >=2.6
@@ -14,12 +18,12 @@ X-Python-Version: >=2.6
 Package: python-xrayutilities
 Architecture: any
 Section: python
-Depends: ${python:Depends},
+Depends: ${misc:Depends},
+         ${python:Depends},
          ${shlibs:Depends},
-         ${misc:Depends},
-         python-tables,
-         python-scipy (>=0.10)
-Recommends: python-matplotlib (>=1.0)
+         python-scipy (>= 0.10),
+         python-tables
+Recommends: python-matplotlib (>= 1.0)
 Description: Package for xray data reduction and analysis
  xrayutilities is a collection of scripts used to analyze x-ray diffraction
  data. It consists of a python package and several routines coded in C. It
@@ -29,7 +33,8 @@ Description: Package for xray data reduction and analysis
 Package: python-xrayutilities-doc
 Architecture: all
 Section: doc
-Depends: ${misc:Depends}
+Depends: ${misc:Depends},
+         ${sphinxdoc:Depends}
 Description: Package for xray data reduction and analysis - documentation
  xrayutilities is a collection of scripts used to analyze x-ray diffraction
  data. It consists of a python package and several routines coded in C. It
diff --git a/debian/patches/0001-feature-forwarded-add-the-build_doc-target.patch b/debian/patches/0001-feature-forwarded-add-the-build_doc-target.patch
new file mode 100644
index 0000000..a6221eb
--- /dev/null
+++ b/debian/patches/0001-feature-forwarded-add-the-build_doc-target.patch
@@ -0,0 +1,64 @@
+From: =?UTF-8?q?Picca=20Fr=C3=A9d=C3=A9ric-Emmanuel?= <picca at debian.org>
+Date: Sun, 20 Oct 2013 08:48:49 +0200
+Subject: feature forwarded add the build_doc target
+
+---
+ setup.py | 31 ++++++++++++++++++++++++++++++-
+ 1 file changed, 30 insertions(+), 1 deletion(-)
+
+diff --git a/setup.py b/setup.py
+index 556ac85..7376d5f 100644
+--- a/setup.py
++++ b/setup.py
+@@ -64,6 +64,8 @@ class build_ext_subclass( build_ext ):
+                 e.extra_link_args = lopt[ c ]
+         build_ext.build_extensions(self)
+ 
++cmdclass = {'build_ext': build_ext_subclass}
++
+ with open('README.txt') as f:
+     long_description = f.read()
+ 
+@@ -76,6 +78,33 @@ extmodul = Extension('xrayutilities.cxrayutilities',
+                                 os.path.join('xrayutilities','src','gridder3d.c')],
+                      define_macros = user_macros)
+ 
++try:
++    import sphinx
++    import sys
++
++    from sphinx.setup_command import BuildDoc
++
++    class build_doc(BuildDoc):
++        def run(self):
++            # make sure the python path is pointing to the newly built
++            # code so that the documentation is built on this and not a
++            # previously installed version
++            build = self.get_finalized_command('build')
++            sys.path.insert(0, os.path.abspath(build.build_lib))
++            try:
++                sphinx.setup_command.BuildDoc.run(self)
++            except UnicodeDecodeError:
++                print("ERROR: unable to build documentation"
++                      " because Sphinx do not handle"
++                      " source path with non-ASCII characters. Please"
++                      " try to move the source package to another"
++                      " location (path with *only* ASCII characters)")
++            sys.path.pop(0)
++
++    cmdclass['build_doc'] = build_doc
++except ImportError:
++    pass
++
+ setup(name="xrayutilities",
+       version="1.0.2",
+       author="Eugen Wintersberger, Dominik Kriegner",
+@@ -96,7 +125,7 @@ setup(name="xrayutilities",
+       requires=['numpy','scipy','matplotlib','tables'],
+       include_dirs = [numpy.get_include()],
+       ext_modules = [extmodul],
+-      cmdclass = {'build_ext': build_ext_subclass },
++      cmdclass = cmdclass,
+       url="http://xrayutilities.sourceforge.net",
+       license="GPLv2",
+       script_args = args
diff --git a/debian/patches/series b/debian/patches/series
new file mode 100644
index 0000000..73f56d4
--- /dev/null
+++ b/debian/patches/series
@@ -0,0 +1 @@
+0001-feature-forwarded-add-the-build_doc-target.patch
diff --git a/debian/python-xrayutilities-doc.docs b/debian/python-xrayutilities-doc.docs
index f03a86c..8ed30c1 100644
--- a/debian/python-xrayutilities-doc.docs
+++ b/debian/python-xrayutilities-doc.docs
@@ -1,3 +1 @@
-doc/latex/*.pdf
-doc/texinfo/*.info
-doc/html
+build/sphinx/html
\ No newline at end of file
diff --git a/debian/python-xrayutilities.dirs b/debian/python-xrayutilities.dirs
deleted file mode 100644
index 6845771..0000000
--- a/debian/python-xrayutilities.dirs
+++ /dev/null
@@ -1 +0,0 @@
-usr/lib
diff --git a/debian/rules b/debian/rules
index 2ab91f3..dde0087 100755
--- a/debian/rules
+++ b/debian/rules
@@ -1,40 +1,22 @@
 #!/usr/bin/make -f
 # -*- makefile -*-
-# Sample debian/rules that uses debhelper.
-# This file was originally written by Joey Hess and Craig Small.
-# As a special exception, when this file is copied by dh-make into a
-# dh-make output file, you may use that output file without restriction.
-# This special exception was added by Craig Small in version 0.37 of dh-make.
 
 # Uncomment this to turn on verbose mode.
 #export DH_VERBOSE=1
 
-PYTHON2=$(shell pyversions -vr)
+# to allow build arch only
+WITH_SPHINXDOC = $(shell if [ -x /usr/bin/dh_sphinxdoc ]; then echo "--with sphinxdoc"; fi)
 
 %:
-	dh $@ --with python2
+	dh $@ --with python2 $(WITH_SPHINXDOC)
 
-override_auto_install:
+override_dh_auto_clean:
+	dh_auto_clean
+	rm -rf build
 
-build-python%:
-	python$* setup.py build
-	BUILDPATH="$$PWD/`ls -d build/lib*`"; \
-	echo $$BUILDPATH
-	echo $$PWD
-	cd doc && export PYTHONPATH="$$PWD/`ls -d ../build/lib*`" &&  sphinx-build -b latex source latex
-	cd doc/latex &&  make
-	cd doc && export PYTHONPATH="$$PWD/`ls -d ../build/lib*`" && sphinx-build -b texinfo source texinfo
-	cd doc/texinfo && make
-	cd doc && export PYTHONPATH="$$PWD/`ls -d ../build/lib*`" && sphinx-build -b html source html
+override_dh_auto_build-indep:
+	python setup.py build_doc
 
-override_dh_auto_build:$(PYTHON2:%=build-python%)
-
-install-python%:
-	python$* setup.py install --install-layout=deb --root=$(CURDIR)/debian/tmp
-
-override_dh_auto_install:$(PYTHON2:%=install-python%)
+override_dh_auto_install:
+	dh_auto_install
 	dh_numpy
-
-override_installdocs:
-	dh_sphinxdoc doc/html
-	dh_installdocs

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/python-xrayutilities.git



More information about the debian-science-commits mailing list