[med-svn] r12385 - in trunk/packages/conservation-code/trunk/debian: . patches

Laszlo Kajan lkajan-guest at alioth.debian.org
Thu Oct 11 11:32:25 UTC 2012


Author: lkajan-guest
Date: 2012-10-11 11:32:24 +0000 (Thu, 11 Oct 2012)
New Revision: 12385

Added:
   trunk/packages/conservation-code/trunk/debian/patches/default_matrix_path
   trunk/packages/conservation-code/trunk/debian/patches/numpy.numarray
   trunk/packages/conservation-code/trunk/debian/patches/optimize_loop
   trunk/packages/conservation-code/trunk/debian/patches/script_name
Removed:
   trunk/packages/conservation-code/trunk/debian/patches/score_conservation
Modified:
   trunk/packages/conservation-code/trunk/debian/control
   trunk/packages/conservation-code/trunk/debian/patches/series
   trunk/packages/conservation-code/trunk/debian/rules
Log:
applied Jakub Wilks advice

Modified: trunk/packages/conservation-code/trunk/debian/control
===================================================================
--- trunk/packages/conservation-code/trunk/debian/control	2012-10-11 10:57:56 UTC (rev 12384)
+++ trunk/packages/conservation-code/trunk/debian/control	2012-10-11 11:32:24 UTC (rev 12385)
@@ -3,7 +3,7 @@
 Priority: extra
 Maintainer: Debian Med Packaging Team <debian-med-packaging at lists.alioth.debian.org>
 Uploaders: Laszlo Kajan <lkajan at rostlab.org>
-Build-Depends: debhelper (>= 8.0.0), python
+Build-Depends: debhelper (>= 8.0.0), perl, python (>= 2.6.6-3~)
 Standards-Version: 3.9.4
 Homepage: http://compbio.cs.princeton.edu/conservation/
 Vcs-Svn: svn://svn.debian.org/debian-med/trunk/packages/conservation-code/trunk/

Added: trunk/packages/conservation-code/trunk/debian/patches/default_matrix_path
===================================================================
--- trunk/packages/conservation-code/trunk/debian/patches/default_matrix_path	                        (rev 0)
+++ trunk/packages/conservation-code/trunk/debian/patches/default_matrix_path	2012-10-11 11:32:24 UTC (rev 12385)
@@ -0,0 +1,14 @@
+Author: Laszlo Kajan <lkajan at rostlab.org>
+Description: correct path to packaged default matrix file
+Forwarded: http://lists.alioth.debian.org/pipermail/debian-med-packaging/2012-October/017448.html
+--- a/score_conservation.py
++++ b/score_conservation.py
+@@ -718,7 +718,7 @@
+ window_size = 3 # 0 = no window
+ win_lam = .5 # for window method linear combination
+ outfile_name = ""
+-s_matrix_file = "matrix/blosum62.bla"
++s_matrix_file = "/usr/share/conservation-code/matrix/blosum62.bla"
+ bg_distribution = blosum_background_distr[:]
+ scoring_function = js_divergence
+ use_seq_weights = True

Added: trunk/packages/conservation-code/trunk/debian/patches/numpy.numarray
===================================================================
--- trunk/packages/conservation-code/trunk/debian/patches/numpy.numarray	                        (rev 0)
+++ trunk/packages/conservation-code/trunk/debian/patches/numpy.numarray	2012-10-11 11:32:24 UTC (rev 12385)
@@ -0,0 +1,14 @@
+Author: Laszlo Kajan <lkajan at rostlab.org>
+Description: fix import of numarray from numpy.numarray
+Forwarded: http://lists.alioth.debian.org/pipermail/debian-med-packaging/2012-October/017448.html
+--- a/score_conservation.py
++++ b/score_conservation.py
+@@ -790,7 +790,7 @@
+ 	if arg == 'shannon_entropy': scoring_function = shannon_entropy
+ 	elif arg == 'property_entropy': scoring_function = property_entropy
+ 	elif arg == 'property_relative_entropy': scoring_function = property_relative_entropy
+-	elif arg == 'vn_entropy': scoring_function = vn_entropy; from numarray import *; import numarray.linear_algebra as la
++	elif arg == 'vn_entropy': scoring_function = vn_entropy; from numpy.numarray import *; import numpy.numarray.linear_algebra as la
+ 
+ 	elif arg == 'relative_entropy': scoring_function = relative_entropy
+ 	elif arg == 'js_divergence': scoring_function = js_divergence

