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 1SXMX5-0003wk-0a for garchives@archives.gentoo.org; Thu, 24 May 2012 01:08:03 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 1061EE08C2; Thu, 24 May 2012 01:07:48 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id 0D321E08AF for ; Thu, 24 May 2012 01:07:12 +0000 (UTC) Received: from [192.168.4.5] (blfd-5d8229f1.pool.mediaWays.net [93.130.41.241]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: hasufell) by smtp.gentoo.org (Postfix) with ESMTPSA id 7FE091B4010 for ; Thu, 24 May 2012 01:07:11 +0000 (UTC) Message-ID: <4FBD892A.8030807@gentoo.org> Date: Thu, 24 May 2012 03:04:42 +0200 From: hasufell User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0.4) Gecko/20120502 Thunderbird/10.0.4 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 To: gentoo-dev@lists.gentoo.org Subject: [gentoo-dev] Re: enhancement for doicon/newicon in eutils.eclass References: <4FB97D1D.9070004@gentoo.org> In-Reply-To: <4FB97D1D.9070004@gentoo.org> X-Enigmail-Version: 1.3.5 Content-Type: multipart/mixed; boundary="------------090302090903040103030605" X-Archives-Salt: 8a2e8794-7dbc-42f5-8609-6b4538155064 X-Archives-Hash: 4d73a34fa10813c14b908db92ddad323 This is a multi-part message in MIME format. --------------090302090903040103030605 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit On 05/21/2012 01:24 AM, hasufell wrote: > I want support for installing icons into the appropriate directories > which are under /usr/share/icons/... and not just pixmaps. > > proposal attached + diff > > This should not break existing ebuilds. Tested a bit and open for review > now. next version --------------090302090903040103030605 Content-Type: text/plain; name="eutils.eclass.24may" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="eutils.eclass.24may" # @FUNCTION: _iconins # @DESCRIPTION: # function for use in doicon and newicon _iconins() { ( # wrap the env here so that the 'insinto' call # doesn't corrupt the env of the caller local size dir local context=apps local theme=hicolor while [[ $# -gt 0 ]] ; do case $1 in -s|--size) if [[ ${2%%x*}x${2%%x*} == "$2" ]] ; then size=${2%%x*} else size=${2} fi case ${size} in 16|22|24|32|36|48|64|72|96|128|192|256) size=${size}x${size};; scalable) ;; *) eerror "${size} is an unsupported icon size!" exit 1;; esac shift 2;; -t|--theme) theme=${2} shift 2;; -c|--context) context=${2} shift 2;; *) if [[ -z $size ]] ; then insinto /usr/share/pixmaps else insinto /usr/share/icons/${theme}/${size}/${context} fi if [[ $function == doicon ]] ; then if [[ -f $1 ]] ; then doins "${1}" elif [[ -d $1 ]] ; then shopt -s nullglob doins "${1}"/*.{png,svg} shopt -u nullglob else eerror "${1} is not a valid file/directory!" exit 1 fi else break fi shift 1;; esac done if [[ $function == newicon ]] ; then newins "$@" fi ) || die } # @FUNCTION: doicon # @USAGE: doicon [options] # @DESCRIPTION: # Install icon into the icon directory /usr/share/icons or into # /usr/share/pixmaps if "--size" is not set. # This is useful in conjunction with creating desktop/menu files. # # @CODE # options: # -s, --size # !!! must specify to install into /usr/share/icons/... !!! # size of the icon, like 48 or 48x48 # supported icon sizes are: # 16 22 24 32 36 48 64 72 96 128 192 256 scalable # -c, --context # defaults to "apps" # -t, --theme # defaults to "hicolor" # # icons: list of icons # @CODE # # example 1: # doicon foobar.png fuqbar.svg # results in: insinto /usr/share/pixmaps ; doins foobar.png fuqbar.svg # # example 2: # doicon -s 48 foobar.png fuqbar.png # results in: insinto /usr/share/icons/hicolor/48x48/apps ; doins foobar.png fuqbar.svg # doicon() { local function=$FUNCNAME _iconins "$@" } # @FUNCTION: newicon # @USAGE: newicon [options] # @DESCRIPTION: # Like doicon, install the specified icon as newname. # # example 1: # newicon foobar.png NEWNAME.png # results in: insinto /usr/share/pixmaps ; newins foobar.png NEWNAME.png # # example 2: # newicon -s 48 foobar.png NEWNAME.png # results in: insinto /usr/share/icons/hicolor/48x48/apps ; newins foobar.png NEWNAME.png # newicon() { local function=$FUNCNAME _iconins "$@" } --------------090302090903040103030605--