Date: Friday, April 21, 2023 @ 18:13:32
Author: arojas
Revision: 1448181
archrelease: copy trunk to community-staging-any
Added:
python-nox/repos/community-staging-any/41387eda.patch
(from rev 1448180, python-nox/trunk/41387eda.patch)
python-nox/repos/community-staging-any/PKGBUILD
(from rev 1448180, python-nox/trunk/PKGBUILD)
Deleted:
python-nox/repos/community-staging-any/PKGBUILD
----------------+
41387eda.patch | 164 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
PKGBUILD | 79 +++++++++++++-------------
2 files changed, 204 insertions(+), 39 deletions(-)
Copied: python-nox/repos/community-staging-any/41387eda.patch (from rev
1448180, python-nox/trunk/41387eda.patch)
===================================================================
--- 41387eda.patch (rev 0)
+++ 41387eda.patch 2023-04-21 18:13:32 UTC (rev 1448181)
@@ -0,0 +1,164 @@
+From 41387eda390183ed390f5a9e612cb0d47f68628e Mon Sep 17 00:00:00 2001
+From: Lumir Balhar <[email protected]>
+Date: Mon, 20 Feb 2023 15:26:06 +0100
+Subject: [PATCH] to_to_nox implementation for tox 4
+
+---
+ nox/tox4_to_nox.jinja2 | 33 +++++++++++++++++
+ nox/tox_to_nox.py | 84 ++++++++++++++++++++++++++++++++++++++----
+ pyproject.toml | 2 +-
+ 3 files changed, 110 insertions(+), 9 deletions(-)
+ create mode 100644 nox/tox4_to_nox.jinja2
+
+diff --git a/nox/tox4_to_nox.jinja2 b/nox/tox4_to_nox.jinja2
+new file mode 100644
+index 00000000..e5a67d9b
+--- /dev/null
++++ b/nox/tox4_to_nox.jinja2
+@@ -0,0 +1,33 @@
++import nox
++
++{% for envname, envconfig in config.items()|sort: %}
[email protected]({%- if envconfig.base_python
%}python='{{envconfig.base_python}}'{%- endif %})
++def {{fixname(envname)}}(session):
++ {%- if envconfig.description != '' %}
++ """{{envconfig.description}}"""
++ {%- endif %}
++ {%- set envs = envconfig.get('set_env', {}) -%}
++ {%- for key, value in envs.items()|sort: %}
++ session.env['{{key}}'] = '{{value}}'
++ {%- endfor %}
++
++ {%- if envconfig.deps %}
++ session.install({{envconfig.deps}})
++ {%- endif %}
++
++ {%- if not envconfig.skip_install %}
++ {%- if envconfig.use_develop %}
++ session.install('-e', '.')
++ {%- else %}
++ session.install('.')
++ {%- endif -%}
++ {%- endif %}
++
++ {%- if envconfig.change_dir %}
++ session.chdir('{{envconfig.change_dir}}')
++ {%- endif %}
++
++ {%- for command in envconfig.commands %}
++ session.run({{command}})
++ {%- endfor %}
++{% endfor %}
+diff --git a/nox/tox_to_nox.py b/nox/tox_to_nox.py
+index a6591b4b..26b0146c 100644
+--- a/nox/tox_to_nox.py
++++ b/nox/tox_to_nox.py
+@@ -17,24 +17,38 @@
+ from __future__ import annotations
+
+ import argparse
++import os
+ import pkgutil
+-from typing import Any, Iterator
++import re
++from configparser import ConfigParser
++from pathlib import Path
++from subprocess import check_output
++from typing import Any, Iterable
+
+ import jinja2
+ import tox.config
++from tox import __version__ as TOX_VERSION
+
+-_TEMPLATE = jinja2.Template(
+- pkgutil.get_data(__name__, "tox_to_nox.jinja2").decode("utf-8"), # type:
ignore[union-attr]
+- extensions=["jinja2.ext.do"],
+-)
++TOX4 = TOX_VERSION[0] == "4"
+
++if TOX4:
++ _TEMPLATE = jinja2.Template(
++ pkgutil.get_data(__name__, "tox4_to_nox.jinja2").decode("utf-8"), #
type: ignore[union-attr]
++ extensions=["jinja2.ext.do"],
++ )
++else:
++ _TEMPLATE = jinja2.Template(
++ pkgutil.get_data(__name__, "tox_to_nox.jinja2").decode("utf-8"), #
type: ignore[union-attr]
++ extensions=["jinja2.ext.do"],
++ )
+
+-def wrapjoin(seq: Iterator[Any]) -> str:
++
++def wrapjoin(seq: Iterable[Any]) -> str:
+ return ", ".join([f"'{item}'" for item in seq])
+
+
+ def fixname(envname: str) -> str:
+- envname = envname.replace("-", "_")
++ envname = envname.replace("-", "_").replace("testenv:", "")
+ if not envname.isidentifier():
+ print(
+ f"Environment {envname!r} is not a valid nox session name.\n"
+@@ -49,7 +63,61 @@ def main() -> None:
+
+ args = parser.parse_args()
+
+- config = tox.config.parseconfig([])
++ if TOX4:
++ output = check_output(["tox", "config"], text=True)
++ original_config = ConfigParser()
++ original_config.read_string(output)
++ config: dict[str, dict[str, Any]] = {}
++
++ for name, section in original_config.items():
++ if name == "DEFAULT":
++ continue
++
++ config[name] = dict(section)
++ # Convert set_env from string to dict
++ set_env = {}
++ for var in section.get("set_env", "").strip().splitlines():
++ k, v = var.split("=")
++ if k not in (
++ "PYTHONHASHSEED",
++ "PIP_DISABLE_PIP_VERSION_CHECK",
++ "PYTHONIOENCODING",
++ ):
++ set_env[k] = v
++
++ config[name]["set_env"] = set_env
++
++ config[name]["commands"] = [
++ wrapjoin(c.split()) for c in
section["commands"].strip().splitlines()
++ ]
++
++ config[name]["deps"] =
wrapjoin(section["deps"].strip().splitlines())
++
++ for option in "skip_install", "use_develop":
++ if section.get(option):
++ if section[option] == "False":
++ config[name][option] = False
++ else:
++ config[name][option] = True
++
++ if os.path.isabs(section["base_python"]) or re.match(
++ r"py\d+", section["base_python"]
++ ):
++ impl = (
++ "python" if section["py_impl"] == "cpython" else
section["py_impl"]
++ )
++ config[name]["base_python"] = impl + section["py_dot_ver"]
++
++ change_dir = Path(section.get("change_dir"))
++ rel_to_cwd = change_dir.relative_to(Path.cwd())
++ if str(rel_to_cwd) == ".":
++ config[name]["change_dir"] = None
++ else:
++ config[name]["change_dir"] = rel_to_cwd
++
++ else:
++ config = tox.config.parseconfig([])
++
+ output = _TEMPLATE.render(config=config, wrapjoin=wrapjoin,
fixname=fixname)
+
+ with open(args.output, "w") as outfile:
Deleted: PKGBUILD
===================================================================
--- PKGBUILD 2023-04-21 18:13:21 UTC (rev 1448180)
+++ PKGBUILD 2023-04-21 18:13:32 UTC (rev 1448181)
@@ -1,39 +0,0 @@
-# Maintainer: Filipe Laíns (FFY00) <[email protected]>
-
-_pkgname=nox
-pkgname=python-$_pkgname
-pkgver=2022.8.7
-pkgrel=2
-pkgdesc='Flexible test automation for Python'
-arch=('any')
-url='https://github.com/wntrblm/nox'
-license=('Apache')
-depends=('python' 'python-argcomplete' 'python-colorlog' 'python-py'
'python-virtualenv' 'python-packaging')
-optdepends=('python-jinja: tox_to_nox'
- 'python-tox: tox_to_nox')
-makedepends=('python-build' 'python-installer' 'python-setuptools'
'python-wheel')
-checkdepends=('python-pytest-runner' 'python-jinja' 'python-tox')
-source=("$pkgname-$pkgver.tar.gz::$url/archive/$pkgver.tar.gz")
-sha512sums=('53a66964a99fff6f9f72ebe3dafc6fb52188f0af7f7c4fab1eaa5f35e8c641532477636303050d059825a505492e718cb915a2d6d9a9062bec4d6a0c85931205')
-
-build() {
- cd $_pkgname-$pkgver
-
- python -m build -nw
-}
-
-check() {
- cd $_pkgname-$pkgver
-
- python -m pytest
-}
-
-package() {
- cd $_pkgname-$pkgver
-
- python -m installer -d "$pkgdir" dist/*.whl
-
- install -Dm 644 LICENSE "$pkgdir"/usr/share/licenses/$pkgname/LICENSE
-}
-
-# vim:set ts=2 sw=2 et:
Copied: python-nox/repos/community-staging-any/PKGBUILD (from rev 1448180,
python-nox/trunk/PKGBUILD)
===================================================================
--- PKGBUILD (rev 0)
+++ PKGBUILD 2023-04-21 18:13:32 UTC (rev 1448181)
@@ -0,0 +1,40 @@
+# Maintainer: Filipe Laíns (FFY00) <[email protected]>
+
+_pkgname=nox
+pkgname=python-$_pkgname
+pkgver=2022.11.21
+pkgrel=2
+pkgdesc='Flexible test automation for Python'
+arch=('any')
+url='https://github.com/wntrblm/nox'
+license=('Apache')
+depends=('python' 'python-argcomplete' 'python-colorlog' 'python-py'
'python-virtualenv' 'python-packaging')
+optdepends=('python-jinja: tox_to_nox'
+ 'python-tox: tox_to_nox')
+makedepends=('python-build' 'python-installer' 'python-setuptools'
'python-wheel')
+checkdepends=('python-pytest-runner' 'python-jinja' 'python-tox')
+source=("$pkgname-$pkgver.tar.gz::$url/archive/$pkgver.tar.gz")
+sha512sums=('7f725425acd7d1ef55e04c5330c1f4fd2f2f5107c24b4bb7f7e2711cf6a5c1b8f2777a4902ee31d4a56898a953f3da6a9ed340d652fbc63cba33f5f763702b78')
+
+build() {
+ cd $_pkgname-$pkgver
+
+ python -m build -nw
+}
+
+check() {
+ cd $_pkgname-$pkgver
+
+# tox 4 isn't supported https://github.com/wntrblm/nox/issues/673
+ python -m pytest -k 'not test_tox_to_nox'
+}
+
+package() {
+ cd $_pkgname-$pkgver
+
+ python -m installer -d "$pkgdir" dist/*.whl
+
+ install -Dm 644 LICENSE "$pkgdir"/usr/share/licenses/$pkgname/LICENSE
+}
+
+# vim:set ts=2 sw=2 et: