[med-svn] [python-biotools] 01/01: Add missing script grepseq as quilt patch

Andreas Tille tille at debian.org
Thu Mar 2 18:46:42 UTC 2017


This is an automated email from the git hooks/post-receive script.

tille pushed a commit to branch master
in repository python-biotools.

commit 0847cc5893e80d1e98512a85eff14726724b5b16
Author: Andreas Tille <tille at debian.org>
Date:   Thu Mar 2 16:51:38 2017 +0100

    Add missing script grepseq as quilt patch
---
 debian/patches/2to3_grepseq.patch        |  35 +++++++++++
 debian/patches/add_missing_grepseq.patch | 101 +++++++++++++++++++++++++++++++
 debian/patches/series                    |   2 +
 debian/python3-biotools.install          |   1 +
 4 files changed, 139 insertions(+)

diff --git a/debian/patches/2to3_grepseq.patch b/debian/patches/2to3_grepseq.patch
new file mode 100644
index 0000000..22d5f2b
--- /dev/null
+++ b/debian/patches/2to3_grepseq.patch
@@ -0,0 +1,35 @@
+Author: Andreas Tille <tille at debian.org>
+Last-Update: Thu, 02 Mar 2017 11:51:33 +0100
+Description: Fix Python3 errors by using 2to3
+
+--- a/grepseq
++++ b/grepseq
+@@ -14,7 +14,7 @@ def search(regex, filename, options):
+     cmx = options.max_count
+ 
+     if pfn and not cnt:
+-        print '\n=======>', filename, '<=======\n'
++        print('\n=======>', filename, '<=======\n')
+ 
+     for seq in io.open(filename, 'r'):
+         in_name = snm and regex.search(seq.name + ' ' + seq.defline)
+@@ -22,16 +22,16 @@ def search(regex, filename, options):
+         if not inv and (in_name or in_seq):
+             options.curr_count += 1
+             if not cnt:
+-                print seq
++                print(seq)
+         elif inv and not (in_name or in_seq):
+             options.curr_count += 1
+             if not cnt:
+-                print seq
++                print(seq)
+         if cmx and options.curr_count > cmx:
+             break
+ 
+     if cnt:
+-        print options.curr_count
++        print(options.curr_count)
+ 
+ if __name__ == '__main__':
+     optp = OptionParser(usage="%prog [options] <pattern> <files ...>")
diff --git a/debian/patches/add_missing_grepseq.patch b/debian/patches/add_missing_grepseq.patch
new file mode 100644
index 0000000..b834277
--- /dev/null
+++ b/debian/patches/add_missing_grepseq.patch
@@ -0,0 +1,101 @@
+Author: Andreas Tille <tille at debian.org>
+Last-Update: Thu, 02 Mar 2017 11:51:33 +0100
+Description: Upstream tarball is lacking documented script.  This was
+ fetched from Git and injected via quilt patch
+
+--- /dev/null
++++ b/grepseq
+@@ -0,0 +1,93 @@
++#!/usr/bin/env python
++
++from optparse import OptionParser
++import biotools.IO as io
++import re
++
++
++def search(regex, filename, options):
++    pfn = options.print_filename
++    snm = options.search_name
++    ssq = options.search_seq
++    inv = options.invert_results
++    cnt = options.count
++    cmx = options.max_count
++
++    if pfn and not cnt:
++        print '\n=======>', filename, '<=======\n'
++
++    for seq in io.open(filename, 'r'):
++        in_name = snm and regex.search(seq.name + ' ' + seq.defline)
++        in_seq = ssq and regex.search(seq.seq)
++        if not inv and (in_name or in_seq):
++            options.curr_count += 1
++            if not cnt:
++                print seq
++        elif inv and not (in_name or in_seq):
++            options.curr_count += 1
++            if not cnt:
++                print seq
++        if cmx and options.curr_count > cmx:
++            break
++
++    if cnt:
++        print options.curr_count
++
++if __name__ == '__main__':
++    optp = OptionParser(usage="%prog [options] <pattern> <files ...>")
++    optp.add_option('-c', '--count',
++                    action='store_true', dest='count', default=False,
++                    help='''Suppress normal output; instead print a count of
++                         matching lines for each input file. With the -v,
++                         --invert-match option (see below), count non-matching
++                         lines.''')
++    optp.add_option('-H', '--with-filename',
++                    action='store_true', dest='print_filename', default=False,
++                    help='Print the filename for each match.')
++    optp.add_option('-i', '--ignore-case',
++                    action='store_true', dest='ignore_case', default=False,
++                    help='''Ignore case distinctions in both the pattern and
++                         input files.''')
++    optp.add_option('-m', '--max-count', metavar='NUM',
++                    action='store', dest='max_count', default=None, type='int',
++                    help='''Stop reading a file after NUM matching lines. When
++                         the -c or --count option is also used, grepseq does
++                         not output a count greater than NUM. When the -v or
++                         --invert-match option is also used, grep stops after
++                         outputting NUM non-matching lines.''')
++    optp.add_option('-N', '--names-only',
++                    action='store_false', dest='search_seq', default=True,
++                    help='Search only sequence names. Cannot be used with -S.')
++    optp.add_option('-S', '--sequences-only',
++                    action='store_false', dest='search_name', default=True,
++                    help='Search only sequences. Cannot be used with -N.')
++    optp.add_option('-v', '--invert-match',
++                    action='store_true', dest='invert_results', default=False,
++                    help='''Invert the sense of matching, to select non-matching
++                         lines.''')
++
++    opts, args = optp.parse_args()
++    if len(args) < 2:
++        optp.print_help()
++        exit(1)
++
++    if opts.max_count is not None and opts.max_count < 1:
++        exit(0)
++
++    flags = 0
++    if opts.ignore_case:
++        flags |= re.I
++
++    try:
++        pattern = re.compile(args[0], flags)
++    except:
++        exit(1)
++    files = args[1:]
++
++    opts.curr_count = 0
++
++    if len(files) > 1 or opts.print_filename:
++        opts.print_filename = True
++
++    for f in files:
++        search(pattern, f, opts)
diff --git a/debian/patches/series b/debian/patches/series
index 998d10f..43ec752 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1 +1,3 @@
 2to3.patch
+add_missing_grepseq.patch
+2to3_grepseq.patch
diff --git a/debian/python3-biotools.install b/debian/python3-biotools.install
new file mode 100644
index 0000000..158d51d
--- /dev/null
+++ b/debian/python3-biotools.install
@@ -0,0 +1 @@
+grepseq	usr/bin

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-med/python-biotools.git



More information about the debian-med-commit mailing list