From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id 4E5931381F3 for ; Sat, 3 Aug 2013 15:54:54 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 2377EE0931; Sat, 3 Aug 2013 15:54:51 +0000 (UTC) Received: from a1www.kph.uni-mainz.de (a1www.kph.uni-mainz.de [134.93.134.1]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 35D39E080A for ; Sat, 3 Aug 2013 15:54:49 +0000 (UTC) Received: from a1i15.kph.uni-mainz.de (a1i15.kph.uni-mainz.de [134.93.134.92]) by a1www.kph.uni-mainz.de (8.14.4/8.13.4) with ESMTP id r73Fsgeu017561; Sat, 3 Aug 2013 17:54:42 +0200 Received: from a1i15.kph.uni-mainz.de (localhost [127.0.0.1]) by a1i15.kph.uni-mainz.de (8.14.6/8.14.2) with ESMTP id r73Fsgvh028675; Sat, 3 Aug 2013 17:54:42 +0200 Received: (from ulm@localhost) by a1i15.kph.uni-mainz.de (8.14.6/8.14.6/Submit) id r73Fsg2t028670; Sat, 3 Aug 2013 17:54:42 +0200 Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-dev@lists.gentoo.org Reply-to: gentoo-dev@lists.gentoo.org MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-2 Content-Transfer-Encoding: 8bit Message-ID: <20989.10178.719868.528622@a1i15.kph.uni-mainz.de> Date: Sat, 3 Aug 2013 17:54:42 +0200 To: gentoo-dev@lists.gentoo.org Cc: python@gentoo.org Subject: Re: [gentoo-dev] [New eclass] twisted-r1.eclass In-Reply-To: <20130803171303.18911eba@gentoo.org> References: <20130803171303.18911eba@gentoo.org> X-Mailer: VM 8.2.0b under 24.3.1 (x86_64-pc-linux-gnu) From: Ulrich Mueller X-Archives-Salt: c2d73768-9889-49d0-ac15-65f684e0cc46 X-Archives-Hash: acb2450a5a96c3dc8d584d8ad089d41c >>>>> On Sat, 3 Aug 2013, Michał Górny wrote: > 2. The eclass comes with a pure bash-3.2 CamelCase converter for > changing PNs like 'twisted-foo' into 'TwistedFoo'. The relevant code > can be moved to eutils as portable replacements for bash-4 ${foo^} > and friends. > # obtain octal ASCII code for the first letter. > local ord=$(printf '%o' "'${fl}") > > # check if it's [a-z]. ASCII codes are locale-safe. > if [[ ${ord} -ge 141 && ${ord} -le 172 ]]; then > # now substract 040 to make it upper-case. > # fun fact: in range 0141..0172, decimal '- 40' is fine. > local ord=$(( ${ord} - 40)) > # and convert it back to the character. > fl=$(printf '\'${ord}) > fi This looks just horrible. You do decimal arithmetic on octal numbers? Ulrich