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 E51261381F3 for ; Wed, 10 Jul 2013 16:17:04 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 19450E0A53; Wed, 10 Jul 2013 16:16:58 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 54EC5E0A43 for ; Wed, 10 Jul 2013 16:16:57 +0000 (UTC) Received: from hornbill.gentoo.org (hornbill.gentoo.org [94.100.119.163]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 3438C33E8F0 for ; Wed, 10 Jul 2013 16:16:56 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by hornbill.gentoo.org (Postfix) with ESMTP id 9118BE5468 for ; Wed, 10 Jul 2013 16:16:53 +0000 (UTC) From: "André Erdmann" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "André Erdmann" Message-ID: <1373463570.a353dfabbe238f241c3e012be4343886374e4aaa.dywi@gentoo> Subject: [gentoo-commits] proj/R_overlay:master commit in: scripts/ X-VCS-Repository: proj/R_overlay X-VCS-Files: scripts/gen_setuppy.sh X-VCS-Directories: scripts/ X-VCS-Committer: dywi X-VCS-Committer-Name: André Erdmann X-VCS-Revision: a353dfabbe238f241c3e012be4343886374e4aaa X-VCS-Branch: master Date: Wed, 10 Jul 2013 16:16:53 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: 1241423d-cda4-47d1-a9a1-ee0b3920a260 X-Archives-Hash: 72f2fb5a90e26ff9efb46ee0e57c6a51 commit: a353dfabbe238f241c3e012be4343886374e4aaa Author: André Erdmann mailerd de> AuthorDate: Wed Jul 10 13:39:30 2013 +0000 Commit: André Erdmann mailerd de> CommitDate: Wed Jul 10 13:39:30 2013 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=a353dfab scripts/: generate setup.py --- scripts/gen_setuppy.sh | 149 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 149 insertions(+) diff --git a/scripts/gen_setuppy.sh b/scripts/gen_setuppy.sh new file mode 100755 index 0000000..ebba44e --- /dev/null +++ b/scripts/gen_setuppy.sh @@ -0,0 +1,149 @@ +#!/bin/sh +# +# creates a setup.py file +# + +set -u + +readonly I=" " +readonly Q="'" +readonly QQ='"' + +case "${0##*/}" in + gen_setup*) + readonly PRJROOT=$( dirname $( readlink -f $( dirname "${0}" ) ) ) + ;; + *) + readonly PRJROOT=$( readlink -f "${PWD}" ) + ;; +esac +readonly S="${PRJROOT}" + +# --- PRJ_* --- + +: ${PRJ_NAME:='R_Overlay'} +: ${PRJ_DESC:='Automatically generated overlay of R packages (SoC2012)'} +: ${PRJ_AUTHOR:='André Erdmann'} +: ${PRJ_AUTHOR_EMAIL:='dywi@mailerd.de'} +: ${PRJ_LICENSE:='GPLv2+'} +: ${PRJ_URL:='http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=summary'} +: ${PRJ_SCRIPTS:='roverlay.py'} + +if [ -z "${PRJ_VERSION-}" ]; then + PRJ_VERSION=$( sed -rn -e \ + "s,^version\s*=\s*[${Q}${QQ}]([^${Q}${QQ}]+)[${Q}${QQ}].*$,\1,p" \ + "${S}/roverlay/__init__.py" + ) + #PRJ_VERSION=$( python -EB "${S}/roverlay.py" --version 2>&1 ) +fi + +case "${PRJ_VERSION}" in + [0-9]*) true ;; + *) + echo "invalid roverlay version '${PRJ_VERSION}'!" 1>&2 + exit 9 + ;; +esac +# --- end PRJ_* --- + + +PKGLIST=$( + find roverlay/ -type d -not -name __pycache__| \ + sort | sed -e "s=^=${I}${I}$Q=" -e "s=[/]*$=$Q,=" -e 's=[/]=.=g' +) + + + +mklist() { local word; for word; do echo "${Q}${word}${Q},"; done; } +i_mklist() { mklist "$@" | sed -e "s=^=${I}${I}="; } + + + +gen_data_list() { + # disabled + return 0 + + g() { + local w="${1}"; shift || return + echo -n "( ${Q}${w}${Q}, [ " + local k + for k; do echo -n "${Q}${k}${Q}, "; done + echo "])," + } + p() { + local pre="${1}"; shift || return + local w + for w; do echo "${pre}${w}"; done + } + + g '/etc/roverlay' $( p 'config/' \ + 'description_fields.conf' \ + 'license.map' \ + 'repo.list' \ + 'R-overlay.conf' + ) + + unset -f p + unset -f g +} + +gen_setup() { + : ${I?} +cat << EOF +#!/usr/bin/python +# -*- coding: utf-8 -*- + +import distutils.core + +distutils.core.setup ( +${I}name = '${PRJ_NAME?}', +${I}version = '${PRJ_VERSION?}', +${I}description = '${PRJ_DESC?}', +${I}author = '${PRJ_AUTHOR?}', +${I}author_email = '${PRJ_AUTHOR_EMAIL?}', +${I}license = '${PRJ_LICENSE?}', +${I}url = '${PRJ_URL?}', +${I}packages = [ +${PKGLIST?} +${I}], +${I}scripts = [ +$(i_mklist ${PRJ_SCRIPTS}) +${I}], +${I}data_files = [ +$( gen_data_list | sed "s=^=${I}${I}=" ) +${I}], +${I}classifiers = [ +${I}${I}#'Development Status :: 3 - Alpha', +${I}${I}'Development Status :: 4 - Beta', +${I}${I}'Environment :: Console', +${I}${I}'Intended Audience :: Developers', +${I}${I}'Intended Audience :: System Administrators', +${I}${I}'License :: OSI Approved :: GNU General Public License v2 or later (GPLv2+)', +${I}${I}'Operating System :: POSIX :: Linux', +${I}${I}'Programming Language :: Python :: 2.7', +${I}${I}'Programming Language :: Python :: 3', +${I}${I}'Programming Language :: Unix Shell', +${I}${I}'Topic :: System :: Software Distribution', +${I}], +) +EOF +} + +gen_setup_file() { + if gen_setup > "${1:?}.new"; then + mv -f "${1}.new" "${1}" && chmod ug+x "${1}" + fi +} + + +case "${1-}" in + '') + gen_setup_file "${S}/setup.py" + ;; + '-1'|'--stdout'|'-') + gen_setup + ;; + *) + gen_setup_file "${1}" + ;; +esac 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 F0B061381F3 for ; Wed, 10 Jul 2013 15:10:47 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id F317BE09ED; Wed, 10 Jul 2013 15:10:45 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 05E8DE09E7 for ; Wed, 10 Jul 2013 15:10:44 +0000 (UTC) Received: from hornbill.gentoo.org (hornbill.gentoo.org [94.100.119.163]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id D9FA933E8B5 for ; Wed, 10 Jul 2013 15:10:43 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by hornbill.gentoo.org (Postfix) with ESMTP id 1D362E5464 for ; Wed, 10 Jul 2013 15:10:41 +0000 (UTC) From: "André Erdmann" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "André Erdmann" Message-ID: <1373463570.a353dfabbe238f241c3e012be4343886374e4aaa.dywi@gentoo> Subject: [gentoo-commits] proj/R_overlay:gsoc13/next commit in: scripts/ X-VCS-Repository: proj/R_overlay X-VCS-Files: scripts/gen_setuppy.sh X-VCS-Directories: scripts/ X-VCS-Committer: dywi X-VCS-Committer-Name: André Erdmann X-VCS-Revision: a353dfabbe238f241c3e012be4343886374e4aaa X-VCS-Branch: gsoc13/next Date: Wed, 10 Jul 2013 15:10:41 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: 4e7d1e5d-f2b6-42d8-a832-530974ef6cfb X-Archives-Hash: 17908c72f35a12db028c63acfad7df71 Message-ID: <20130710151041.ksjNcQjJ00A3HOez-FHprSa4ky6FnEceRioOPbBy64k@z> commit: a353dfabbe238f241c3e012be4343886374e4aaa Author: André Erdmann mailerd de> AuthorDate: Wed Jul 10 13:39:30 2013 +0000 Commit: André Erdmann mailerd de> CommitDate: Wed Jul 10 13:39:30 2013 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=a353dfab scripts/: generate setup.py --- scripts/gen_setuppy.sh | 149 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 149 insertions(+) diff --git a/scripts/gen_setuppy.sh b/scripts/gen_setuppy.sh new file mode 100755 index 0000000..ebba44e --- /dev/null +++ b/scripts/gen_setuppy.sh @@ -0,0 +1,149 @@ +#!/bin/sh +# +# creates a setup.py file +# + +set -u + +readonly I=" " +readonly Q="'" +readonly QQ='"' + +case "${0##*/}" in + gen_setup*) + readonly PRJROOT=$( dirname $( readlink -f $( dirname "${0}" ) ) ) + ;; + *) + readonly PRJROOT=$( readlink -f "${PWD}" ) + ;; +esac +readonly S="${PRJROOT}" + +# --- PRJ_* --- + +: ${PRJ_NAME:='R_Overlay'} +: ${PRJ_DESC:='Automatically generated overlay of R packages (SoC2012)'} +: ${PRJ_AUTHOR:='André Erdmann'} +: ${PRJ_AUTHOR_EMAIL:='dywi@mailerd.de'} +: ${PRJ_LICENSE:='GPLv2+'} +: ${PRJ_URL:='http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=summary'} +: ${PRJ_SCRIPTS:='roverlay.py'} + +if [ -z "${PRJ_VERSION-}" ]; then + PRJ_VERSION=$( sed -rn -e \ + "s,^version\s*=\s*[${Q}${QQ}]([^${Q}${QQ}]+)[${Q}${QQ}].*$,\1,p" \ + "${S}/roverlay/__init__.py" + ) + #PRJ_VERSION=$( python -EB "${S}/roverlay.py" --version 2>&1 ) +fi + +case "${PRJ_VERSION}" in + [0-9]*) true ;; + *) + echo "invalid roverlay version '${PRJ_VERSION}'!" 1>&2 + exit 9 + ;; +esac +# --- end PRJ_* --- + + +PKGLIST=$( + find roverlay/ -type d -not -name __pycache__| \ + sort | sed -e "s=^=${I}${I}$Q=" -e "s=[/]*$=$Q,=" -e 's=[/]=.=g' +) + + + +mklist() { local word; for word; do echo "${Q}${word}${Q},"; done; } +i_mklist() { mklist "$@" | sed -e "s=^=${I}${I}="; } + + + +gen_data_list() { + # disabled + return 0 + + g() { + local w="${1}"; shift || return + echo -n "( ${Q}${w}${Q}, [ " + local k + for k; do echo -n "${Q}${k}${Q}, "; done + echo "])," + } + p() { + local pre="${1}"; shift || return + local w + for w; do echo "${pre}${w}"; done + } + + g '/etc/roverlay' $( p 'config/' \ + 'description_fields.conf' \ + 'license.map' \ + 'repo.list' \ + 'R-overlay.conf' + ) + + unset -f p + unset -f g +} + +gen_setup() { + : ${I?} +cat << EOF +#!/usr/bin/python +# -*- coding: utf-8 -*- + +import distutils.core + +distutils.core.setup ( +${I}name = '${PRJ_NAME?}', +${I}version = '${PRJ_VERSION?}', +${I}description = '${PRJ_DESC?}', +${I}author = '${PRJ_AUTHOR?}', +${I}author_email = '${PRJ_AUTHOR_EMAIL?}', +${I}license = '${PRJ_LICENSE?}', +${I}url = '${PRJ_URL?}', +${I}packages = [ +${PKGLIST?} +${I}], +${I}scripts = [ +$(i_mklist ${PRJ_SCRIPTS}) +${I}], +${I}data_files = [ +$( gen_data_list | sed "s=^=${I}${I}=" ) +${I}], +${I}classifiers = [ +${I}${I}#'Development Status :: 3 - Alpha', +${I}${I}'Development Status :: 4 - Beta', +${I}${I}'Environment :: Console', +${I}${I}'Intended Audience :: Developers', +${I}${I}'Intended Audience :: System Administrators', +${I}${I}'License :: OSI Approved :: GNU General Public License v2 or later (GPLv2+)', +${I}${I}'Operating System :: POSIX :: Linux', +${I}${I}'Programming Language :: Python :: 2.7', +${I}${I}'Programming Language :: Python :: 3', +${I}${I}'Programming Language :: Unix Shell', +${I}${I}'Topic :: System :: Software Distribution', +${I}], +) +EOF +} + +gen_setup_file() { + if gen_setup > "${1:?}.new"; then + mv -f "${1}.new" "${1}" && chmod ug+x "${1}" + fi +} + + +case "${1-}" in + '') + gen_setup_file "${S}/setup.py" + ;; + '-1'|'--stdout'|'-') + gen_setup + ;; + *) + gen_setup_file "${1}" + ;; +esac