public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-dev] [PATCH] python-utils-r1, _moduleinto: doc fixup & dot-notation
@ 2017-05-10 14:08 Michał Górny
  2017-05-10 14:08 ` [gentoo-dev] [PATCH 1/4] python-utils-r1.eclass: Remove stray old doc bit Michał Górny
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: Michał Górny @ 2017-05-10 14:08 UTC (permalink / raw
  To: gentoo-dev; +Cc: python

Hi, everyone.

Here's a quick batch of improvements to python_moduleinto() in
python-utils-r1.eclass. Patches are, in order:

1. fix leftover doc comment,

2. clarify the doc wrt use across multiple impls,

3. allow dot-notation for targets, i.e.

  python_moduleinto foo.bar

alternatively to:

  python_moduleinto foo/bar

4. gives example use for 3.

--
Best regards,
Michał Górny



^ permalink raw reply	[flat|nested] 7+ messages in thread

* [gentoo-dev] [PATCH 1/4] python-utils-r1.eclass: Remove stray old doc bit
  2017-05-10 14:08 [gentoo-dev] [PATCH] python-utils-r1, _moduleinto: doc fixup & dot-notation Michał Górny
@ 2017-05-10 14:08 ` Michał Górny
  2017-05-10 14:08 ` [gentoo-dev] [PATCH 2/4] python-utils-r1.eclass: python_moduleinto, clarify relative path use Michał Górny
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Michał Górny @ 2017-05-10 14:08 UTC (permalink / raw
  To: gentoo-dev; +Cc: python, Michał Górny

Remove the bit of old python_moduleinto documentation that has been
accidentally left over.
---
 eclass/python-utils-r1.eclass | 6 ------
 1 file changed, 6 deletions(-)

diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass
index 66a359e8daee..c46feb08449b 100644
--- a/eclass/python-utils-r1.eclass
+++ b/eclass/python-utils-r1.eclass
@@ -823,12 +823,6 @@ python_newscript() {
 #   python_foreach_impl python_domodule baz.py
 # }
 # @CODE
-
-# Set the current module root. The new value will be stored
-# in the 'python_moduleroot' environment variable. The new value need
-# be relative to the site-packages root.
-#
-# Alternatively, you can set the variable directly.
 python_moduleinto() {
 	debug-print-function ${FUNCNAME} "${@}"
 
-- 
2.13.0



^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [gentoo-dev] [PATCH 2/4] python-utils-r1.eclass: python_moduleinto, clarify relative path use
  2017-05-10 14:08 [gentoo-dev] [PATCH] python-utils-r1, _moduleinto: doc fixup & dot-notation Michał Górny
  2017-05-10 14:08 ` [gentoo-dev] [PATCH 1/4] python-utils-r1.eclass: Remove stray old doc bit Michał Górny
