* Andreas Tille <andr...@an3as.eu>, 2014-05-21, 15:09:
So, is there a sane way to make pybuild run an arbitrary command with
default version of python, and with PYTHONPATH set to the build
directory?
One insane way is to abuse the --test option:
pyrun = DEB_BUILD_OPTIONS= pybuild -s custom -p $(shell pyversions -dv) --test
--test-args
[...]
$(pyrun) 'make --directory=doc singlehtml' # eww!
Well, if there is no other suggestion for a not so insane solution I
might try this.
With the attached patch I got the package almost building. Almost,
becasue the tests fail:
I: pybuild base:170: cd /home/jwilk/python-biom-format/.pybuild/pythonX.Y_2.7/build; python2.7 -m nose --with-doctest
/home/jwilk/python-biom-format/.pybuild/pythonX.Y_2.7/build/biom/util.py:27: UserWarning: h5py is not available
warn("h5py is not available")
EEE......................
======================================================================
ERROR: Failure: NameError (global name '_type_handlers' is not defined)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/nose/loader.py", line 414, in
loadTestsFromName
addr.filename, addr.module)
File "/usr/lib/python2.7/dist-packages/nose/importer.py", line 47, in
importFromPath
return self.importFromDir(dir_path, fqname)
File "/usr/lib/python2.7/dist-packages/nose/importer.py", line 94, in
importFromDir
mod = load_module(part_fqname, fh, filename, desc)
File
"/home/jwilk/python-biom-format/.pybuild/pythonX.Y_2.7/build/biom/interfaces/html/config/convert.py",
line 57, in <module>
Help='Process metadata associated with observations when '
File "/usr/lib/python2.7/dist-packages/pyqi/core/interfaces/html/__init__.py",
line 67, in __init__
super(HTMLInputOption, self).__init__(Type=Type, **kwargs)
File "/usr/lib/python2.7/dist-packages/pyqi/core/interface.py", line 239, in
__init__
self._validate_option()
File "/usr/lib/python2.7/dist-packages/pyqi/core/interfaces/html/__init__.py",
line 123, in _validate_option
elif type(self.Choices) not in (_type_handlers.TupleType, types.ListType):
NameError: global name '_type_handlers' is not defined
======================================================================
ERROR: Failure: ImportError (cannot import name html_list_of_strings)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/nose/loader.py", line 414, in
loadTestsFromName
addr.filename, addr.module)
File "/usr/lib/python2.7/dist-packages/nose/importer.py", line 47, in
importFromPath
return self.importFromDir(dir_path, fqname)
File "/usr/lib/python2.7/dist-packages/nose/importer.py", line 94, in
importFromDir
mod = load_module(part_fqname, fh, filename, desc)
File
"/home/jwilk/python-biom-format/.pybuild/pythonX.Y_2.7/build/biom/interfaces/html/config/show_install_info.py",
line 25, in <module>
from pyqi.core.interfaces.html.output_handler import html_list_of_strings
ImportError: cannot import name html_list_of_strings
======================================================================
ERROR: Failure: ImportError (cannot import name write_or_print_list_of_strings)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/nose/loader.py", line 414, in
loadTestsFromName
addr.filename, addr.module)
File "/usr/lib/python2.7/dist-packages/nose/importer.py", line 47, in
importFromPath
return self.importFromDir(dir_path, fqname)
File "/usr/lib/python2.7/dist-packages/nose/importer.py", line 94, in
importFromDir
mod = load_module(part_fqname, fh, filename, desc)
File
"/home/jwilk/python-biom-format/.pybuild/pythonX.Y_2.7/build/biom/interfaces/optparse/config/summarize_table.py",
line 23, in <module>
from pyqi.core.interfaces.optparse.output_handler import (
ImportError: cannot import name write_or_print_list_of_strings
----------------------------------------------------------------------
Ran 25 tests in 0.482s
FAILED (errors=3)
E: pybuild pybuild:256: test: plugin distutils failed with: exit code=1: cd /home/jwilk/python-biom-format/.pybuild/pythonX.Y_2.7/build; python2.7 -m nose --with-doctest
dh_auto_test: pybuild --test -i python{version} -p 2.7 --dir . returned exit code 13
debian/rules:20: recipe for target 'build' failed
make: *** [build] Error 13
dpkg-buildpackage: error: debian/rules build gave error exit status 2
--
Jakub Wilk
Index: debian/control
===================================================================
--- debian/control (revision 16978)
+++ debian/control (working copy)
@@ -8,6 +8,7 @@
dh-linktree,
python-dev,
python-numpy,
+ python-scipy,
help2man,
python-dateutil,
python-cogent,
Index: debian/rules
===================================================================
--- debian/rules (revision 16978)
+++ debian/rules (working copy)
@@ -12,21 +12,22 @@
#MIN_CYTHONVER := 0.17~beta1-2
#NO_CYTHON := $(shell if dpkg --compare-versions $(CYTHONVER) lt $(MIN_CYTHONVER) ; then echo 0 ; else echo 1 ; fi)
-# linux-x86_64
-pybuilddir := $(shell dpkg-architecture -qDEB_BUILD_ARCH_OS)-$(shell dpkg-architecture -qDEB_BUILD_GNU_CPU)
+export PYBUILD_TEST_NOSE = 1
+pyrun = DEB_BUILD_OPTIONS= pybuild -s custom -p $(shell pyversions -dv) --test --test-args
+
%:
dh $@ --with python2 --buildsystem=pybuild --with linktree
override_dh_auto_build:
dh_auto_build
- make --directory=doc singlehtml
- env PYTHONPATH=. pyqi make-bash-completion \
+ $(pyrun) 'make --directory=doc singlehtml'
+ $(pyrun) 'pyqi make-bash-completion \
--command-config-module biom.interfaces.optparse.config \
- --driver-name biom -o debian/bash-completion
+ --driver-name biom -o debian/bash-completion'
override_dh_installman:
- make --directory=doc make man
+ $(pyrun) 'make --directory=doc man'
dh_installman
override_dh_auto_clean:
@@ -44,16 +45,6 @@
# "This script no longer exists. ..."
rm -f $(bindir)/*.py
-override_dh_auto_test:
-ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
- set -e -x;\
- for pyv in `pyversions -dv` ; do \
- cd build/; \
- ln -s ../python-code/tests; \
- env PYTHONPATH=lib.$(pybuilddir)-$${pyv} nosetests ; \
- done
-endif
-
get-orig-source:
# . debian/get-orig-source
mkdir -p ../tarballs