[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: how to exclude python (test-)modules from byte-compilation with dh_pycentral



[Jonas Meurer, 2009-07-02]
> At preparing zope2.11.3 packages, I found several python (test-)modules
> that do have python2.5/python2.6 code. This code is mostly for checking
> python2.5/python2.6 support, and thus isn't relevant for the
> functionality of zope itself.
> 
> Zope2.11.3 still requires python2.4, so when the package is installed,
> python-central exits with a byte-compiling error, see below.
> 
> Is there any possiblity to exclude/ignore the modules in question at
> byte-compilation time? I found -X for dh_pycentral, but that one doesn't
> seem to do what I expected it to do.

if these tests are the only parts that require newer Python version (if
not, simply bump XS-Python-Version or debian/pyversions) - while
building the package you can loop over all requested Python versions and
remove files that you don't want to be used with specific Python version
- see python-beaker[1] package for an example. Your helper tool will
detect this and do the right thing at install time.

[1] http://svn.debian.org/viewsvn/python-modules/packages/beaker/trunk/debian/rules
 
> Another solution would be to completely remove the test modules in
> question, but that would require a lot of work, as at least the
> mechanize module (last error) is used in several other test modules of
> zope2.11.3, and I don't want to remove all/most test modules after all.

add near the top of debian/rules these lines:

| -include /usr/share/python/python.mk
| ifeq (,$(py_libdir))
|     py_libdir = /usr/lib/python$(subst python,,$(1))/site-packages
| endif

and later (after setup.py install but *before* dh_pysupport/dh_pycentral):

|	rm -rf $(CURDIR)/debian/python-foo/$(call py_libdir,$*)/bar/tests

where "$*" is current Python version (you can replace it with
`pyversions -vd` if you do not loop over all requested Python versions)


PS consider switching to python-support or we'll force you to do this in
few months ;-)
-- 
http://people.debian.org/~piotr/sponsor

Attachment: signature.asc
Description: Digital signature


Reply to: