Commit Graph
60 Commits
Author SHA1 Message Date
Michał Górny 65a8abba1c python-utils-r1.eclass: _python_impl_matches, handle both forms of impl
Make the pattern matching code in _python_impl_matches() more lax,
allowing (accidental) mixing of PYTHON_COMPAT-style values with
EPYTHON-style values. This is trivial to do, and solves the problem
introduced by complexity-by-limitation of other eclasses -- where
patterns for dependency strings are using PYTHON_COMPAT syntax,
and patterns for python_setup are using EPYTHON syntax.
2017-05-29 23:53:27 +02:00
Mike Frysinger d1b05bcf81 python-utils-r1.eclass: add more info to stub python wrappers
The short terse error messages here are not easy to track down.  Add
a few more details so people can figure out what's going wrong faster.
2017-05-16 15:10:31 -04:00
Zac Medico be5d7fe2ce python-utils-r1.eclass: support PYTHON_COMPAT_NO_STRICT variable
This is intended to be set by the user when using ebuilds that may
have unknown implementations in PYTHON_COMPAT. The assumption is
that the ebuilds are intended to be used within multiple contexts
which can involve revisions of this eclass that support different
Python implementations.
2017-05-16 19:18:03 +02:00
Michał Górny 392ff44ddb python-utils-r1.eclass: Allow -2/-3 as impl-patterns for py2/py3
Allow two special values in the implementation patterns for
_python_impl_matches(): -2 to indicate all Python 2-compatible
implementations, and -3 to indicate all Python 3-compatible
implementations. Both of those values are implemented using
the python_is_python3 function.

This is mostly meant to make it easier and more fool-proof to write
dependencies on backports to Python 2 which in most cases apply to PyPy2
as well.
2017-05-16 19:11:37 +02:00
Michał Górny 0cfab505ad python-utils-r1.eclass: _python_impl_matches for impl-pattern matching
Introduce a _python_impl_matches() function that commonizes the pattern
matching behavior used throughout python-r1 & python-single-r1. Having
a single implementation makes future extensions much easier.
2017-05-16 19:11:32 +02:00
Michał Górny 9ef5498e91 python-utils-r1.eclass: python_moduleinto, allow package dot-notation
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.
2017-05-16 19:11:31 +02:00
Michał Górny 0fcdbe8b3c python-utils-r1.eclass: python_moduleinto, clarify relative path use
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.
2017-05-16 19:11:30 +02:00
Michał Górny d3ef3eb324 python-utils-r1.eclass: Remove stray old doc bit
Remove the bit of old python_moduleinto documentation that has been
accidentally left over.
2017-05-16 19:11:30 +02:00
Michał Górny b7648fc3e5 python-utils-r1.eclass: python_optimize, enable py3.5 logic for pypy3
Enable the three-level optimization logic for pypy3, to account for
pypy3-5.7 being based on CPython 3.5 and using all three suffixes.
2017-04-30 21:22:05 +02:00
Michał Górny 6a59098618 python-utils-r1.eclass: python_wrapper_setup, do not query PYTHON_CONFIG
Use plain 'pythonX.Y-config' executable name in the python-config
wrapper instead of querying the complete PYTHON_CONFIG path from
python_export.

Constructing full PYTHON_CONFIG path requires querying ABIFLAGS which
requires the Python interpreter to be installed, which in turn
unnecessarily forces every ebuild using the eclass to carry a build-time
dependency on the Python interpreter.

