From mboxrd@z Thu Jan 1 00:00:00 1970 From: Guillaume Rousse Subject: Re: [PATCH] yet another package check Date: Thu, 14 Dec 2006 15:27:28 +0100 Message-ID: <45815F50.6030101@inria.fr> References: <4581688F.76E4.0078.0@novell.com> <200612141522.15699.Christoph.Egger@amd.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <200612141522.15699.Christoph.Egger@amd.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org Christoph Egger wrote: > Why do you write non-portable shell scripts? > > Some time ago, I made these portable: > > check_brctl > check_iproute > check_libvncserver > check_python I don't know if this one has been rewritten since stable version, but here is a patch I recently submited to the user list, to rely on python instead of ugly grep: diff -Naur xen-3.0.3_0-src/tools/check/check_python xen-3.0.3_0-src.better-python-check/tools/check/check_python --- xen-3.0.3_0-src/tools/check/check_python 2006-10-15 14:22:03.000000000 +0200 +++ xen-3.0.3_0-src.better-python-check/tools/check/check_python 2006-12-11 16:26:01.000000000 +0100 @@ -7,4 +7,4 @@ exit 1 } -python -V 2>&1 | cut -d ' ' -f 2 | grep -q '^2.[2345]' || error +python -c 'import sys; sys.exit(sys.version_info[0] < 2 or sys.version_info[1] < 2);' || error