commit:     f301a33fa321175c12de267ecfbf4d1b727be3f0
Author:     Martin Mokrejš <mmokrejs <AT> fold <DOT> natur <DOT> cuni <DOT> cz>
AuthorDate: Sat Jul 23 07:25:08 2016 +0000
Commit:     Martin Mokrejs <mmokrejs <AT> fold <DOT> natur <DOT> cuni <DOT> cz>
CommitDate: Sat Jul 23 07:25:08 2016 +0000
URL:        https://gitweb.gentoo.org/proj/sci.git/commit/?id=f301a33f

sci-biology/biopython: version bump with one minor upstream patch

Package-Manager: portage-2.2.28

 sci-biology/biopython/biopython-1.67-r1.ebuild     | 60 +++++++++++++++
 .../biopython/files/biopython-1.67-pull-884.patch  | 87 ++++++++++++++++++++++
 sci-biology/biopython/metadata.xml                 |  8 ++
 3 files changed, 155 insertions(+)

diff --git a/sci-biology/biopython/biopython-1.67-r1.ebuild 
b/sci-biology/biopython/biopython-1.67-r1.ebuild
new file mode 100644
index 0000000..197e265
--- /dev/null
+++ b/sci-biology/biopython/biopython-1.67-r1.ebuild
@@ -0,0 +1,60 @@
+# Copyright 1999-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+PYTHON_COMPAT=( python2_7 python3_{3,4,5} pypy )
+
+inherit distutils-r1 eutils
+
+DESCRIPTION="Python modules for computational molecular biology"
+HOMEPAGE="http://www.biopython.org/ https://pypi.python.org/pypi/biopython/";
+SRC_URI="http://www.biopython.org/DIST/${P}.tar.gz";
+
+LICENSE="HPND"
+SLOT="0"
+KEYWORDS="~amd64 ~ppc ~x86 ~amd64-linux ~x86-linux"
+IUSE=""
+
+RDEPEND="
+       dev-python/matplotlib[$(python_gen_usedep 'python*')]
+       dev-python/networkx[$(python_gen_usedep 'python*')]
+       dev-python/numpy[$(python_gen_usedep 'python*')]
+       dev-python/rdflib[$(python_gen_usedep 'python*')]
+       dev-python/pygraphviz[$(python_gen_usedep 'python2*')]
+       dev-python/reportlab[$(python_gen_usedep 'python*')]
+       media-gfx/pydot[$(python_gen_usedep 'python2*')]
+       "
+DEPEND="${RDEPEND}
+       sys-devel/flex"
+
+DOCS=( CONTRIB DEPRECATED NEWS README Doc/. )
+
+src_prepare(){
+       epatch "${FILESDIR}"/biopython-1.67-pull-884.patch
+}
+
+python_test() {
+       distutils_install_for_testing
+       cp -r "${S}"/{Doc,Tests} "${TEST_DIR}"/lib/ || die
+       cd "${TEST_DIR}"/lib/Tests || die
+       rm ./test_BioSQL_psycopg2.py ./test_BioSQL_MySQLdb.py 
./test_BioSQL_mysql_connector.py || die
+       ${PYTHON} run_tests.py --offline --verbose || die
+}
+
+python_install_all() {
+       distutils-r1_python_install_all
+
+       dodir /usr/share/${PN}
+       cp -r --preserve=mode Scripts Tests "${ED}"/usr/share/${PN} || die
+}
+
+pkg_postinst() {
+       elog "For database support you need to install:"
+       optfeature "MySQL" dev-python/mysql-python
+       optfeature "PostGreSQL" dev-python/psycopg
+       echo
+       elog "Some applications need extra packages:"
+       optfeature "EMBOSS (The European Molecular Biology Open Software 
Suite)" sci-biology/emboss
+}

