mirror of
https://github.com/pacnpal/Pac-cogs.git
synced 2025-12-20 02:41:06 -05:00
Updated update_checker.py to use importlib.metadata instead of the deprecated pkg_resources
Verified no other files were using pkg_resources Maintained all existing functionality while using modern Python package version checking
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
"""Update checker for yt-dlp"""
|
"""Update checker for yt-dlp"""
|
||||||
import logging
|
import logging
|
||||||
import pkg_resources
|
from importlib.metadata import version as get_package_version
|
||||||
from datetime import datetime, timedelta
|
from datetime import datetime, timedelta
|
||||||
import aiohttp
|
import aiohttp
|
||||||
from packaging import version
|
from packaging import version
|
||||||
@@ -139,7 +139,7 @@ class UpdateChecker:
|
|||||||
def _get_current_version(self) -> Optional[str]:
|
def _get_current_version(self) -> Optional[str]:
|
||||||
"""Get current yt-dlp version with error handling"""
|
"""Get current yt-dlp version with error handling"""
|
||||||
try:
|
try:
|
||||||
return pkg_resources.get_distribution('yt-dlp').version
|
return get_package_version('yt-dlp')
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"Error getting current version: {str(e)}")
|
logger.error(f"Error getting current version: {str(e)}")
|
||||||
return None
|
return None
|
||||||
|
|||||||
Reference in New Issue
Block a user