Added: trunk/packages/conservation-code/trunk/debian/patches/optimize_loop
===================================================================
--- trunk/packages/conservation-code/trunk/debian/patches/optimize_loop	                        (rev 0)
+++ trunk/packages/conservation-code/trunk/debian/patches/optimize_loop	2012-10-11 11:32:24 UTC (rev 12385)
@@ -0,0 +1,16 @@
+Author: Laszlo Kajan <lkajan at rostlab.org>
+Description: move code outside of loop
+Forwarded: http://lists.alioth.debian.org/pipermail/debian-med-packaging/2012-October/017448.html
+--- a/score_conservation.py
++++ b/score_conservation.py
+@@ -136,8 +136,9 @@
+ 
+ 	aa_num += 1
+ 
++    freqsum = (sum(seq_weights) + len(amino_acids) * pc_amount)
+     for j in range(len(freq_counts)):
+-	freq_counts[j] = freq_counts[j] / (sum(seq_weights) + len(amino_acids) * pc_amount)
++	freq_counts[j] = freq_counts[j] / freqsum
+ 
+     return freq_counts
+ 

Deleted: trunk/packages/conservation-code/trunk/debian/patches/score_conservation
===================================================================
--- trunk/packages/conservation-code/trunk/debian/patches/score_conservation	2012-10-11 10:57:56 UTC (rev 12384)
+++ trunk/packages/conservation-code/trunk/debian/patches/score_conservation	2012-10-11 11:32:24 UTC (rev 12385)
@@ -1,49 +0,0 @@
-Author: Laszlo Kajan <lkajan at rostlab.org>
-Description: fixes to executable
-Forwarded: no
---- a/score_conservation
-+++ b/score_conservation
-@@ -1,4 +1,4 @@
--#!/usr/bin/env python
-+#!/usr/bin/python
- 
- ################################################################################
- # score_conservation.py - Copyright Tony Capra 2007 - Last Update: 03/09/11
-@@ -98,7 +98,7 @@
- 
- 
- def usage():
--    print """\nUSAGE:\npython score_conservation.py [options] alignfile\n\t -alignfile must be in fasta or clustal format.\n\nOPTIONS:\n\t
-+    print """\nUSAGE:\nscore_conservation [options] alignfile\n\t -alignfile must be in fasta or clustal format.\n\nOPTIONS:\n\t
-     -a\treference sequence. Print scores in reference to a specific sequence (ignoring gaps). Default prints the entire column. [sequence name]\n\t
-     -b\tlambda for window heuristic linear combination. Default=.5 [real in [0,1]]\n
-     -d\tbackground distribution file, e.g., swissprot.distribution. Default=BLOSUM62 background [filename]\n\t
-@@ -136,8 +136,9 @@
- 
- 	aa_num += 1
- 
-+    freqsum = (sum(seq_weights) + len(amino_acids) * pc_amount)
-     for j in range(len(freq_counts)):
--	freq_counts[j] = freq_counts[j] / (sum(seq_weights) + len(amino_acids) * pc_amount)
-+	freq_counts[j] = freq_counts[j] / freqsum
- 
-     return freq_counts
- 
-@@ -718,7 +719,7 @@
- window_size = 3 # 0 = no window
- win_lam = .5 # for window method linear combination
- outfile_name = ""
--s_matrix_file = "matrix/blosum62.bla"
-+s_matrix_file = "/usr/share/conservation-code/matrix/blosum62.bla"
- bg_distribution = blosum_background_distr[:]
- scoring_function = js_divergence
- use_seq_weights = True
-@@ -790,7 +791,7 @@
- 	if arg == 'shannon_entropy': scoring_function = shannon_entropy
- 	elif arg == 'property_entropy': scoring_function = property_entropy
- 	elif arg == 'property_relative_entropy': scoring_function = property_relative_entropy
--	elif arg == 'vn_entropy': scoring_function = vn_entropy; from numarray import *; import numarray.linear_algebra as la
-+	elif arg == 'vn_entropy': scoring_function = vn_entropy; from numpy.numarray import *; import numpy.numarray.linear_algebra as la
- 
- 	elif arg == 'relative_entropy': scoring_function = relative_entropy
- 	elif arg == 'js_divergence': scoring_function = js_divergence

Added: trunk/packages/conservation-code/trunk/debian/patches/script_name
===================================================================
--- trunk/packages/conservation-code/trunk/debian/patches/script_name	                        (rev 0)
+++ trunk/packages/conservation-code/trunk/debian/patches/script_name	2012-10-11 11:32:24 UTC (rev 12385)
@@ -0,0 +1,22 @@
+Author: Laszlo Kajan <lkajan at rostlab.org>
+Description: change interpreter and remove extension from script
+ Policy §1.4.2 Interpreter Location: 'The preferred specification for the Python interpreter is /usr/bin/python'.
+ Policy §10.4 Scripts: 'the script name should not include an extension'.
+Forwarded: no
+--- a/score_conservation.py
++++ b/score_conservation.py
+@@ -1,4 +1,4 @@
+-#!/usr/bin/env python
++#!/usr/bin/python
+ 
+ ################################################################################
+ # score_conservation.py - Copyright Tony Capra 2007 - Last Update: 03/09/11
+@@ -98,7 +98,7 @@
+ 
+ 
+ def usage():
+-    print """\nUSAGE:\npython score_conservation.py [options] alignfile\n\t -alignfile must be in fasta or clustal format.\n\nOPTIONS:\n\t
++    print """\nUSAGE:\nscore_conservation [options] alignfile\n\t -alignfile must be in fasta or clustal format.\n\nOPTIONS:\n\t
+     -a\treference sequence. Print scores in reference to a specific sequence (ignoring gaps). Default prints the entire column. [sequence name]\n\t
+     -b\tlambda for window heuristic linear combination. Default=.5 [real in [0,1]]\n
+     -d\tbackground distribution file, e.g., swissprot.distribution. Default=BLOSUM62 background [filename]\n\t