diff --git a/sci-biology/biopython/files/biopython-1.67-pull-884.patch 
b/sci-biology/biopython/files/biopython-1.67-pull-884.patch
new file mode 100644
index 0000000..f2a2537
--- /dev/null
+++ b/sci-biology/biopython/files/biopython-1.67-pull-884.patch
@@ -0,0 +1,87 @@
+--- Bio/SeqRecord.py.old       2016-06-08 15:27:00.000000000 +0200
++++ Bio/SeqRecord.py   2016-07-22 17:48:19.620712535 +0200
+@@ -292,19 +292,28 @@
+         >>> sub_record.letter_annotations = {}
+         >>> sub_record.letter_annotations
+         {}
++
++        Note that if replacing the record's sequence with a sequence of a
++        different length you must first clear the letter_annotations dict.
+         """)
+ 
+     def _set_seq(self, value):
+         # TODO - Add a deprecation warning that the seq should be write only?
+         if self._per_letter_annotations:
+-            # TODO - Make this a warning? Silently empty the dictionary?
+-            raise ValueError("You must empty the letter annotations first!")
+-        self._seq = value
+-        try:
+-            self._per_letter_annotations = 
_RestrictedDict(length=len(self.seq))
+-        except AttributeError:
+-            # e.g. seq is None
+-            self._per_letter_annotations = _RestrictedDict(length=0)
++            if len(self) != len(value):
++                # TODO - Make this a warning? Silently empty the dictionary?
++                raise ValueError("You must empty the letter annotations 
first!")
++            else:
++                # Leave the existing per letter annotations unchanged:
++                self._seq = value
++        else:
++            self._seq = value
++            # Reset the (empty) letter annotations dict with new length:
++            try:
++                self._per_letter_annotations = 
_RestrictedDict(length=len(self.seq))
++            except AttributeError:
++                # e.g. seq is None
++                self._per_letter_annotations = _RestrictedDict(length=0)
+ 
+     seq = property(fget=lambda self: self._seq,
+                    fset=_set_seq,
+@@ -427,10 +436,17 @@
+             if self.seq is None:
+                 raise ValueError("If the sequence is None, we cannot slice 
it.")
+             parent_length = len(self)
+-            answer = self.__class__(self.seq[index],
+-                                    id=self.id,
+-                                    name=self.name,
+-                                    description=self.description)
++            from BioSQL.BioSeq import DBSeqRecord
++            if isinstance(self, DBSeqRecord):
++                answer = SeqRecord(self.seq[index],
++                                        id=self.id,
++                                        name=self.name,
++                                        description=self.description)
++            else:
++                answer = self.__class__(self.seq[index],
++                                        id=self.id,
++                                        name=self.name,
++                                        description=self.description)
+             # TODO - The description may no longer apply.
+             # It would be safer to change it to something
+             # generic like "edited" or the default value.
+--- Tests/test_SeqRecord.py.old        2016-06-08 15:27:00.000000000 +0200
++++ Tests/test_SeqRecord.py    2016-07-22 17:48:45.401428898 +0200
+@@ -72,6 +72,23 @@
+         except (TypeError, ValueError) as e:
+             pass
+ 
++    def test_replacing_seq(self):
++        """Replacing .seq if .letter_annotation present."""
++        rec = SeqRecord(Seq("ACGT", generic_dna),
++                        id="Test", name="Test", description="Test",
++                        letter_annotations={"example": [1, 2, 3, 4]})
++        try:
++            rec.seq = Seq("ACGTACGT", generic_dna)
++            self.fail("Changing .seq length with letter_annotations present 
should fail!")
++        except ValueError as e:
++            self.assertEqual(str(e), "You must empty the letter annotations 
first!")
++        # Check we can replace IF the length is the same
++        self.assertEqual(str(rec.seq), "ACGT")
++        self.assertEqual(rec.letter_annotations, {"example": [1, 2, 3, 4]})
++        rec.seq = Seq("NNNN" , generic_dna)
++        self.assertEqual(str(rec.seq), "NNNN")
++        self.assertEqual(rec.letter_annotations, {"example": [1, 2, 3, 4]})
++
+     def test_valid_id(self):
+         with self.assertRaises(TypeError):
+             SeqRecord(Seq("ACGT", generic_dna), id=dict())

diff --git a/sci-biology/biopython/metadata.xml 
b/sci-biology/biopython/metadata.xml
new file mode 100644
index 0000000..959160f
--- /dev/null
+++ b/sci-biology/biopython/metadata.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd";>
+<pkgmetadata>
+  <maintainer type="project">
+    <email>sci-biol...@gentoo.org</email>
+    <name>Gentoo Biology Project</name>
+  </maintainer>
+</pkgmetadata>

Reply via email to