From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1Qrn30-0008PL-JO for garchives@archives.gentoo.org; Fri, 12 Aug 2011 08:24:54 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 1354721C111; Fri, 12 Aug 2011 08:24:46 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id D757B21C111 for ; Fri, 12 Aug 2011 08:24:46 +0000 (UTC) Received: from pelican.gentoo.org (unknown [66.219.59.40]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id EC6651B4068 for ; Fri, 12 Aug 2011 08:24:45 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by pelican.gentoo.org (Postfix) with ESMTP id AB87C80048 for ; Fri, 12 Aug 2011 08:24:44 +0000 (UTC) From: "Michał Górny" To: gentoo-commits@lists.gentoo.org Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Michał Górny" Message-ID: <3d7f366544288fdcad55a81256c2dad2819cdeb1.mgorny@gentoo> Subject: [gentoo-commits] proj/gentoopm:master commit in: gentoopm/ X-VCS-Repository: proj/gentoopm X-VCS-Files: gentoopm/querycli.py X-VCS-Directories: gentoopm/ X-VCS-Committer: mgorny X-VCS-Committer-Name: Michał Górny X-VCS-Revision: 3d7f366544288fdcad55a81256c2dad2819cdeb1 Date: Fri, 12 Aug 2011 08:24:44 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: quoted-printable X-Archives-Salt: X-Archives-Hash: 916fd698ede6f44d237e377a83a4d587 commit: 3d7f366544288fdcad55a81256c2dad2819cdeb1 Author: Micha=C5=82 G=C3=B3rny gentoo org> AuthorDate: Fri Aug 12 08:24:48 2011 +0000 Commit: Micha=C5=82 G=C3=B3rny gentoo org> CommitDate: Fri Aug 12 08:24:48 2011 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/gentoopm.git;= a=3Dcommit;h=3D3d7f3665 Support old IPython API as well. --- gentoopm/querycli.py | 20 +++++++++++++++----- 1 files changed, 15 insertions(+), 5 deletions(-) diff --git a/gentoopm/querycli.py b/gentoopm/querycli.py index be58106..c2ab2f0 100644 --- a/gentoopm/querycli.py +++ b/gentoopm/querycli.py @@ -103,14 +103,24 @@ class PMQueryCommands(object): Run a Python shell with current PM selected. """ def __call__(self, pm, args): + welc =3D "The %s PM is now available as 'pm' object." % pm.name + kwargs =3D {} + try: from IPython import embed except ImportError: - self._arg.error('IPython >=3D 0.11 required for shell') - return 1 - - welc =3D "The %s PM is now available as 'pm' object." % pm.name - embed(banner2 =3D welc) + try: + from IPython.Shell import IPShellEmbed + except ImportError: + self._arg.error('IPython required for shell') + return 1 + else: + embed =3D IPShellEmbed() + embed.set_banner(embed.IP.BANNER + '\n\n' + welc) + else: + kwargs['banner2'] =3D welc + + embed(**kwargs) =20 def __iter__(self): for k in dir(self):