python-utils-r1.eclass: python_moduleinto, allow package dot-notation
authorMichał Górny <mgorny@gentoo.org>
Wed, 10 May 2017 13:33:05 +0000 (15:33 +0200)
committerMichał Górny <mgorny@gentoo.org>
Tue, 16 May 2017 17:11:31 +0000 (19:11 +0200)
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

index c594cb46b5f344187dae8925d4eacf26c2ab23df..863051337f0b1e12a779834229e36a7d7fbbe810 100644 (file)
@@ -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
 
        (