All current versions of Python correctly install 'pythonX.Y-config'
symlink that points to the correct ABI-suffixed binary. It is therefore
unnecessary to use the full path.
2017-04-25 19:57:56 +02:00
Justin Lecher 7131191b36 Drop trailing whitespaces
Signed-off-by: Justin Lecher <jlec@gentoo.org>
2017-03-19 10:25:23 +00:00
Michał Górny d2fb3f82e9 python-utils-r1.eclass: _python_set_impls, add integrity check
Add integrity check for multi-inherits, i.e. ensure that PYTHON_COMPAT
has not changed between successive calls to _python_set_impls. If it did
(e.g. because of eclass+ebuild setting different values), then we abort
not to give surprising results to the user.
2017-03-08 08:35:43 +01:00
Michał Górny 2980579f58 python-utils-r1.eclass: _python_set_impls, use local vars
Refactor _python_set_impls to use local variables throughout
the function and assign global values at the end. This prepares it for
double-inherit integrity checks. NFC.
2017-03-08 08:35:42 +01:00
Michał Górny ce87e4f32b python-utils-r1.eclass: python_wrapper_setup, fix exporting env
Fix python_wrapper_setup function to move setting environment variables
for PATH and PKG_CONFIG_PATH outside the 'if'. Otherwise, they are only
set on the initial invocation of python_wrapper_setup for the particular
impl and do not apply to subsequent invocations (e.g. further
distutils-r1 phases).
2017-03-08 08:35:39 +01:00
Robin H. Johnson 61b861acd7 Drop $Id$ per council decision in bug #611234.
Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
2017-02-28 11:50:50 -08:00
Michał Górny 5167eca390 python-utils-r1.eclass: Require pypy{,3} >= 5, #609292
Bump the dependency on PyPy to require relatively recent versions, to
ease package maintenance.
2017-02-17 12:44:36 +01:00
Michał Górny 3a4ccfe59e python-utils-r1.eclass: Enable python3_6 target 2017-01-25 23:57:04 +01:00
Mike Gilbert 4e62500200 python-utils-r1.eclass: drop support for python3_3 2016-10-27 21:33:22 -04:00
Mike Gilbert 7db89b8b90 python-utils-r1.eclass: try C.UTF-8 and en_GB.UTF-8 in python_export_utf8_locale 2016-09-23 21:02:59 -04:00
Mike Gilbert 78220396ef python-utils-r1.eclass: override LC_ALL in _python_check_locale_sanity 2016-09-23 20:56:09 -04:00
Michał Górny 4fe3143d16 python-utils-r1.eclass: Add additional .opt-1 compilation for py3.5+ 2016-06-06 21:40:30 +02:00
Michał Górny 407fc9d6b5 python-utils-r1.eclass: python_wrapper_setup, fix pythonN-config cleanup 2016-05-15 11:05:25 +02:00
Michał Górny 533225b574 python-utils-r1.eclass: Make python_{script,module}root vars private
Remove python_scriptroot & python_moduleroot from the public eclass API,
in favor of calls to python_scriptinto and python_moduleinto. This
feature was seldom used, not listed in the official API guide,
and the *into functions is more in line with the PMS.
2016-05-14 09:19:57 +02:00
Michał Górny ab2b94cf38 python-utils-r1.eclass: stop respecting DESTTREE in python_do*/new*
Replace the code respecting current value of ${DESTTREE} in favor of
using /usr unconditionally. The feature was extremely unlikely to be
ever used (only if you did 'into ...; python_do*', quite confusing
and relied on semi-internal package manager variables.

Furthermore, it was potentially broken as it relied on DESTTREE having
an initial '/usr' value which is not warranted by the PMS.
2016-05-14 09:19:57 +02:00
Michał Górny ab6a4a2f53 python-utils-r1.eclass: Do not prefer Jython & PyPy over CPython
Fix _PYTHON_ALL_IMPLS to list Jython & PyPy before CPython versions,
therefore causing them not to be implicitly preferred over CPython.

The implementation reordering done in b284e54 ("reorder implementations
in semi-ascending order") has caused PyPy & Jython to be listed after
CPython. While seemingly it was more intuitive to list third-party
implementations after the reference one, it also implicitly caused them
to be preferred by python-exec.
2016-02-06 22:27:31 +01:00
Michał Górny 33380ad5e1 python*-r1.eclass: Commonize PYTHON_COMPAT processing, cache the result
Introduce a common _python_set_impls function in python-utils-r1.eclass
that validates and processes PYTHON_COMPAT, then stores the result in
_PYTHON_SUPPORTED_IMPLS and _PYTHON_UNSUPPORTED_IMPLS variables. Reuse
those variables in all python-r1 suite eclasses, effectively reducing
code duplication and providing cache for repeated implementation support
checks.
2015-12-22 23:12:23 +01:00
Michał Górny 01e902405d python*-r1.eclass: Replace non-portable use of 'declare -g'
Replace uses of 'declare -g -r' (bash-4.2+) with 'readonly'. Reported
by Arfrever. This time use split assignments followed by readonly calls
since combined calls work unreliably.
2015-12-11 23:42:33 +01:00
Mike Gilbert d296b5daa5 Revert "python*-r1.eclass: Replace non-portable use of 'declare -g'"
This reverts commit 44d3345d82.

This was triggering "No supported implementation in PYTHON_COMPAT.".
2015-12-11 17:26:44 -05:00
Michał Górny 44d3345d82 python*-r1.eclass: Replace non-portable use of 'declare -g'
Replace uses of 'declare -g -r' (bash-4.2+) with 'readonly'. Reported
by Arfrever.
2015-12-11 22:27:19 +01:00
Michał Górny f16b1c0b53 python-utils-r1.eclass: Disable jython2_5 2015-12-09 21:41:16 +01:00
Michał Górny b284e54e19 python-utils-r1.eclass: Reorder implementations to semi-ascending order
Reorder the Python implementations to ascending version order, with
CPython listed first and other implementations in descending preference.

The previous ordering has been used for two reasons:

1. There were packages which supported Python 3.x or PyPy partially but
their documentation builds or test functions required CPython 2.x.
The specific ordering caused python_export_best (the predecessor of
python_setup) to use CPython 2.x for those tasks. This is now replaced
by explicit implementation restrictions in python_setup.

2. PyPy setup runs were usually slower than CPython, and CPython 3.x
runs were often slower due to 2to3 calls. Combined with parallel build
runs, this ordering caused slower builds to start earlier and sometimes
resulted in more efficient use of threads. However, nowadays we no
longer do parallel builds.

Therefore, it seems reasonable to finally reorder the implementations
into a more intuitive order.
2015-12-09 21:41:16 +01:00
Michał Górny 8d08aef9ec python-utils-r1.eclass: Mark _PYTHON_ALL_IMPLS read-only 2015-12-09 21:41:16 +01:00
Mike Gilbert f946bebc3f python-utils-r1.eclass: Change python_export_utf8_locale to deal with LC_ALL=C
Paludis sets LC_ALL=C to ensure a 'sane' build environment.
We only want to override LC_CTYPE, so we break LC_ALL into separate
LC_* overrides and set LC_ALL to blank.
2015-12-03 11:43:44 -05:00
Michał Górny 283da8a1e1 python-utils-r1.eclass: _python_check_locale_sanity, fix quoting issue 2015-11-30 14:29:23 +01:00
Michał Górny 5f35965531 python-utils-r1.eclass: Reduce python_do*/new* ban to EAPI < 4
Fix python_do* and python_new* helper ban to EAPIs older than 4. That
was the original intent, and restricting it to 5+ breaks old
dev-lang/python ebuilds.
2015-11-29 09:19:16 +01:00
Michał Górny 36ca742396 python-utils-r1.eclass: Enable EAPI 6 2015-11-28 20:09:06 +01:00
Michał Górny 6a0597dada python-utils-r1.eclass: Make heredocs consistent 2015-11-28 20:09:06 +01:00
Michał Górny e67a293e26 python-utils-r1.eclass: Support nonfatal in python_do* and python_new* 2015-11-28 20:09:06 +01:00
Michał Górny 991e139992 python-utils-r1.eclass: Remove unneeded multilib inherit in EAPI 6 2015-11-28 20:09:06 +01:00
Michał Górny 9e00927e4e python-utils-r1.eclass: Make python_fix_shebang QAwarns fatal in EAPI 6 2015-11-28 20:09:06 +01:00
Michał Górny a2c3f26426 python-utils-r1.eclass: Ban installation helpers in EAPIs < 5
Ban python_do* and python_new* helpers in EAPIs older than 5. We should
ban them in python-any-r1 uses, actually but that would break
dev-python/pypy* ebuilds as they are written now.
2015-11-28 20:09:06 +01:00
Michał Górny 0951efe8cb python-utils-r1.eclass: Replace local INSDESTTREE with subshells
Replace the 'local INSDESTTREE' hacks (which are PMS-valid yet
deprecated) with safer subshells.
2015-11-28 20:09:06 +01:00
Michał Górny 2421e06b05 python-utils-r1.eclass: Remove py2.6 note from python_optimize 2015-11-28 20:09:06 +01:00
Michał Górny 64f62e4bfa python-utils-r1.eclass: python_fix_shebang, accept symlink as parameter
Add '-H' option to find to allow following symlinks passed as
parameters. This makes python_fix_shebang handle either file symlinks
passed directly, or directory symlinks passed directly for recursive
traversal. Both were currently ignored silently.
2015-11-28 20:09:06 +01:00
Michał Górny a3853d54e9 python-utils-r1.eclass: Add missing ||die on file read 2015-11-28 20:09:06 +01:00
Michał Górny de298a8cdc python-utils-r1.eclass: Add missing ||die on 'cat' file writes 2015-11-28 20:09:06 +01:00
Michał Górny 2a39ec2a3d python-utils-r1.eclass: Add missing ||die for external getters 2015-11-28 20:09:06 +01:00
Michał Górny 09475a2f59 python-utils-r1.eclass: python_export_utf8_locale(), ensure sane locale
Ensure that the locale selected by python_export_utf8_locale() conforms
to POSIX-ish case conversions. Otherwise, we may accidentally force
a locale that will break random ebuilds and programs.
2015-11-28 20:09:06 +01:00
Michał Górny a3535feb5a python-utils-r1.eclass: python_export(), always respect PYTHON
Respect pre-set PYTHON in python_export(), unless a new value is
requested. Bail out if PYTHON is neither set, nor requested.
2015-11-12 17:03:16 +01:00
Michał Górny 59e7fab60e python-utils-r1.eclass: wrapper, PYTHON_CONFIG is valid only for CPython 2015-11-11 13:21:21 +01:00