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

dh_python2:

* no longer moves .so.foo files to pyshared dir (closes: 635316)
* replaces .so symlinks with .so.foo files in dist-packages
parent bde06c3a
No related branches found
No related tags found
No related merge requests found
python-defaults (2.7.2-3) UNRELEASED; urgency=low
[ Piotr Ożarowski ]
* dh_python2:
- no longer moves .so.foo files to pyshared dir (closes: 635316)
- replaces .so symlinks with .so.foo files in dist-packages
-- Piotr Ożarowski <piotr@debian.org> Tue, 26 Jul 2011 19:58:48 +0200
python-defaults (2.7.2-2) experimental; urgency=low
[ Piotr Ożarowski ]
......
......@@ -28,7 +28,8 @@ import re
import sys
from filecmp import dircmp, cmpfiles, cmp as fcmp
from optparse import OptionParser, SUPPRESS_HELP
from os.path import isabs, isdir, islink, exists, join, normpath, realpath
from os.path import isabs, isdir, islink, exists, join, normpath, realpath,\
split
from shutil import rmtree, copy as fcopy
from stat import ST_MODE, S_IXUSR, S_IXGRP, S_IXOTH
sys.path.insert(1, '/usr/share/python/')
......@@ -53,14 +54,6 @@ log = logging.getLogger(__name__)
os.umask(022)
EGGnPTH_RE = re.compile(r'(.*?)(-py\d\.\d+)?(.*?)(\.egg-info|\.pth)$')
"""TODO: move it to manpage
Examples:
dh_python2
dh_python2 -V 2.4- # public files only, Python >= 2.4
dh_python2 -p python-foo -X 'bar.*' /usr/lib/baz/ # private files in
python-foo package
"""
# naming conventions used in the file:
# * version - tuple of integers
# * ver - string representation of version
......@@ -269,7 +262,7 @@ def share_2x(dir1, dir2, dc=None):
common_files = cmpfiles(dir1, dir2, common_files, shallow=False)[0]
for fn in common_files:
if fn.endswith('.so'):
if 'so' in fn.split('.'): # foo.so, bar.so.0.1.2, etc.
# in unlikely case where extensions are exactly the same
continue
fpath1 = join(dir1, fn)
......@@ -368,7 +361,7 @@ def scan(package, dname=None):
if name.endswith('.egg-info'):
if dbg_package:
rmtree(join(root, name))
dirs.pop(dirs.index(name))
dirs.remove(name)
continue
clean_name = clean_egg_name(name)
if clean_name != name:
......@@ -389,6 +382,20 @@ def scan(package, dname=None):
os.remove(join(root, fn))
continue
if public_dir:
fpath = join(root, fn)
if fext == 'so' and islink(fpath):
dstfpath = fpath
links = set()
while islink(dstfpath):
links.add(dstfpath)
dstfpath = join(root, os.readlink(dstfpath))
if exists(dstfpath) and '.so.' in split(dstfpath)[-1]:
# rename .so.$FOO symlinks, remove other ones
for lpath in links:
log.info('removing symlink: %s', lpath)
os.remove(lpath)
log.info('renaming %s to %s', dstfpath, fn)
os.rename(dstfpath, fpath)
if dbg_package and fext not in ('so', 'h'):
os.remove(join(root, fn))
continue
......
......@@ -12,6 +12,11 @@ check:
debian/python-foo/DEBIAN/postinst
test -f debian/python-foo/usr/lib/python${DPY}/dist-packages/foo/bar.so
test ! -f debian/python-foo/usr/share/pyshared/foo/bar.so
test -f debian/python-foo/usr/lib/python${DPY}/dist-packages/foo/spam.so
test ! -f debian/python-foo/usr/lib/python${DPY}/dist-packages/foo/spam.so.0.1
test -f debian/python-foo/usr/lib/python${DPY}/dist-packages/foo/baz.so
test ! -f debian/python-foo/usr/lib/python${DPY}/dist-packages/foo/baz.so.0.1
test ! -f debian/python-foo/usr/lib/python${DPY}/dist-packages/foo/baz.so.0.1.2
clean:
./debian/rules clean
......
#!/usr/bin/make -f
DPY=$(shell PYTHONPATH=../../ python -c 'import debpython.version as v; print(v.vrepr(v.DEFAULT))')
%:
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 \
dh_install debian/python-foo/usr/lib/python${DPY}/dist-packages/foo/bar.so \
/usr/lib/python-foo/
# ... and under versioned name with a symlink
cp debian/python-foo/usr/lib/python${DPY}/dist-packages/foo/bar.so \
debian/python-foo/usr/lib/python${DPY}/dist-packages/foo/spam.so.0
dh_link /usr/lib/python${DPY}/dist-packages/foo/spam.so.0 \
/usr/lib/python${DPY}/dist-packages/foo/spam.so
# ... and with multiple symlinks
cp debian/python-foo/usr/lib/python${DPY}/dist-packages/foo/bar.so \
debian/python-foo/usr/lib/python${DPY}/dist-packages/foo/baz.so.0.1.2
dh_link /usr/lib/python${DPY}/dist-packages/foo/baz.so.0.1.2 \
/usr/lib/python${DPY}/dist-packages/foo/baz.so.0.1
dh_link /usr/lib/python${DPY}/dist-packages/foo/baz.so.0.1 \
/usr/lib/python${DPY}/dist-packages/foo/baz.so
DH_VERBOSE=1 ../../dh_python2
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