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 1QBtC0-0000oA-4X for garchives@archives.gentoo.org; Mon, 18 Apr 2011 18:29:00 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 24FE31C006; Mon, 18 Apr 2011 18:28:53 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id DEAF81C006 for ; Mon, 18 Apr 2011 18:28:52 +0000 (UTC) Received: from pelican.gentoo.org (unknown [66.219.59.40]) (using TLSv1 with cipher ADH-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 6A0581B4042 for ; Mon, 18 Apr 2011 18:28:52 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by pelican.gentoo.org (Postfix) with ESMTP id 73B1980065 for ; Mon, 18 Apr 2011 18:28:51 +0000 (UTC) From: "Paul Varner" To: gentoo-commits@lists.gentoo.org Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Paul Varner" Message-ID: <6e7df927a6225066de1c4f100cd4e8541b5aa3f0.fuzzyray@gentoo> Subject: [gentoo-commits] proj/gentoolkit:gentoolkit commit in: pym/gentoolkit/ X-VCS-Repository: proj/gentoolkit X-VCS-Files: pym/gentoolkit/eprefix.py X-VCS-Directories: pym/gentoolkit/ X-VCS-Committer: fuzzyray X-VCS-Committer-Name: Paul Varner X-VCS-Revision: 6e7df927a6225066de1c4f100cd4e8541b5aa3f0 Date: Mon, 18 Apr 2011 18:28:51 +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: 8323c6d6d9e4e2eb5d1f7384101f40ae commit: 6e7df927a6225066de1c4f100cd4e8541b5aa3f0 Author: Paul Varner gentoo org> AuthorDate: Mon Apr 18 18:27:17 2011 +0000 Commit: Paul Varner gentoo org> CommitDate: Mon Apr 18 18:27:17 2011 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/gentoolkit.gi= t;a=3Dcommit;h=3D6e7df927 Change eprefix.py to only look at portage for the value of EPREFIX --- pym/gentoolkit/eprefix.py | 28 +++++++++------------------- 1 files changed, 9 insertions(+), 19 deletions(-) diff --git a/pym/gentoolkit/eprefix.py b/pym/gentoolkit/eprefix.py index 9a04e4b..48bd140 100644 --- a/pym/gentoolkit/eprefix.py +++ b/pym/gentoolkit/eprefix.py @@ -10,25 +10,15 @@ used in all gentoolkit modules =20 Example useage: from gentoolkit.eprefix import EPREFIX -then in code add it to the filepath eg.: =20 +then in code add it to the filepath eg.: exclude_file =3D "%s/etc/%s/%s.exclude" % (EPREFIX,__productname__ , ac= tion) =20 """ - -import os - - -EPREFIX =3D '' - -# the following code is used to set it when -# non-installed code is being run -if 'EPREFIX' in os.environ: - EPREFIX =3D os.environ['EPREFIX'] -else: - try: - import portage.const - EPREFIX =3D portage.BPREFIX - except AttributeError: - EPREFIX =3D '' - -#print("EPREFIX set to:", EPREFIX) +# Load EPREFIX from Portage, fall back to the empty string if it fails +try: + from portage.const import EPREFIX +except ImportError: + EPREFIX =3D '' + +if __name__ =3D=3D "__main__": + print("EPREFIX set to:", EPREFIX)