mirror of
https://github.com/fedora-python/tox-current-env.git
synced 2025-11-24 03:08:58 +01:00
Support report of installed packages in CI (#64)
* Support report of installed packages in CI Fixes: https://github.com/fedora-python/tox-current-env/issues/63 Co-authored-by: Miro Hrončok <miro@hroncok.cz>
This commit is contained in:
committed by
GitHub
parent
bf900a5c7c
commit
daf3872164
@@ -15,6 +15,11 @@ from tox.plugin import impl
|
||||
from tox.tox_env.python.api import PythonInfo
|
||||
from tox.tox_env.python.runner import PythonRun
|
||||
|
||||
try:
|
||||
import importlib.metadata as importlib_metadata
|
||||
except ImportError:
|
||||
import importlib_metadata
|
||||
|
||||
|
||||
@impl
|
||||
def tox_register_tox_env(register):
|
||||
@@ -106,6 +111,15 @@ class Installer:
|
||||
def install(self, *args, **kwargs):
|
||||
return None
|
||||
|
||||
def installed(self):
|
||||
"""Return list of installed packages like `pip freeze`."""
|
||||
return [
|
||||
"{}=={}".format(d.metadata.get("name"), d.version)
|
||||
for d in sorted(
|
||||
importlib_metadata.distributions(), key=lambda d: d.metadata.get("name")
|
||||
)
|
||||
]
|
||||
|
||||
|
||||
class CurrentEnvLocalSubProcessExecutor(Execute):
|
||||
def build_instance(
|
||||
|
||||
Reference in New Issue
Block a user