Control: tags 999381 + patch Dear maintainer,
I've prepared an NMU for python-pairix (versioned as 0.3.7-4.1). The diff is attached to this message. Regards. SR
diff -Nru python-pairix-0.3.7/debian/changelog python-pairix-0.3.7/debian/changelog --- python-pairix-0.3.7/debian/changelog 2021-10-01 10:07:39.000000000 -0400 +++ python-pairix-0.3.7/debian/changelog 2021-11-19 22:21:23.000000000 -0400 @@ -1,3 +1,10 @@ +python-pairix (0.3.7-4.1) UNRELEASED; urgency=medium + + * Non-maintainer upload. + * Patch: Avoid tests failing under Python 3.10. (Closes: #999381) + + -- Stefano Rivera <stefa...@debian.org> Fri, 19 Nov 2021 22:21:23 -0400 + python-pairix (0.3.7-4) unstable; urgency=medium * Fix watchfile to detect new versions on github diff -Nru python-pairix-0.3.7/debian/patches/python3.10 python-pairix-0.3.7/debian/patches/python3.10 --- python-pairix-0.3.7/debian/patches/python3.10 1969-12-31 20:00:00.000000000 -0400 +++ python-pairix-0.3.7/debian/patches/python3.10 2021-11-19 22:21:10.000000000 -0400 @@ -0,0 +1,330 @@ +Description: Avoid a Python3.10 regression in iterating GzipFiles + Open the file with a context manager, so we're holding onto a reference to it, + for the lifetime of the iteration. + This avoids hitting https://bugs.python.org/issue45475 which affects + python3.10 3.10.0-4 in Debian. + +Bug-Debian: https://bugs.debian.org/999381 +Bug-cpython: https://bugs.python.org/issue45475 +Forwarded: https://github.com/4dn-dcic/pairix/pull/71 +Author: Stefano Rivera <stefa...@debian.org> +--- a/test/test_oldindex.py ++++ b/test/test_oldindex.py +@@ -36,45 +36,48 @@ + def get_header(filename, meta_char='#'): + """Read gzipped file and retrieve lines beginning with '#'.""" + retval = [] +- for line in gzip.open(filename): +- try: +- line = line.decode('utf-8') +- except AttributeError: +- pass +- if line.startswith(meta_char): +- retval.append(line.rstrip()) ++ with gzip.open(filename) as f: ++ for line in f: ++ try: ++ line = line.decode('utf-8') ++ except AttributeError: ++ pass ++ if line.startswith(meta_char): ++ retval.append(line.rstrip()) + return retval + + + def get_chromsize(filename): + """Read gzipped file and retrieve chromsize.""" + retval = [] +- for line in gzip.open(filename): +- try: +- line = line.decode('utf-8') +- except AttributeError: +- pass +- if line.startswith('#chromsize: '): +- fields = line.rstrip().split('\s+') +- chrname = fields[1] +- chrsize = fields[2] +- retval.append([chrname, chrsize]) ++ with gzip.open(filename) as f: ++ for line in f: ++ try: ++ line = line.decode('utf-8') ++ except AttributeError: ++ pass ++ if line.startswith('#chromsize: '): ++ fields = line.rstrip().split('\s+') ++ chrname = fields[1] ++ chrsize = fields[2] ++ retval.append([chrname, chrsize]) + return retval + + + def read_vcf(filename): + """Read a VCF file and return a list of [chrom, start, end] items.""" + retval = [] +- for line in gzip.open(filename): +- try: +- line = line.decode('utf-8') +- except AttributeError: +- pass +- fields = line.rstrip().split('\t') +- chrom = fields[0] +- start = fields[1] +- end = fields[1] +- retval.append([chrom, start, end]) ++ with gzip.open(filename) as f: ++ for line in f: ++ try: ++ line = line.decode('utf-8') ++ except AttributeError: ++ pass ++ fields = line.rstrip().split('\t') ++ chrom = fields[0] ++ start = fields[1] ++ end = fields[1] ++ retval.append([chrom, start, end]) + return retval + + +@@ -83,20 +86,21 @@ + or undetermined. Do this by testing string values of """ + is_juicer = False + is_4DN = False +- for line in gzip.open(filename): +- try: +- line = line.decode('utf-8') +- except AttributeError: +- pass +- fields = line.rstrip().split(delimiter) +- if len(fields)>=6 and is_str(fields[2]) and is_str(fields[6]): +- is_juicer = True +- if is_str(fields[2]) and is_str(fields[4]): +- is_4DN = True +- if not is_juicer and is_4DN: +- return '4DN' +- elif is_juicer: +- return 'juicer' ++ with gzip.open(filename) as f: ++ for line in f: ++ try: ++ line = line.decode('utf-8') ++ except AttributeError: ++ pass ++ fields = line.rstrip().split(delimiter) ++ if len(fields)>=6 and is_str(fields[2]) and is_str(fields[6]): ++ is_juicer = True ++ if is_str(fields[2]) and is_str(fields[4]): ++ is_4DN = True ++ if not is_juicer and is_4DN: ++ return '4DN' ++ elif is_juicer: ++ return 'juicer' + return 'undetermined' + + +@@ -115,25 +119,26 @@ + if file_type == 'undetermined': + return [] + retval = [] +- for line in gzip.open(filename): +- try: +- line = line.decode('utf-8') +- except AttributeError: +- pass +- if line.startswith('#'): +- continue +- fields = line.rstrip().split(delimiter) +- if file_type == 'juicer': +- chrom1 = fields[1] +- start1 = fields[2] +- chrom2 = fields[5] +- start2 = fields[6] +- elif file_type == '4DN': +- chrom1 = fields[1] +- start1 = fields[2] +- chrom2 = fields[3] +- start2 = fields[4] +- retval.append([chrom1, start1, start1, chrom2, start2, start2]) ++ with gzip.open(filename) as f: ++ for line in f: ++ try: ++ line = line.decode('utf-8') ++ except AttributeError: ++ pass ++ if line.startswith('#'): ++ continue ++ fields = line.rstrip().split(delimiter) ++ if file_type == 'juicer': ++ chrom1 = fields[1] ++ start1 = fields[2] ++ chrom2 = fields[5] ++ start2 = fields[6] ++ elif file_type == '4DN': ++ chrom1 = fields[1] ++ start1 = fields[2] ++ chrom2 = fields[3] ++ start2 = fields[4] ++ retval.append([chrom1, start1, start1, chrom2, start2, start2]) + return retval + + +--- a/test/test_oldindex2.py ++++ b/test/test_oldindex2.py +@@ -35,45 +35,48 @@ + def get_header(filename, meta_char='#'): + """Read gzipped file and retrieve lines beginning with '#'.""" + retval = [] +- for line in gzip.open(filename): +- try: +- line = line.decode('utf-8') +- except AttributeError: +- pass +- if line.startswith(meta_char): +- retval.append(line.rstrip()) ++ with gzip.open(filename) as f: ++ for line in f: ++ try: ++ line = line.decode('utf-8') ++ except AttributeError: ++ pass ++ if line.startswith(meta_char): ++ retval.append(line.rstrip()) + return retval + + + def get_chromsize(filename): + """Read gzipped file and retrieve chromsize.""" + retval = [] +- for line in gzip.open(filename): +- try: +- line = line.decode('utf-8') +- except AttributeError: +- pass +- if line.startswith('#chromsize: '): +- fields = line.rstrip().split('\s+') +- chrname = fields[1] +- chrsize = fields[2] +- retval.append([chrname, chrsize]) ++ with gzip.open(filename) as f: ++ for line in f: ++ try: ++ line = line.decode('utf-8') ++ except AttributeError: ++ pass ++ if line.startswith('#chromsize: '): ++ fields = line.rstrip().split('\s+') ++ chrname = fields[1] ++ chrsize = fields[2] ++ retval.append([chrname, chrsize]) + return retval + + + def read_vcf(filename): + """Read a VCF file and return a list of [chrom, start, end] items.""" + retval = [] +- for line in gzip.open(filename): +- try: +- line = line.decode('utf-8') +- except AttributeError: +- pass +- fields = line.rstrip().split('\t') +- chrom = fields[0] +- start = fields[1] +- end = fields[1] +- retval.append([chrom, start, end]) ++ with gzip.open(filename) as f: ++ for line in f: ++ try: ++ line = line.decode('utf-8') ++ except AttributeError: ++ pass ++ fields = line.rstrip().split('\t') ++ chrom = fields[0] ++ start = fields[1] ++ end = fields[1] ++ retval.append([chrom, start, end]) + return retval + + +@@ -82,20 +85,21 @@ + or undetermined. Do this by testing string values of """ + is_juicer = False + is_4DN = False +- for line in gzip.open(filename): +- try: +- line = line.decode('utf-8') +- except AttributeError: +- pass +- fields = line.rstrip().split(delimiter) +- if len(fields)>=6 and is_str(fields[2]) and is_str(fields[6]): +- is_juicer = True +- if is_str(fields[2]) and is_str(fields[4]): +- is_4DN = True +- if not is_juicer and is_4DN: +- return '4DN' +- elif is_juicer: +- return 'juicer' ++ with gzip.open(filename) as f: ++ for line in f: ++ try: ++ line = line.decode('utf-8') ++ except AttributeError: ++ pass ++ fields = line.rstrip().split(delimiter) ++ if len(fields)>=6 and is_str(fields[2]) and is_str(fields[6]): ++ is_juicer = True ++ if is_str(fields[2]) and is_str(fields[4]): ++ is_4DN = True ++ if not is_juicer and is_4DN: ++ return '4DN' ++ elif is_juicer: ++ return 'juicer' + return 'undetermined' + + +@@ -114,25 +118,26 @@ + if file_type == 'undetermined': + return [] + retval = [] +- for line in gzip.open(filename): +- try: +- line = line.decode('utf-8') +- except AttributeError: +- pass +- if line.startswith('#'): +- continue +- fields = line.rstrip().split(delimiter) +- if file_type == 'juicer': +- chrom1 = fields[1] +- start1 = fields[2] +- chrom2 = fields[5] +- start2 = fields[6] +- elif file_type == '4DN': +- chrom1 = fields[1] +- start1 = fields[2] +- chrom2 = fields[3] +- start2 = fields[4] +- retval.append([chrom1, start1, start1, chrom2, start2, start2]) ++ with gzip.open(filename) as f: ++ for line in f: ++ try: ++ line = line.decode('utf-8') ++ except AttributeError: ++ pass ++ if line.startswith('#'): ++ continue ++ fields = line.rstrip().split(delimiter) ++ if file_type == 'juicer': ++ chrom1 = fields[1] ++ start1 = fields[2] ++ chrom2 = fields[5] ++ start2 = fields[6] ++ elif file_type == '4DN': ++ chrom1 = fields[1] ++ start1 = fields[2] ++ chrom2 = fields[3] ++ start2 = fields[4] ++ retval.append([chrom1, start1, start1, chrom2, start2, start2]) + return retval + + diff -Nru python-pairix-0.3.7/debian/patches/series python-pairix-0.3.7/debian/patches/series --- python-pairix-0.3.7/debian/patches/series 1969-12-31 20:00:00.000000000 -0400 +++ python-pairix-0.3.7/debian/patches/series 2021-11-19 22:07:39.000000000 -0400 @@ -0,0 +1 @@ +python3.10