@ 2017-05-10 14:08 ` Michał Górny
  2017-05-10 14:08 ` [gentoo-dev] [PATCH 3/4] python-utils-r1.eclass: python_moduleinto, allow package dot-notation Michał Górny
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Michał Górny @ 2017-05-10 14:08 UTC (permalink / raw
  To: gentoo-dev; +Cc: python, Michał Górny

Clearly indicate that python_moduleinto can be safely called outside
of the environment with Python interpreter established, and that
a single call can set the correct relative path for multiple different
implementations.
---
 eclass/python-utils-r1.eclass | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass
index c46feb08449b..c594cb46b5f3 100644
--- a/eclass/python-utils-r1.eclass
+++ b/eclass/python-utils-r1.eclass
@@ -815,6 +815,12 @@ python_newscript() {
 # When not set explicitly, the modules are installed to the top
 # site-packages directory.
 #
+# In the relative case, the exact path is determined directly
+# by each python_doscript/python_newscript function. Therefore,
+# python_moduleinto can be safely called before establishing the Python
+# interpreter and/or a single call can be used to set the path correctly
+# for multiple implementations, as can be seen in the following example.
+#
 # Example:
 # @CODE
 # src_install() {
-- 
2.13.0



^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [gentoo-dev] [PATCH 3/4] python-utils-r1.eclass: python_moduleinto, allow package dot-notation
  2017-05-10 14:08 [gentoo-dev] [PATCH] python-utils-r1, _moduleinto: doc fixup & dot-notation Michał Górny
  2017-05-10 14:08 ` [gentoo-dev] [PATCH 1/4] python-utils-r1.eclass: Remove stray old doc bit Michał Górny
  2017-05-10 14:08 ` [gentoo-dev] [PATCH 2/4] python-utils-r1.eclass: python_moduleinto, clarify relative path use Michał Górny
@ 2017-05-10 14:08 ` Michał Górny
  2017-05-10 14:08 ` [gentoo-dev] [PATCH 4/4] dev-python/repoze-who: Use dot-notation for python_moduleinto (example) Michał Górny
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Michał Górny @ 2017-05-10 14:08 UTC (permalink / raw
  To: gentoo-dev; +Cc: python, Michał Górny

Allow specifying the relative package destination using the dot-notation
used by Python itself (e.g. 'foo.bar') in addition to the directory form
('foo/bar'). Since dot can not be used in Python package names, this
change is backwards-compatible.
---
 eclass/python-utils-r1.eclass | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass
index c594cb46b5f3..863051337f0b 100644
--- a/eclass/python-utils-r1.eclass
+++ b/eclass/python-utils-r1.eclass
@@ -810,7 +810,9 @@ python_newscript() {
 # The <new-path> can either be an absolute target system path (in which
 # case it needs to start with a slash, and ${ED} will be prepended to
 # it) or relative to the implementation's site-packages directory
-# (then it must not start with a slash).
+# (then it must not start with a slash). The relative path can be
+# specified either using the Python package notation (separated by dots)
+# or the directory notation (using slashes).
 #
 # When not set explicitly, the modules are installed to the top
 # site-packages directory.
@@ -867,7 +869,7 @@ python_domodule() {
 		local PYTHON_SITEDIR=${PYTHON_SITEDIR}
 		[[ ${PYTHON_SITEDIR} ]] || python_export PYTHON_SITEDIR
 
-		d=${PYTHON_SITEDIR#${EPREFIX}}/${python_moduleroot}
+		d=${PYTHON_SITEDIR#${EPREFIX}}/${python_moduleroot//.//}
 	fi
 
 	(
-- 
2.13.0



^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [gentoo-dev] [PATCH 4/4] dev-python/repoze-who: Use dot-notation for python_moduleinto (example)
  2017-05-10 14:08 [gentoo-dev] [PATCH] python-utils-r1, _moduleinto: doc fixup & dot-notation Michał Górny
                   ` (2 preceding siblings ...)
  2017-05-10 14:08 ` [gentoo-dev] [PATCH 3/4] python-utils-r1.eclass: python_moduleinto, allow package dot-notation Michał Górny
@ 2017-05-10 14:08 ` Michał Górny
  2017-05-10 15:16 ` [gentoo-dev] Re: [PATCH] python-utils-r1, _moduleinto: doc fixup & dot-notation Mike Gilbert
  2017-05-16 17:19 ` [gentoo-dev] " Michał Górny
  5 siblings, 0 replies; 7+ messages in thread
From: Michał Górny @ 2017-05-10 14:08 UTC (permalink / raw
  To: gentoo-dev; +Cc: python, Michał Górny

---
 dev-python/repoze-who/repoze-who-2.2-r1.ebuild | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/dev-python/repoze-who/repoze-who-2.2-r1.ebuild b/dev-python/repoze-who/repoze-who-2.2-r1.ebuild
index f2f3ac568592..fb3636b8fe99 100644
--- a/dev-python/repoze-who/repoze-who-2.2-r1.ebuild
+++ b/dev-python/repoze-who/repoze-who-2.2-r1.ebuild
@@ -33,10 +33,10 @@ python_install() {
 	distutils-r1_python_install
 
 	# install __init__.py files for sub-namespaces
-	python_moduleinto repoze/who
+	python_moduleinto repoze.who
 	python_domodule repoze/who/__init__.py
 
-	python_moduleinto repoze/who/plugins
+	python_moduleinto repoze.who.plugins
 	python_domodule repoze/who/plugins/__init__.py
 }
 
-- 
2.13.0



^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [gentoo-dev] Re: [PATCH] python-utils-r1, _moduleinto: doc fixup & dot-notation
  2017-05-10 14:08 [gentoo-dev] [PATCH] python-utils-r1, _moduleinto: doc fixup & dot-notation Michał Górny
                   ` (3 preceding siblings ...)
  2017-05-10 14:08 ` [gentoo-dev] [PATCH 4/4] dev-python/repoze-who: Use dot-notation for python_moduleinto (example) Michał Górny
@ 2017-05-10 15:16 ` Mike Gilbert
  2017-05-16 17:19 ` [gentoo-dev] " Michał Górny
  5 siblings, 0 replies; 7+ messages in thread
From: Mike Gilbert @ 2017-05-10 15:16 UTC (permalink / raw
  To: Michał Górny; +Cc: Gentoo Dev, Gentoo Python Project

On Wed, May 10, 2017 at 10:08 AM, Michał Górny <mgorny@gentoo.org> wrote:
> Hi, everyone.
>
> Here's a quick batch of improvements to python_moduleinto() in
> python-utils-r1.eclass. Patches are, in order:
>
> 1. fix leftover doc comment,
>
> 2. clarify the doc wrt use across multiple impls,
>
> 3. allow dot-notation for targets, i.e.
>
>   python_moduleinto foo.bar
>
> alternatively to:
>
>   python_moduleinto foo/bar
>
> 4. gives example use for 3.
>

Seems ok to me.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [gentoo-dev] [PATCH] python-utils-r1, _moduleinto: doc fixup & dot-notation
  2017-05-10 14:08 [gentoo-dev] [PATCH] python-utils-r1, _moduleinto: doc fixup & dot-notation Michał Górny
                   ` (4 preceding siblings ...)
  2017-05-10 15:16 ` [gentoo-dev] Re: [PATCH] python-utils-r1, _moduleinto: doc fixup & dot-notation Mike Gilbert
@ 2017-05-16 17:19 ` Michał Górny
  5 siblings, 0 replies; 7+ messages in thread
From: Michał Górny @ 2017-05-16 17:19 UTC (permalink / raw
  To: gentoo-dev; +Cc: python

[-- Attachment #1: Type: text/plain, Size: 524 bytes --]

On śro, 2017-05-10 at 16:08 +0200, Michał Górny wrote:
> Hi, everyone.
> 
> Here's a quick batch of improvements to python_moduleinto() in
> python-utils-r1.eclass. Patches are, in order:
> 
> 1. fix leftover doc comment,
> 
> 2. clarify the doc wrt use across multiple impls,
> 
> 3. allow dot-notation for targets, i.e.
> 
>   python_moduleinto foo.bar
> 
> alternatively to:
> 
>   python_moduleinto foo/bar
> 
> 4. gives example use for 3.
> 

Committed.


-- 
Best regards,
Michał Górny

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 963 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2017-05-16 17:21 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-05-10 14:08 [gentoo-dev] [PATCH] python-utils-r1, _moduleinto: doc fixup & dot-notation Michał Górny
2017-05-10 14:08 ` [gentoo-dev] [PATCH 1/4] python-utils-r1.eclass: Remove stray old doc bit Michał Górny
2017-05-10 14:08 ` [gentoo-dev] [PATCH 2/4] python-utils-r1.eclass: python_moduleinto, clarify relative path use Michał Górny
2017-05-10 14:08 ` [gentoo-dev] [PATCH 3/4] python-utils-r1.eclass: python_moduleinto, allow package dot-notation Michał Górny
2017-05-10 14:08 ` [gentoo-dev] [PATCH 4/4] dev-python/repoze-who: Use dot-notation for python_moduleinto (example) Michał Górny
2017-05-10 15:16 ` [gentoo-dev] Re: [PATCH] python-utils-r1, _moduleinto: doc fixup & dot-notation Mike Gilbert
2017-05-16 17:19 ` [gentoo-dev] " Michał Górny

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox