From f96f6711d11ffc904b85d05d71a34b12c3de5409 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Piotr=20O=C5=BCarowski?= <piotr@debian.org>
Date: Thu, 22 Sep 2011 22:42:12 +0200
Subject: [PATCH] do not try to remove .so.foo symlinks twice (if files were
 listed in an unfortunate order)

---
 debian/changelog | 2 ++
 dh_python2       | 1 +
 2 files changed, 3 insertions(+)

diff --git a/debian/changelog b/debian/changelog
index 7b412a7..7806875 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -10,6 +10,8 @@ python-defaults (2.7.2-6) UNRELEASED; urgency=low
       private directory
     - dist_fallback: add /usr/share/python-support/package/ to paths searched
       for Egg metadata; add "wsgiref" and "python" fallbacks
+    - do not try to remove .so.foo symlinks twice (if files were listed in an
+      unfortunate order)
 
  -- Scott Kitterman <scott@kitterman.com>  Sat, 03 Sep 2011 11:21:35 -0400
 
diff --git a/dh_python2 b/dh_python2
index f215087..623fc29 100755
--- a/dh_python2
+++ b/dh_python2
@@ -393,6 +393,7 @@ def scan(package, dname=None, clean_dbg_pkg=True):
                         for lpath in links:
                             log.info('removing symlink: %s', lpath)
                             os.remove(lpath)
+                            file_names.remove(split(lpath)[-1])
                         log.info('renaming %s to %s', dstfpath, fn)
                         os.rename(dstfpath, fpath)
                 if dbg_package and clean_dbg_pkg and fext not in ('so', 'h'):
-- 
GitLab