From 262f6d3bc35ea6c82ece1641ae62dc8c142a0470 Mon Sep 17 00:00:00 2001 From: Miro Hrončok Date: Jul 16 2020 11:38:50 +0000 Subject: %pyproject_buildrequires -x now implies -r The usage without -r errored anyway, this way instead of forcing the user to add it, we do it ourselves. Machines stealing human's labor, yet again. --- diff --git a/README.md b/README.md index 78e806a..31b5634 100644 --- a/README.md +++ b/README.md @@ -55,7 +55,7 @@ For example, if upstream suggests installing test dependencies with `pip install mypackage[testing]`, the test deps would be generated by: %generate_buildrequires - %pyproject_buildrequires -r -x testing + %pyproject_buildrequires -x testing For projects that specify test requirements in their [tox] configuration, these can be added using the `-t` flag (default tox environment) @@ -79,11 +79,11 @@ Or specify more environments if needed: The `-e` option redefines `%{toxenv}` for further reuse. Use `%{default_toxenv}` to get the default value. -Note that `-t` implies `-r`, because tox normally assumes the package is installed -including all the runtime dependencies. - The `-t`/`-e` option uses [tox-current-env]'s `--print-deps-to-file` behind the scenes. +Note that both `-x` and `-t` imply `-r`, +because runtime dependencies are always required for testing. + [tox]: https://tox.readthedocs.io/ [tox-current-env]: https://github.com/fedora-python/tox-current-env/ diff --git a/pyproject-rpm-macros.spec b/pyproject-rpm-macros.spec index fe8f52d..a4fb99f 100644 --- a/pyproject-rpm-macros.spec +++ b/pyproject-rpm-macros.spec @@ -6,7 +6,7 @@ License: MIT # Keep the version at zero and increment only release Version: 0 -Release: 17%{?dist} +Release: 18%{?dist} # Macro files Source001: macros.pyproject @@ -101,6 +101,10 @@ export HOSTNAME="rpmbuild" # to speedup tox in network-less mock, see rhbz#1856 %license LICENSE %changelog +* Thu Jul 16 2020 Miro Hrončok - 0-18 +- %%pyproject_buildrequires -x (extras requires for tests) now implies -r + (runtime requires) instead of erroring without it for better UX. + * Wed Jul 15 2020 Miro Hrončok - 0-17 - Set HOSTNAME to prevent tox 3.17+ from a DNS query - Fixes rhbz#1856356 diff --git a/pyproject_buildrequires.py b/pyproject_buildrequires.py index fd05812..aaa245b 100644 --- a/pyproject_buildrequires.py +++ b/pyproject_buildrequires.py @@ -279,7 +279,8 @@ def main(argv): ) parser.add_argument( '-x', '--extras', metavar='EXTRAS', default='', - help='extra for runtime requirements (e.g. -x testing)', + help='extra for runtime requirements (e.g. -x testing) ' + '(implies --runtime)', # XXX: a comma-separated list should be possible here # help='comma separated list of "extras" for runtime requirements ' # + '(e.g. -x testing,feature-x)', @@ -295,9 +296,8 @@ def main(argv): args.toxenv = (args.toxenv or os.getenv('RPM_TOXENV') or f'py{sys.version_info.major}{sys.version_info.minor}') - if args.extras and not args.runtime: - print_err('-x (--extras) are only useful with -r (--runtime)') - exit(1) + if args.extras: + args.runtime = True try: generate_requires(