public inbox for cygwin-apps@cygwin.com
 help / color / mirror / Atom feed
From: Jon Turney <jon.turney@dronecode.org.uk>
To: cygwin-apps@cygwin.com
Cc: Jon Turney <jon.turney@dronecode.org.uk>
Subject: [PATCH cygport] python-wheel: Make a python3-name virtual package
Date: Sun, 29 May 2022 16:53:54 +0100	[thread overview]
Message-ID: <20220529155354.18478-1-jon.turney@dronecode.org.uk> (raw)

When making python3x-name package (where 3.x is the current default
python version), also make a python3-name virtual package, which causes
python3x-name to be installed.
---
 cygclass/python-wheel.cygclass | 18 ++++++++++++++----
 lib/src_postinst.cygpart       | 11 +++++++++--
 2 files changed, 23 insertions(+), 6 deletions(-)

diff --git a/cygclass/python-wheel.cygclass b/cygclass/python-wheel.cygclass
index 90b0faa..b6ed68b 100644
--- a/cygclass/python-wheel.cygclass
+++ b/cygclass/python-wheel.cygclass
@@ -86,8 +86,8 @@ inherit python.org
 #    are already available.
 #****
 
-# when the default versions of Python change, this and the ENSUREPIP_OPTIONS
-# switches need to be updated accordingly
+# when the default versions of Python change, this, the python3 virtual package
+# target, and the ENSUREPIP_OPTIONS switches need to be updated accordingly
 _tmp_wheel_v=
 : ${PYTHON_WHEEL_VERSIONS:=default}
 for ver in ${PYTHON_WHEEL_VERSIONS//:/ }
@@ -124,11 +124,21 @@ then
 	for ver in ${PYTHON_WHEEL_VERSIONS//:/ }
 	do
 		PKG_NAMES+=" python${ver/.}-${PYTHON_WHEEL_NAME}"
-		# these were 2&3 at the time of the XY-version split,
+		# this was 2 at the time of the XY-version split,
 		# and MUST NOT be updated when defaults change
 		case ${ver} in
 		2.7)	declare -g python27_${PYTHON_WHEEL_NAME//[-\.]/_}_OBSOLETES="python-${PYTHON_WHEEL_NAME} python2-${PYTHON_WHEEL_NAME}" ;;
-		3.6)	declare -g python36_${PYTHON_WHEEL_NAME//[-\.]/_}_OBSOLETES="python3-${PYTHON_WHEEL_NAME}" ;;
+		# this is the default 3.x version
+		3.9)
+		    # If we are making a 3.x package (where x is the default),
+		    # also make a python3-wheelname virtual package, which just
+		    # requires python3x-wheelname
+		    PKG_NAMES+=" python3-${PYTHON_WHEEL_NAME}"
+		    declare -g python3_${PYTHON_WHEEL_NAME//[-\.]/_}_DESCRIPTION="The python3-${PYTHON_WHEEL_NAME} virtual package. Selecting this package for installation will cause the python${ver/.}-${PYTHON_WHEEL_NAME} package to be installed."
+		    declare -g python3_${PYTHON_WHEEL_NAME//[-\.]/_}_CATEGORY="Python Virtual"
+		    declare -g python3_${PYTHON_WHEEL_NAME//[-\.]/_}_REQUIRES="python${ver/.}-${PYTHON_WHEEL_NAME}"
+		    declare -g python3_${PYTHON_WHEEL_NAME//[-\.]/_}_CONTENTS=""
+		    ;;
 		esac
 		declare -g python${ver/.}_${PYTHON_WHEEL_NAME//[-\.]/_}_CONTENTS="usr/lib/python${ver}/site-packages/ usr/share/doc/python${ver/.}-${PYTHON_WHEEL_NAME}"
 	done
diff --git a/lib/src_postinst.cygpart b/lib/src_postinst.cygpart
index 4b51325..b0361b1 100644
--- a/lib/src_postinst.cygpart
+++ b/lib/src_postinst.cygpart
@@ -430,6 +430,7 @@ __prepdoc() {
 	local html;
 	local -i n=0;
 	local p;
+	local pkg_contents_var;
 	local pkg_docs_var;
 	local pkg_hint;
 	local default_docs="\
@@ -451,10 +452,16 @@ __prepdoc() {
 		inform "Skipping package doc installation per request";
 	elif defined _CYGPORT_INTERNAL_multi_doc_
 	then
+		# install docs in a package-specific path in every non-empty
+		# subpackage
 		for p in ${PKG_NAMES}
 		do
-			_docinto_dir=/$p
-			dodoc ${default_docs} ${DOCS};
+			pkg_contents_var=${p//[-\.]/_}_CONTENTS
+			if [ -n "${!pkg_contents_var}" ]
+			then
+				_docinto_dir=/$p
+				dodoc ${default_docs} ${DOCS};
+			fi
 		done
 		unset _docinto_dir;
 	else
-- 
2.36.1


                 reply	other threads:[~2022-05-29 15:54 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220529155354.18478-1-jon.turney@dronecode.org.uk \
    --to=jon.turney@dronecode.org.uk \
    --cc=cygwin-apps@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).