Modified: trunk/packages/conservation-code/trunk/debian/patches/series
===================================================================
--- trunk/packages/conservation-code/trunk/debian/patches/series	2012-10-11 10:57:56 UTC (rev 12384)
+++ trunk/packages/conservation-code/trunk/debian/patches/series	2012-10-11 11:32:24 UTC (rev 12385)
@@ -1,2 +1,5 @@
 examples
-score_conservation
+script_name
+numpy.numarray
+default_matrix_path
+optimize_loop

Modified: trunk/packages/conservation-code/trunk/debian/rules
===================================================================
--- trunk/packages/conservation-code/trunk/debian/rules	2012-10-11 10:57:56 UTC (rev 12384)
+++ trunk/packages/conservation-code/trunk/debian/rules	2012-10-11 11:32:24 UTC (rev 12385)
@@ -4,6 +4,7 @@
 PACKAGE:=$(shell dpkg-parsechangelog --format rfc822|sed --posix -n -e 's/^Source: \(.*\)/\1/p;')
 VERSION:=$(shell dpkg-parsechangelog --format rfc822|sed --posix -n -e 's/^Version: \([0-9.]*\).*/\1/p;')
 
+SCRIPTS=score_conservation
 MANS=debian/score_conservation.1
 prefix?=/usr
 
@@ -11,30 +12,19 @@
 docdir:=${datarootdir}/doc/${PACKAGE}
 pkgdatadir:=${datarootdir}/${PACKAGE}
 
+# Policy §4.9 says that the get-orig-source target 'may be invoked in any directory'. So we do not use variables set from dpkg-parsechangelog.
 .PHONY: get-orig-source
 get-orig-source:
 	set -e; \
-	if ! which xz; then \
-		echo "Could not find 'xz' tool for compression. Please apt-get install xz-utils." ; \
-		exit ; \
-	fi ; \
 	t=$$(mktemp -d) || exit 1; \
 	trap "rm -rf -- '$$t'" EXIT; \
-	pwd; \
-	o=conservation-code_$(VERSION).orig.tar; \
-	wget -O $$t/$${o}.gz http://compbio.cs.princeton.edu/conservation/conservation_code.tar.gz; \
 	( cd "$$t"; \
-		gunzip *.tar.gz; \
-		tar --owner=root --group=root --mode=a+rX --delete -f *.tar --wildcards '*/.*'; \
-		tar --owner=root --group=root --mode=a+rX --extract -f *.tar; rm -f *.tar; \
-		mv conservation_code/score_conservation.py conservation_code/score_conservation; \
-		tar --owner=root --group=root --mode=a+rX --create -f $$o conservation_code; \
-		xz --best *.tar; \
+		wget -O conservation-code_20110309.0.orig.tar.gz http://compbio.cs.princeton.edu/conservation/conservation_code.tar.gz; \
 	); \
 	mv $$t/*.tar.?z ./
 
 .PHONY: override_dh_auto_build
-override_dh_auto_build: man
+override_dh_auto_build: man scripts
 
 %:
 	dh $@ --parallel --with python2
@@ -42,10 +32,28 @@
 .PHONY: man
 man: $(MANS)
 
+.PHONY: scripts
+scripts: $(SCRIPTS)
+
+$(SCRIPTS) : % : %.py
+	cp -f $< $@
+
+ChangeLog: score_conservation.py
+	# Courtesy of Jakub Wilk:
+	sed -n -e '/# [0-9/]\{8\}/ { s/# // p }' < $< > $@
+
+.PHONY: override_dh_installchangelogs
+override_dh_installchangelogs: ChangeLog
+	dh_installchangelogs
+
 %.1:	%.1.pod
 	sed -e 's|__docdir__|$(docdir)|g;s|__pkgdatadir__|$(pkgdatadir)|g;s|__VERSION__|$(VERSION)|g;' "$<" | \
 	pod2man -c 'User Commands' -r "$(VERSION)" -name $(shell echo "$(basename $@)" | tr '[:lower:]' '[:upper:]') > "$@"
 
+.PHONY: override_dh_install
+override_dh_install:
+	dh_install -X._
+
 .PHONY: override_dh_auto_clean
 override_dh_auto_clean:
-	rm -f $(MANS)
+	rm -f $(MANS) $(SCRIPTS) ChangeLog




More information about the debian-med-commit mailing list