mirror of
https://github.com/fedora-python/tox-current-env.git
synced 2024-12-24 00:56:16 +01:00
hooks: implement custom tox_runenvreport without a pip dependency
This gets rid of the pip dependency, undesirable in some cases. Signed-off-by: Filipe Laíns <lains@archlinux.org>
This commit is contained in:
parent
e3e6de27ba
commit
aca2fb563b
1
setup.py
1
setup.py
@ -24,6 +24,7 @@ setup(
|
||||
# but the one downloaded from PyPI isn't and it doesn't work properly.
|
||||
"tox>=3.15; python_version >= '3.8'",
|
||||
"tox>=3.13; python_version < '3.8'",
|
||||
"importlib_metadata; python_version < '3.8'"
|
||||
],
|
||||
python_requires=">=3.6",
|
||||
classifiers=[
|
||||
|
@ -4,6 +4,11 @@ import subprocess
|
||||
import sys
|
||||
import tox
|
||||
|
||||
try:
|
||||
import importlib.metadata as importlib_metadata
|
||||
except ImportError:
|
||||
import importlib_metadata
|
||||
|
||||
|
||||
@tox.hookimpl
|
||||
def tox_addoption(parser):
|
||||
@ -185,3 +190,13 @@ def tox_cleanup(session):
|
||||
for venv in session.venv_dict.values():
|
||||
if is_current_env_link(venv):
|
||||
rm_venv(venv)
|
||||
|
||||
|
||||
@tox.hookimpl
|
||||
def tox_runenvreport(venv, action):
|
||||
if not venv.envconfig.config.option.current_env:
|
||||
return None
|
||||
return (
|
||||
"{}=={}".format(d.metadata.get("name"), d.version)
|
||||
for d in importlib_metadata.distributions()
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user