mirror of
https://github.com/squidfunk/mkdocs-material.git
synced 2024-11-28 01:10:58 +01:00
Removed pipdeptree dependency for info plugin
This commit is contained in:
parent
0de33b3d72
commit
7f0d6e899d
@ -24,10 +24,6 @@ import os
|
|||||||
import platform
|
import platform
|
||||||
import requests
|
import requests
|
||||||
import sys
|
import sys
|
||||||
import warnings
|
|
||||||
|
|
||||||
# Silence deprecation warnings coming from pip
|
|
||||||
warnings.filterwarnings("ignore", category = DeprecationWarning)
|
|
||||||
|
|
||||||
from colorama import Fore, Style
|
from colorama import Fore, Style
|
||||||
from io import BytesIO
|
from io import BytesIO
|
||||||
@ -37,8 +33,7 @@ from mkdocs.config import config_options as opt
|
|||||||
from mkdocs.config.base import Config
|
from mkdocs.config.base import Config
|
||||||
from mkdocs.plugins import BasePlugin, event_priority
|
from mkdocs.plugins import BasePlugin, event_priority
|
||||||
from mkdocs.structure.files import get_files
|
from mkdocs.structure.files import get_files
|
||||||
from pkg_resources import get_distribution
|
from pkg_resources import get_distribution, working_set
|
||||||
from pipdeptree import PackageDAG, get_installed_distributions, render_json_tree
|
|
||||||
from zipfile import ZipFile, ZIP_DEFLATED
|
from zipfile import ZipFile, ZIP_DEFLATED
|
||||||
|
|
||||||
# -----------------------------------------------------------------------------
|
# -----------------------------------------------------------------------------
|
||||||
@ -112,17 +107,17 @@ class InfoPlugin(BasePlugin[InfoPluginConfig]):
|
|||||||
path = os.path.relpath(file.abs_src_path, os.path.curdir)
|
path = os.path.relpath(file.abs_src_path, os.path.curdir)
|
||||||
f.write(path, os.path.join(archive_name, path))
|
f.write(path, os.path.join(archive_name, path))
|
||||||
|
|
||||||
# Add information on packages
|
# Add information on installed packages
|
||||||
f.writestr(
|
f.writestr(
|
||||||
os.path.join(archive_name, ".packages.json"),
|
os.path.join(archive_name, "requirements.lock.txt"),
|
||||||
render_json_tree(PackageDAG.from_pkgs(
|
"\n".join(sorted([
|
||||||
get_installed_distributions(local_only = True)
|
f"{dist.as_requirement()}" for dist in working_set
|
||||||
), 2)
|
]))
|
||||||
)
|
)
|
||||||
|
|
||||||
# Add information in platform
|
# Add information in platform
|
||||||
f.writestr(
|
f.writestr(
|
||||||
os.path.join(archive_name, ".platform.json"),
|
os.path.join(archive_name, "platform.json"),
|
||||||
json.dumps(
|
json.dumps(
|
||||||
{
|
{
|
||||||
"system": platform.platform(),
|
"system": platform.platform(),
|
||||||
|
@ -28,6 +28,5 @@ pymdown-extensions>=9.9
|
|||||||
|
|
||||||
# Requirements for plugins
|
# Requirements for plugins
|
||||||
colorama>=0.4
|
colorama>=0.4
|
||||||
pipdeptree>=2.3
|
|
||||||
regex>=2022.4.24
|
regex>=2022.4.24
|
||||||
requests>=2.26
|
requests>=2.26
|
||||||
|
@ -24,10 +24,6 @@ import os
|
|||||||
import platform
|
import platform
|
||||||
import requests
|
import requests
|
||||||
import sys
|
import sys
|
||||||
import warnings
|
|
||||||
|
|
||||||
# Silence deprecation warnings coming from pip
|
|
||||||
warnings.filterwarnings("ignore", category = DeprecationWarning)
|
|
||||||
|
|
||||||
from colorama import Fore, Style
|
from colorama import Fore, Style
|
||||||
from io import BytesIO
|
from io import BytesIO
|
||||||
@ -37,8 +33,7 @@ from mkdocs.config import config_options as opt
|
|||||||
from mkdocs.config.base import Config
|
from mkdocs.config.base import Config
|
||||||
from mkdocs.plugins import BasePlugin, event_priority
|
from mkdocs.plugins import BasePlugin, event_priority
|
||||||
from mkdocs.structure.files import get_files
|
from mkdocs.structure.files import get_files
|
||||||
from pkg_resources import get_distribution
|
from pkg_resources import get_distribution, working_set
|
||||||
from pipdeptree import PackageDAG, get_installed_distributions, render_json_tree
|
|
||||||
from zipfile import ZipFile, ZIP_DEFLATED
|
from zipfile import ZipFile, ZIP_DEFLATED
|
||||||
|
|
||||||
# -----------------------------------------------------------------------------
|
# -----------------------------------------------------------------------------
|
||||||
@ -112,17 +107,17 @@ class InfoPlugin(BasePlugin[InfoPluginConfig]):
|
|||||||
path = os.path.relpath(file.abs_src_path, os.path.curdir)
|
path = os.path.relpath(file.abs_src_path, os.path.curdir)
|
||||||
f.write(path, os.path.join(archive_name, path))
|
f.write(path, os.path.join(archive_name, path))
|
||||||
|
|
||||||
# Add information on packages
|
# Add information on installed packages
|
||||||
f.writestr(
|
f.writestr(
|
||||||
os.path.join(archive_name, ".packages.json"),
|
os.path.join(archive_name, "requirements.lock.txt"),
|
||||||
render_json_tree(PackageDAG.from_pkgs(
|
"\n".join(sorted([
|
||||||
get_installed_distributions(local_only = True)
|
f"{dist.as_requirement()}" for dist in working_set
|
||||||
), 2)
|
]))
|
||||||
)
|
)
|
||||||
|
|
||||||
# Add information in platform
|
# Add information in platform
|
||||||
f.writestr(
|
f.writestr(
|
||||||
os.path.join(archive_name, ".platform.json"),
|
os.path.join(archive_name, "platform.json"),
|
||||||
json.dumps(
|
json.dumps(
|
||||||
{
|
{
|
||||||
"system": platform.platform(),
|
"system": platform.platform(),
|
||||||
|
Loading…
Reference in New Issue
Block a user