summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* python-utils-r1.eclass: pypy3 is now Python 3.9Michał Górny2022-04-211-3/+3
| | | | Signed-off-by: Michał Górny <mgorny@gentoo.org>
* python-utils-r1.eclass: Make python_fix_shebang force full pathMichał Górny2022-04-021-83/+51
| | | | | | | | | | | | | | | | | | | | | | Change the behavior of python_fix_shebang to always output full path to the Python interpreter (i.e. ${PYTHON}) instead of mangling the original path. Most importantly, this ensures that: 1. EPREFIX is included in the final path 2. /usr/bin/env is replaced by the absolute path to avoid issues when calling system executables from inside a venv Note that this implies that a few unlikely corner cases may stop working, notably: a. "weird" shebangs such as "/usr/bin/foo python" will no longer work b. the mangled scripts will escape temporary venv e.g. created in distutils-r1 PEP517 mode (python_fix_shebang is not used in such a way in ::gentoo) Signed-off-by: Michał Górny <mgorny@gentoo.org>
* *.eclass: @ECLASS-VARIABLE renamed to @ECLASS_VARIABLEUlrich Müller2022-03-241-5/+5
| | | | | Bug: https://bugs.gentoo.org/835396 Signed-off-by: Ulrich Müller <ulm@gentoo.org>
* python-utils-r1.eclass: Add a verbose python_has_version() wrapperMichał Górny2022-02-151-0/+42
| | | | | | | | | | | Add a python_has_version() wrapper for convenient use in python_check_deps(). It includes: - verbose output - default "-b" root that's more suitable for build-time checks - forward compatibility for -b/-d/-r arguments in EAPI 6 Signed-off-by: Michał Górny <mgorny@gentoo.org>
* python-utils-r1.eclass: Silence missing locale(1) errorMichał Górny2022-02-091-1/+1
| | | | | | | | | The python_export_utf8_locale() function checks for missing locale(1) and handles it gracefully. However, it does not redirect stderr probably, so systems without the executable (e.g. musl) get unintended console output. Redirect it to /dev/null. Signed-off-by: Michał Górny <mgorny@gentoo.org>
* python-utils-r1.eclass: Add QA check for obsolete PYTHON_COMPATMichał Górny2022-02-091-1/+17
| | | | | | | | Add a QA check that reports obsolete implementation in PYTHON_COMPAT if ebuild has been modified in 2022 (based on copyright year). Requested by sam. Signed-off-by: Michał Górny <mgorny@gentoo.org>
* python-utils-r1.eclass: Support matching impls by stdlib versionMichał Górny2022-02-091-4/+18
| | | | | | | | | | | | | | Update _python_impl_matches() (used to implement python_gen*, python_setup) to support specifying stdlib versions ("3.8", "3.9") in addition to exact implementation names. This makes handling PyPy3 version changes much easier when dealing with backports. For example, if you specify "3.8", then the spec will match python3_8 and pypy3, for as long as we supply PyPy3.8. Once we upgrade to PyPy3.9 completely, it will stop matching pypy3 and we won't have to manually keep updating these deps. Signed-off-by: Michał Górny <mgorny@gentoo.org>
* python-utils-r1.eclass: Add status messages to python_optimizeMichał Górny2022-02-091-0/+1
| | | | Signed-off-by: Michał Górny <mgorny@gentoo.org>
* python-utils-r1.eclass: Remove old phase check from python_optimizeMichał Górny2022-02-091-9/+0
| | | | Signed-off-by: Michał Górny <mgorny@gentoo.org>
* python-utils-r1.eclass: Use heredoc instead of "python -c"Michał Górny2022-02-091-5/+36
| | | | Signed-off-by: Michał Górny <mgorny@gentoo.org>
* python-utils-r1.eclass: Remove python_is_python3Michał Górny2022-02-091-17/+0
| | | | Signed-off-by: Michał Górny <mgorny@gentoo.org>
* python-utils-r1.eclass: Remove python_wrapper_setupMichał Górny2022-02-091-16/+0
| | | | Signed-off-by: Michał Górny <mgorny@gentoo.org>
* python-utils-r1.eclass: Remove deprecated python_exportMichał Górny2022-02-091-17/+0
| | | | | | | Remove python_export, as it is no longer used by any ebuilds in ::gentoo. Signed-off-by: Michał Górny <mgorny@gentoo.org>
* python-utils-r1.eclass: Fix sphinx_build for non-autodoc caseMichał Górny2022-02-091-4/+18
| | | | | | | | | | | | | | | | | | | Fix the regression in calling sphinx-build for the non-autodoc case that causes the build to fail if dev-python/sphinx isn't built for the newest Python interpreter available. To account for this, we need to call sphinx-build as an executable (i.e. via python-exec). Ideally, build_sphinx would be aware of which case it is used for, and use appropriate invocation. Unfortunately, we cannot do that without breaking backwards compatibility. However, we can simply check if Sphinx is available via ${EPYTHON}, and fall back to calling python-exec directly. This is effectively equivalent to choosing the specific invocation directly, as python-exec would have respected the implementation specified by EPYTHON anyway if sphinx-build executable was available for it. Fixes: f6a17acb8b7c (...: Run sphinx-build via EPYTHON) Signed-off-by: Michał Górny <mgorny@gentoo.org>
* python-utils-r1.eclass: Inline python_is_installedMichał Górny2022-02-091-19/+3
| | | | | | | | Inline the python_is_installed function that is used exactly once (in _python_run_check_deps). This helps us avoid having to grab PYTHON_PKG_DEP twice. Signed-off-by: Michał Górny <mgorny@gentoo.org>
* python-utils-r1.eclass: Report _python_run_check_deps verboselyMichał Górny2022-02-091-1/+9
| | | | | | | Report dep checking progress verbosely, to help users understand why a particular implementations was rejected or selected. Signed-off-by: Michał Górny <mgorny@gentoo.org>
* python-utils-r1.eclass: Add function to run python_check_deps()Michał Górny2022-02-091-0/+20
| | | | | | | Add a function encompassing the common logic to run python_check_deps() from python-any-r1 and python-r1. Signed-off-by: Michał Górny <mgorny@gentoo.org>
* eclass: Update links to Gentoo Python GuideMichał Górny2022-01-291-1/+1
| | | | Signed-off-by: Michał Górny <mgorny@gentoo.org>
* python-utils-r1.eclass: Make epytest disable plugins we don't wantMichał Górny2022-01-241-0/+8
| | | | | | | | | | | Make epytest explicitly disable unwanted plugins such as pytest-cov or pytest-flakes. We want the relevant options to be stripped out of pytest config files. However, when these packages are installed on the system, it's easy to miss them and then users (or tinderboxes) hit the failures first. Disabling the plugins explicitly forces them to fail immediately while testing. Signed-off-by: Michał Górny <mgorny@gentoo.org>
* python-utils-r1.eclass: Run sphinx-build via EPYTHONMichał Górny2022-01-201-1/+2
| | | | | | | | | Run sphinx-build via EPYTHON to ensure that the correct Python executable is being used. Otherwise, sphinx-build runs via /usr/bin/python* and does not respect the virtualenv boundaries. Closes: https://bugs.gentoo.org/831565 Signed-off-by: Michał Górny <mgorny@gentoo.org>
* python-utils-r1.eclass: epytest, force color output to match NOCOLORMichał Górny2022-01-131-0/+12
| | | | | | | | Force pytest color output on or off based on the presence and value of NOCOLOR envvar. This fixes inconsistent use of colors that largely depended on upstream pytest settings. Signed-off-by: Michał Górny <mgorny@gentoo.org>
* python-utils-r1.eclass: Bump minimal Python versionsMichał Górny2022-01-091-2/+8
| | | | | | | Bump minimal Python package versions to ensure that the python-exec deps are inside. Signed-off-by: Michał Górny <mgorny@gentoo.org>
* python-utils-r1.eclass: Bump min pypy3 dep to force pypy3.8Michał Górny2021-11-091-1/+1
| | | | Signed-off-by: Michał Górny <mgorny@gentoo.org>
* python-utils-r1.eclass: add and use _python_check_EPYTHONFlorian Schmaus2021-09-141-2/+12
| | | | Signed-off-by: Florian Schmaus <flow@gentoo.org>
* python-utils-r1.eclass: Handle deselect/ignore in epytestMichał Górny2021-08-151-2/+28
| | | | | | | | | | Support (potentially global-scope) EPYTEST_DESELECT and EPYTEST_IGNORE arrays to conveniently deselect/skip tests. This effectively replaces local hacks such as: epytest ${deselect[@]/#/--deselect } Signed-off-by: Michał Górny <mgorny@gentoo.org>
* python-utils-r1.eclass: Enable parallel bytecompile compilationMart Raudsepp2021-08-121-5/+8
| | | | | | | | | | Python 3.5 added support for compileall to run parallel workers for performing bytecode compilation. Make use of it to the extent possible without refactoring the code too much to get different paths into the same call for best possible parallelization. Signed-off-by: Mart Raudsepp <leio@gentoo.org> Signed-off-by: Michał Górny <mgorny@gentoo.org>
* python-utils-r1.eclass: Enable hardlinking of identical pyc files for py3.9+Mart Raudsepp2021-08-121-1/+4
| | | | | | | | | | Python 3.9 includes a new feature for compileall to automatically hardlink different optimization level cache files if they are identical. Make use of it for python_optimize for some space savings. This however does not cover distutils use cases and python itself. Signed-off-by: Mart Raudsepp <leio@gentoo.org> Signed-off-by: Michał Górny <mgorny@gentoo.org>
* python-utils-r1.eclass: Cleanup cache dirs after epytestMichał Górny2021-08-071-1/+6
| | | | | | | | | Make epytest clean up common cache directories .hypothesis and .pytest_cache after the execution. If pytest is executed in ${BUILD_DIR}/lib, these directories end up being wrongly installed, and so far ebuilds had to handle cleaning them up. Signed-off-by: Michał Górny <mgorny@gentoo.org>
* python-utils-r1.eclass: Pass -Wdefault to epytest to avoid -WerrorMichał Górny2021-07-021-0/+3
| | | | | | | | | | | | | | | Make pytest pass -Wdefault in order to override upstream default warning options that commonly include -Werror. This has often caused tests to start failing due to new deprecation warnings introduced in dependencies, or block new implementations due to harmless deprecation warnings. A side effect of this is that we are overriding all warning options used by upstream. This could e.g. cause more warnings to be reported (when upstream ignores some of them). This might also break badly written tests (e.g. when they rely on exceptions to catch warnings). Signed-off-by: Michał Górny <mgorny@gentoo.org>
* python-utils-r1.eclass: Remove _python_ln_relMichał Górny2021-06-291-40/+0
| | | | Signed-off-by: Michał Górny <mgorny@gentoo.org>
* Revert "python-utils-r1.eclass: Remove _python_ln_rel"Mike Gilbert2021-06-241-0/+40
| | | | | Reverts: 1f678a8cae66480493c43739435ec7feb85c08da Signed-off-by: Mike Gilbert <floppym@gentoo.org>
* python-utils-r1.eclass: Revert "Remove python_optimize support..."Michał Górny2021-06-241-2/+6
| | | | | | | | python_optimize is still used in dev-python/pypy. Reverts: 964f5c61816659b0138c8fe98593786d9da7f084 Closes: https://bugs.gentoo.org/798330 Signed-off-by: Michał Górny <mgorny@gentoo.org>
* python-utils-r1.eclass: Remove _python_ln_relMichał Górny2021-06-231-40/+0
| | | | Signed-off-by: Michał Górny <mgorny@gentoo.org>
* python-utils-r1.eclass: Enable EAPI 8Michał Górny2021-06-231-2/+2
| | | | Signed-off-by: Michał Górny <mgorny@gentoo.org>
* python-utils-r1.eclass: Fix python_fix_shebang for py3.10+Michał Górny2021-06-231-5/+7
| | | | | | We should be safe until Python 3.99 now ;-). Signed-off-by: Michał Górny <mgorny@gentoo.org>
* python-utils-r1.eclass: Deprecated and EAPI8-ban python_is_python3Michał Górny2021-06-231-0/+3
| | | | | | | There is no use for python_is_python3 anymore, as Python 2 is no longer supported at runtime and the remaining any-r1 uses are pure-2. Signed-off-by: Michał Górny <mgorny@gentoo.org>
* python-utils-r1.eclass: Ban py2 deps in python_gen* in EAPI 8Michał Górny2021-06-231-13/+26
| | | | | | | | Ban using -2 or python2* as an argument to python_gen_cond_dep and other functions using _python_impl_matches, in order to force cleaning up old entries, in EAPI 8. Signed-off-by: Michał Górny <mgorny@gentoo.org>
* python-utils-r1.eclass: Eliminate local python_is_python3 usesMichał Górny2021-06-231-10/+6
| | | | | | | | Do not use python_is_python3 in eclass functions to ease banning it. Except for wrapper setup that is still used in py2 any-r1 context, we can unconditionally assume Python 3 everywhere. Signed-off-by: Michał Górny <mgorny@gentoo.org>
* python-utils-r1.eclass: Rename *into vars to use underscoresMichał Górny2021-06-231-6/+6
| | | | | | | | Rename helper variables used by *into to mark them private with underscores. The old names are leftovers from deprecated API that permitted setting them directly. It was last used in ::gentoo in 2016. Signed-off-by: Michał Górny <mgorny@gentoo.org>
* python-utils-r1.eclass: Remove python_optimize support for py<3.5Michał Górny2021-06-231-6/+2
| | | | | | | | Remove the support code for Python 2.7, <3.5, as well as PyPy2.7. These are no longer supported at runtime, so byte-compiling should not be used for these impls. Signed-off-by: Michał Górny <mgorny@gentoo.org>
* python-utils-r1.eclass: Use 'dosym -r' in EAPI 8Michał Górny2021-06-231-2/+4
| | | | Signed-off-by: Michał Górny <mgorny@gentoo.org>
* python-utils-r1.eclass: Ban private API in EAPI 8Michał Górny2021-06-231-0/+4
| | | | Signed-off-by: Michał Górny <mgorny@gentoo.org>
* python-utils-r1.eclass: Disable python3_7Michał Górny2021-06-011-2/+2
| | | | Signed-off-by: Michał Górny <mgorny@gentoo.org>
* python-utils-r1.eclass: Grab paths from sysconfig moduleMichał Górny2021-05-121-5/+2
| | | | | | | | | Grab site-packages and includedir paths from sysconfig rather than distutils.sysconfig, as the latter module is deprecated. The new method results in the same paths for all supported implementations, as confirmed by the tests. Signed-off-by: Michał Górny <mgorny@gentoo.org>
* python-utils-r1.eclass: Add py3.10 to patternsMichał Górny2021-05-041-1/+1
| | | | Signed-off-by: Michał Górny <mgorny@gentoo.org>
* python-utils-r1.eclass: Enable python3_10Michał Górny2021-05-041-1/+1
| | | | Signed-off-by: Michał Górny <mgorny@gentoo.org>
* python-utils-r1.eclass: add note when dropping EAPI supportSam James2021-04-101-0/+3
| | | | | | | | | | | | | We need to remember to update metadata/install-qa-check.d/60python-pyc in future to disable now non-applicable QA checks. If we don't, we end up breaking older EAPI installs in general. See: 1137a7ecce67c48fc9a69ab320c6156c40366122 See: bdcfb21ca5a84567e9c9d6a456374a05e798f78e Bug: https://bugs.gentoo.org/704286 Bug: https://bugs.gentoo.org/781878 Signed-off-by: Sam James <sam@gentoo.org>
* python-utils-r1.eclass: Remove support for EAPIs prior to 6Michał Górny2021-04-091-33/+13
| | | | Signed-off-by: Michał Górny <mgorny@gentoo.org>
* python-utils-r1.eclass: Include -l in epytestMichał Górny2021-04-091-1/+10
| | | | | | | Add '-l' to epytest, in order to improve tracebacks by including the values of local variables. Signed-off-by: Michał Górny <mgorny@gentoo.org>
* python-utils-r1.eclass: Add eunittest helperMichał Górny2021-03-281-0/+23
| | | | | | | | | | | Add an eunittest helper to wrap up the common 'python -m unittest discover' calls, except that they are run via dev-python/unittest-or-fail now. This guarantees that if no tests are discovered the test phase fails rather than silently ignoring the problem. This is especially helpful since it saves the developer from having to inspect test phase logs. Signed-off-by: Michał Górny <mgorny@gentoo.org>