Skip to content
Snippets Groups Projects
Commit 94843c96 authored by Piotr Ożarowski's avatar Piotr Ożarowski
Browse files

* dh_python2: fix a crash in packages with private extension (closes: 607555)

  - test3 added (to test architecture dependent packages)
parent e6432fe5
No related branches found
Tags debian/2.6.6-9
No related merge requests found
python-defaults (2.6.6-9) experimental; urgency=low
* dh_python2: fix a crash in packages with private extension (closes: 607555)
- test3 added (to test architecture dependent packages)
-- Piotr Ożarowski <piotr@debian.org> Sun, 19 Dec 2010 20:27:23 +0100
python-defaults (2.6.6-8) experimental; urgency=low python-defaults (2.6.6-8) experimental; urgency=low
* Fix typo in minimum required python version for packages generated with * Fix typo in minimum required python version for packages generated with
......
...@@ -252,6 +252,9 @@ def share_2x(dir1, dir2, dc=None): ...@@ -252,6 +252,9 @@ def share_2x(dir1, dir2, dc=None):
common_files = cmpfiles(dir1, dir2, common_files, shallow=False)[0] common_files = cmpfiles(dir1, dir2, common_files, shallow=False)[0]
for fn in common_files: for fn in common_files:
if fn.endswith('.so'):
# in unlikely case where extensions are exactly the same
continue
fpath1 = join(dir1, fn) fpath1 = join(dir1, fn)
fpath2 = join(dir2, fn) fpath2 = join(dir2, fn)
fpath3 = join(dstdir, fn) fpath3 = join(dstdir, fn)
...@@ -323,6 +326,8 @@ def scan(package, dname=None): ...@@ -323,6 +326,8 @@ def scan(package, dname=None):
if root.endswith('-packages'): if root.endswith('-packages'):
r['public_vers'].add(version) r['public_vers'].add(version)
else: else:
# TODO: find a way to specify Python version private
# extension was build for
version = False version = False
for i in private_to_check: for i in private_to_check:
if root.startswith(join('debian', package, i)): if root.startswith(join('debian', package, i)):
...@@ -373,7 +378,7 @@ def scan(package, dname=None): ...@@ -373,7 +378,7 @@ def scan(package, dname=None):
if fext == 'so': if fext == 'so':
(r if public_dir else (r if public_dir else
r['private_dirs'].setdefault(private_dir, {}))\ r['private_dirs'].setdefault(private_dir, {}))\
['public_ext'].add(version) .setdefault('public_ext', set()).add(version)
continue continue
elif fext == 'py': elif fext == 'py':
(r if public_dir else (r if public_dir else
...@@ -553,7 +558,8 @@ def main(): ...@@ -553,7 +558,8 @@ def main():
if ext_for is None: # no extension if ext_for is None: # no extension
if options.vrange and options.vrange != (None, None): if options.vrange and options.vrange != (None, None):
args += " -V %s" % vrange_str(options.vrange) args += " -V %s" % vrange_str(options.vrange)
elif ext_for is False: # extension's version not detected elif False in ext_for:
# at least one extension's version not detected
if options.vrange and '-' not in vrange_str(options.vrange): if options.vrange and '-' not in vrange_str(options.vrange):
ver = vrange_str(options.vrange) ver = vrange_str(options.vrange)
else: # try shebang or default Python version else: # try shebang or default Python version
......
#!/usr/bin/make -f #!/usr/bin/make -f
# enable or disable tests here: # enable or disable tests here:
TESTS := test1 test2 TESTS := test1 test2 test3
all: $(TESTS) all: $(TESTS)
......
#!/usr/bin/make -f
all: run check
DPY=$(shell pyversions -d)
run: clean
dpkg-buildpackage -b -us -uc
check:
grep -q "pycompile -p python-foo /usr/lib/python-foo -V $(shell pyversions -vd)"\
debian/python-foo/DEBIAN/postinst
test -f debian/python-foo/usr/lib/${DPY}/dist-packages/foo/bar.so
test ! -f debian/python-foo/usr/share/pyshared/foo/bar.so
clean:
./debian/rules clean
rm -rf lib/Foo.egg-info build
foo (0.1.1) unstable; urgency=low
* Initial release
-- Piotr Ożarowski <piotr@debian.org> Sun, 19 Dec 2010 19:40:33 +0100
7
Source: foo
Section: python
Priority: optional
Maintainer: Piotr Ożarowski <piotr@debian.org>
Build-Depends: debhelper (>= 7.0.50~), python-all-dev
Standards-Version: 3.9.1
X-Python-Version: >= 2.6
Package: python-foo
Architecture: any
Depends: ${python:Depends}, ${shlibs:Depends}, ${misc:Depends}
Recommends: ${python:Recommends}
Suggests: ${python:Suggests}
Enhances: ${python:Enhances}
Breaks: ${python:Breaks}
Provides: ${python:Provides}
XB-Python-Version: ${python:Versions}
Description: foo to rule them all
exemple package #3 - Python extension
The Debian packaging is © 2010, Piotr Ożarowski <piotr@debian.org> and
is licensed under the MIT License.
# private module in architecture dependent dir
lib/foo.py /usr/lib/python-foo/
#!/usr/bin/make -f
%:
dh $@ --buildsystem=python_distutils
override_dh_pysupport:
# install also as private extension
dh_install debian/python-foo/usr/lib/`pyversions -d`/dist-packages/foo/bar.so \
/usr/lib/python-foo/
DH_VERBOSE=1 ../../dh_python2
3.0 (native)
import foo.bar
class Foo(object):
def __init__(self):
pass
#!/usr/bin/env python
from distutils.core import setup, Extension
setup(name="distutils-test",
version = "0.1",
author="jbailey",
author_email="jbailey@debian.org",
url="http://www.python.org/sigs/distutils-sig/",
ext_modules=[Extension('foo/bar', ['lib/bar.c'])],
#py_modules=['package'],
packages = ["foo"],
package_dir = {'foo': 'lib'}
)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment