From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <gentoo-python+bounces-303-garchives=archives.gentoo.org@lists.gentoo.org>
Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80])
	by finch.gentoo.org (Postfix) with ESMTP id 8998B1381F3
	for <garchives@archives.gentoo.org>; Mon, 17 Dec 2012 00:28:37 +0000 (UTC)
Received: from pigeon.gentoo.org (localhost [127.0.0.1])
	by pigeon.gentoo.org (Postfix) with SMTP id 340BF21C0D1;
	Mon, 17 Dec 2012 00:28:33 +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 B172F21C0D1
	for <gentoo-python@lists.gentoo.org>; Mon, 17 Dec 2012 00:28:32 +0000 (UTC)
Received: from pomiocik.lan (77-253-148-250.adsl.inetia.pl [77.253.148.250])
	(using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits))
	(No client certificate requested)
	(Authenticated sender: mgorny)
	by smtp.gentoo.org (Postfix) with ESMTPSA id AC98F33DC8F;
	Mon, 17 Dec 2012 00:28:30 +0000 (UTC)
From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org>
To: gentoo-python@lists.gentoo.org
Cc: python@gentoo.org,
	sera@gentoo.org,
	=?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org>
Subject: [gentoo-python] [PATCH 2/2] Re-enable python-r1 -> python-single-r1 dep prevention in EAPI 5+.
Date: Mon, 17 Dec 2012 01:28:23 +0100
Message-Id: <1355704103-21918-2-git-send-email-mgorny@gentoo.org>
X-Mailer: git-send-email 1.8.0.2
In-Reply-To: <1355704103-21918-1-git-send-email-mgorny@gentoo.org>
References: <1355704103-21918-1-git-send-email-mgorny@gentoo.org>
Precedence: bulk
List-Post: <mailto:gentoo-python@lists.gentoo.org>
List-Help: <mailto:gentoo-python+help@lists.gentoo.org>
List-Unsubscribe: <mailto:gentoo-python+unsubscribe@lists.gentoo.org>
List-Subscribe: <mailto:gentoo-python+subscribe@lists.gentoo.org>
List-Id: Discussions centering around the Python ecosystem in Gentoo Linux <gentoo-python.gentoo.org>
X-BeenThere: gentoo-python@gentoo.org
X-BeenThere: gentoo-python@lists.gentoo.org
X-Archives-Salt: 3189ed6a-3cc5-4b7f-ab7c-2a98542717e7
X-Archives-Hash: 4a235a988dce977beb2a07dde4cac54b

---
 gx86/eclass/python-r1.eclass | 31 +++++++++++++++++++++++++++----
 1 file changed, 27 insertions(+), 4 deletions(-)

diff --git a/gx86/eclass/python-r1.eclass b/gx86/eclass/python-r1.eclass
index cfd0a36..3cae4f0 100644
--- a/gx86/eclass/python-r1.eclass
+++ b/gx86/eclass/python-r1.eclass
@@ -133,12 +133,35 @@ fi
 
 _python_set_globals() {
 	local flags=( "${PYTHON_COMPAT[@]/#/python_targets_}" )
-	#local flags_st=( "${PYTHON_COMPAT[@]/#/-python_single_target_}" )
 	local optflags=${flags[@]/%/?}
-	#optflags+=,${flags_st[@]/%/(-)}
 
-	# PYTHON_SINGLE_TARGET safety check temporarily disabled
-	# because of issues with paludis, bug #447524.
+	# Here's a nice trick to prevent python-r1 packages from depending
+	# on python-single-r1 packages.
+	#
+	# python-single-r1 enforces at least one PYTHON_SINGLE_TARGET
+	# through REQUIRED_USE. Therefore, we can assume that
+	# python-single-r1 packages have at least one flag set.
+	#
+	# If packages does not use python-single-r1, it should have no
+	# PYTHON_SINGLE_TARGET flags.
+	#
+	# The '-python_single_target...(-)' construct is always true when
+	# there's no PYTHON_SINGLE_TARGET flags. If there is at least one
+	# such flag, there will be at least one set, and the relevant
+	# constraint will prevent the package from being merged.
+	#
+	# Therefore, developer trying to depend on python-single-r1 package
+	# will be unable to merge the package. This should be enough to
+	# prevent him from committing one.
+	#
+	# In EAPI < 5, an implicit IUSE is added for all USE_EXPAND
+	# variables, making '(-)' deps unusable on them. This can be seen
+	# in Paludis (bug #447524). We need at least EAPI=5 for this to work
+	# correctly.
+	if ! has "${EAPI}" 4; then
+		local flags_st=( "${PYTHON_COMPAT[@]/#/-python_single_target_}" )
+		optflags+=,${flags_st[@]/%/(-)}
+	fi
 
 	IUSE=${flags[*]}
 	REQUIRED_USE="|| ( ${flags[*]} )"
-- 
1.8.0.2