Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resolve pkg_resources deprecation warning #570

Merged
merged 1 commit into from
Nov 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions canu/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@
# OTHER DEALINGS IN THE SOFTWARE.
"""CANU (CSM Automatic Network Utility) floats through a Shasta network and makes setup and config breeze."""
from collections import defaultdict
from importlib import metadata
import json
from os import environ, getenv, path
import sys

import certifi
import click
import pkg_resources
import requests
from ruamel.yaml import YAML
import urllib3
Expand All @@ -53,7 +53,7 @@
else:
parent_directory = path.abspath(path.dirname(path.dirname(__file__)))

version = pkg_resources.get_distribution("canu").version
version = metadata.version("canu")

canu_config_file = path.join(parent_directory, "canu", "canu.yaml")
with open(canu_config_file, "r") as canu_f:
Expand Down
4 changes: 2 additions & 2 deletions canu/generate/switch/config/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
# OTHER DEALINGS IN THE SOFTWARE.
"""CANU generate switch config commands."""
from collections import defaultdict
from importlib import metadata
from itertools import groupby
import json
import logging
Expand All @@ -43,7 +44,6 @@
import netaddr
from netutils.mac import is_valid_mac
from network_modeling.NetworkNodeFactory import NetworkNodeFactory
import pkg_resources
import requests
from ruamel.yaml import YAML
from ttp import ttp
Expand Down Expand Up @@ -119,7 +119,7 @@

csm_options = canu_config["csm_versions"]

canu_version = pkg_resources.get_distribution("canu").version
canu_version = metadata.version("canu")

log = logging.getLogger("generate_switch_config")

Expand Down
4 changes: 2 additions & 2 deletions canu/utils/cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@
"""Utilities to help CANU cache switch information to YAML."""

import datetime
from importlib import metadata
from operator import itemgetter
from os import path
from pathlib import Path
import sys
import tempfile

import click
import pkg_resources
from ruamel.yaml import YAML

yaml = YAML()
Expand Down Expand Up @@ -67,7 +67,7 @@ def cache_directory():
project_root = Path(__file__).resolve().parent.parent.parent

canu_cache_file = path.join(cache_directory(), "canu_cache.yaml")
version = pkg_resources.get_distribution("canu").version
version = metadata.version("canu")
file_exists = path.isfile(canu_cache_file)

# Open the Cache file, and generate it if it does not exist
Expand Down
4 changes: 2 additions & 2 deletions canu/validate/shcd/shcd.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"""CANU commands that validate the shcd."""
from collections import defaultdict
import datetime
from importlib import metadata
import json
import logging
from os import path
Expand All @@ -37,7 +38,6 @@
from network_modeling.NetworkPort import NetworkPort
from network_modeling.NodeLocation import NodeLocation
from openpyxl import load_workbook
import pkg_resources

from canu.style import Style

Expand All @@ -48,7 +48,7 @@
prog = __file__
project_root = Path(__file__).resolve().parent.parent.parent.parent

version = pkg_resources.get_distribution("canu").version
version = metadata.version("canu")

log = logging.getLogger("validate_shcd")

Expand Down
Loading