public inbox for gentoo-python@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-python] [PATCH] Support python_get_library_path().
@ 2013-02-03 23:57 Michał Górny
  2013-02-04  1:14 ` [gentoo-python] " Mike Gilbert
  0 siblings, 1 reply; 2+ messages in thread
From: Michał Górny @ 2013-02-03 23:57 UTC (permalink / raw
  To: gentoo-python; +Cc: python, Michał Górny

Needed for dev-python/shiboken.
---
 gx86/eclass/python-utils-r1.eclass | 43 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 43 insertions(+)

diff --git a/gx86/eclass/python-utils-r1.eclass b/gx86/eclass/python-utils-r1.eclass
index b425302..5facf33 100644
--- a/gx86/eclass/python-utils-r1.eclass
+++ b/gx86/eclass/python-utils-r1.eclass
@@ -124,6 +124,18 @@ _python_impl_supported() {
 # /usr/include/python2.6
 # @CODE
 
+# @ECLASS-VARIABLE: PYTHON_LIBPATH
+# @DESCRIPTION:
+# The path to Python library.
+#
+# Set and exported on request using python_export().
+# Valid only for CPython.
+#
+# Example value:
+# @CODE
+# /usr/lib64/libpython2.6.so
+# @CODE
+
 # @ECLASS-VARIABLE: PYTHON_PKG_DEP
 # @DESCRIPTION:
 # The complete dependency on a particular Python package as a string.
@@ -219,6 +231,22 @@ python_export() {
 				export PYTHON_INCLUDEDIR=${EPREFIX}${dir}
 				debug-print "${FUNCNAME}: PYTHON_INCLUDEDIR = ${PYTHON_INCLUDEDIR}"
 				;;
+			PYTHON_LIBPATH)
+				local libname
+				case "${impl}" in
+					python*)
+						libname=lib${impl}
+						;;
+					*)
+						die "${EPYTHON} lacks a dynamic library"
+						;;
+				esac
+
+				local path=${EPREFIX}/usr/$(get_libdir)
+
+				export PYTHON_LIBPATH=${path}/${libname}$(get_libname)
+				debug-print "${FUNCNAME}: PYTHON_LIBPATH = ${PYTHON_LIBPATH}"
+				;;
 			PYTHON_PKG_DEP)
 				local d
 				case ${impl} in
@@ -310,6 +338,21 @@ python_get_includedir() {
 	echo "${PYTHON_INCLUDEDIR}"
 }
 
+# @FUNCTION: python_get_library_path
+# @USAGE: [<impl>]
+# @DESCRIPTION:
+# Obtain and print the Python library path for the given implementation.
+# If no implementation is provided, ${EPYTHON} will be used.
+#
+# Please note that this function can be used with CPython only. Use
+# in another implementation will result in a fatal failure.
+python_get_library_path() {
+	debug-print-function ${FUNCNAME} "${@}"
+
+	python_export "${@}" PYTHON_LIBPATH
+	echo "${PYTHON_LIBPATH}"
+}
+
 # @FUNCTION: _python_rewrite_shebang
 # @INTERNAL
 # @USAGE: [<EPYTHON>] <path>...
-- 
1.8.1.2



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

* [gentoo-python] Re: [PATCH] Support python_get_library_path().
  2013-02-03 23:57 [gentoo-python] [PATCH] Support python_get_library_path() Michał Górny
@ 2013-02-04  1:14 ` Mike Gilbert
  0 siblings, 0 replies; 2+ messages in thread
From: Mike Gilbert @ 2013-02-04  1:14 UTC (permalink / raw
  To: Michał Górny; +Cc: gentoo-python, python

On Sun, Feb 3, 2013 at 6:57 PM, Michał Górny <mgorny@gentoo.org> wrote:
> Needed for dev-python/shiboken.
> ---
>  gx86/eclass/python-utils-r1.eclass | 43 ++++++++++++++++++++++++++++++++++++++
>  1 file changed, 43 insertions(+)
>
> diff --git a/gx86/eclass/python-utils-r1.eclass b/gx86/eclass/python-utils-r1.eclass
> index b425302..5facf33 100644
> --- a/gx86/eclass/python-utils-r1.eclass
> +++ b/gx86/eclass/python-utils-r1.eclass
> @@ -124,6 +124,18 @@ _python_impl_supported() {
>  # /usr/include/python2.6
>  # @CODE
>
> +# @ECLASS-VARIABLE: PYTHON_LIBPATH
> +# @DESCRIPTION:
> +# The path to Python library.
> +#
> +# Set and exported on request using python_export().
> +# Valid only for CPython.
> +#
> +# Example value:
> +# @CODE
> +# /usr/lib64/libpython2.6.so
> +# @CODE
> +
>  # @ECLASS-VARIABLE: PYTHON_PKG_DEP
>  # @DESCRIPTION:
>  # The complete dependency on a particular Python package as a string.
> @@ -219,6 +231,22 @@ python_export() {
>                                 export PYTHON_INCLUDEDIR=${EPREFIX}${dir}
>                                 debug-print "${FUNCNAME}: PYTHON_INCLUDEDIR = ${PYTHON_INCLUDEDIR}"
>                                 ;;
> +                       PYTHON_LIBPATH)
> +                               local libname
> +                               case "${impl}" in
> +                                       python*)
> +                                               libname=lib${impl}
> +                                               ;;
> +                                       *)
> +                                               die "${EPYTHON} lacks a dynamic library"
> +                                               ;;
> +                               esac
> +
> +                               local path=${EPREFIX}/usr/$(get_libdir)
> +
> +                               export PYTHON_LIBPATH=${path}/${libname}$(get_libname)
> +                               debug-print "${FUNCNAME}: PYTHON_LIBPATH = ${PYTHON_LIBPATH}"
> +                               ;;
>                         PYTHON_PKG_DEP)
>                                 local d
>                                 case ${impl} in
> @@ -310,6 +338,21 @@ python_get_includedir() {
>         echo "${PYTHON_INCLUDEDIR}"
>  }
>
> +# @FUNCTION: python_get_library_path
> +# @USAGE: [<impl>]
> +# @DESCRIPTION:
> +# Obtain and print the Python library path for the given implementation.
> +# If no implementation is provided, ${EPYTHON} will be used.
> +#
> +# Please note that this function can be used with CPython only. Use
> +# in another implementation will result in a fatal failure.
> +python_get_library_path() {
> +       debug-print-function ${FUNCNAME} "${@}"
> +
> +       python_export "${@}" PYTHON_LIBPATH
> +       echo "${PYTHON_LIBPATH}"
> +}
> +
>  # @FUNCTION: _python_rewrite_shebang
>  # @INTERNAL
>  # @USAGE: [<EPYTHON>] <path>...
> --
> 1.8.1.2
>

Do it.


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

end of thread, other threads:[~2013-02-04  1:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-02-03 23:57 [gentoo-python] [PATCH] Support python_get_library_path() Michał Górny
2013-02-04  1:14 ` [gentoo-python] " Mike Gilbert

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