[Python-modules-commits] r19544 - in packages/ocr4gamera/trunk/debian (3 files)
jwilk at users.alioth.debian.org
jwilk at users.alioth.debian.org
Thu Dec 8 01:31:37 UTC 2011
Date: Thursday, December 8, 2011 @ 01:31:36
Author: jwilk
Revision: 19544
Eliminate files with duplicate contents.
Added:
packages/ocr4gamera/trunk/debian/symlink-helper
(from rev 19543, packages/gamera/trunk/debian/symlink-helper)
Modified:
packages/ocr4gamera/trunk/debian/changelog
packages/ocr4gamera/trunk/debian/rules
Modified: packages/ocr4gamera/trunk/debian/changelog
===================================================================
--- packages/ocr4gamera/trunk/debian/changelog 2011-12-08 01:26:45 UTC (rev 19543)
+++ packages/ocr4gamera/trunk/debian/changelog 2011-12-08 01:31:36 UTC (rev 19544)
@@ -8,8 +8,10 @@
* Provide a simple manual page.
+ Build-depend on python-docutils, to build it from reStructuredText
format.
+ * Eliminate files with duplicate contents from the documentation using a
+ dedicated script.
- -- Jakub Wilk <jwilk at debian.org> Thu, 08 Dec 2011 02:25:36 +0100
+ -- Jakub Wilk <jwilk at debian.org> Thu, 08 Dec 2011 02:30:19 +0100
ocr4gamera (1.0.4-1) experimental; urgency=low
Modified: packages/ocr4gamera/trunk/debian/rules
===================================================================
--- packages/ocr4gamera/trunk/debian/rules 2011-12-08 01:26:45 UTC (rev 19543)
+++ packages/ocr4gamera/trunk/debian/rules 2011-12-08 01:31:36 UTC (rev 19544)
@@ -6,6 +6,12 @@
find debian/*/ -name '_bbox_*.so' -delete
find debian/*/ -path '*/bin/*.py' -exec rename.ul '.py' '' '{}' +
+.PHONY: override_dh_installdocs
+override_dh_installdocs:
+ dh_installdocs
+ cd debian/*/usr/share/doc/*/html/ && \
+ $(CURDIR)/debian/symlink-helper ../src/ .
+
.PHONY: override_dh_installman
override_dh_installman:
mkdir -p debian/tmp/
Copied: packages/ocr4gamera/trunk/debian/symlink-helper (from rev 19543, packages/gamera/trunk/debian/symlink-helper)
===================================================================
--- packages/ocr4gamera/trunk/debian/symlink-helper (rev 0)
+++ packages/ocr4gamera/trunk/debian/symlink-helper 2011-12-08 01:31:36 UTC (rev 19544)
@@ -0,0 +1,54 @@
+#!/usr/bin/python
+
+import hashlib
+import os
+import sys
+
+def file_hash(path):
+ hashsum = hashlib.sha256()
+ file = open(path, 'rb')
+ try:
+ hashsum.update(file.read())
+ finally:
+ file.close()
+ return hashsum.digest()
+
+def main():
+ data = {}
+ if len(sys.argv) != 3:
+ print >>sys.stderr, 'Usage: %s <src-dir> <dst-dir>'
+ sys.exit(1)
+ _, src_dir, dst_dir = sys.argv
+ for root, dirs, files in os.walk(src_dir):
+ for filename in files:
+ path = os.path.join(root, filename)
+ path = os.path.normpath(path)
+ data[file_hash(path)] = path
+ for root, dirs, files in os.walk(dst_dir):
+ for filename in files:
+ if not '_generic' in filename:
+ continue
+ path = os.path.join(root, filename)
+ path = os.path.normpath(path)
+ data[file_hash(path)] = path
+ for root, dirs, files in os.walk(dst_dir):
+ for filename in files:
+ if '_generic' in filename:
+ continue
+ path = os.path.join(root, filename)
+ path = os.path.normpath(path)
+ try:
+ sympath = data[file_hash(path)]
+ except LookupError:
+ pass
+ else:
+ sympath = os.path.join('../' * root.count('/'), sympath)
+ sympath = os.path.normpath(sympath)
+ print >>sys.stderr, 'symlinking %s -> %s' % (path, sympath)
+ os.unlink(path)
+ os.symlink(sympath, path)
+
+if __name__ == '__main__':
+ main()
+
+# vim:ts=4 sw=4 et
More information about the Python-modules-commits
mailing list