Skip to content

Commit

Permalink
Merge pull request #76 from cs50/rongxin-patch-1
Browse files Browse the repository at this point in the history
Replace pkg_resources with importlib.metadata for Python 3.12
  • Loading branch information
rongxin-liu committed Nov 19, 2023
2 parents 018b61d + 5743de5 commit fd805a0
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions lib50/__init__.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import pathlib as _pathlib
import gettext as _gettext
import pkg_resources as _pkg_resources
from importlib.resources import files

# Internationalization
_ = _gettext.translation("lib50", _pkg_resources.resource_filename("lib50", "locale"), fallback=True).gettext
_ = _gettext.translation("lib50", str(files("lib50").joinpath("locale")), fallback=True).gettext

_LOCAL_PATH = _pathlib.Path("~/.local/share/lib50").expanduser().absolute()

Expand Down
4 changes: 2 additions & 2 deletions lib50/_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import logging
import os
from pathlib import Path
import pkg_resources
from packaging import version
import re
import shutil
import shlex
Expand Down Expand Up @@ -662,7 +662,7 @@ def check_dependencies():
# Check that git --version > 2.7
version = subprocess.check_output(["git", "--version"]).decode("utf-8")
matches = re.search(r"^git version (\d+\.\d+\.\d+).*$", version)
if not matches or pkg_resources.parse_version(matches.group(1)) < pkg_resources.parse_version("2.7.0"):
if not matches or version.parse(matches.group(1)) < version.parse("2.7.0"):
raise Error(_("You have an old version of git. Install version 2.7 or later, then re-run!"))


Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
license="GPLv3",
description="This is lib50, CS50's own internal library used in many of its tools.",
long_description="This is lib50, CS50's own internal library used in many of its tools.",
install_requires=["attrs>=18.1,<21", "pexpect>=4.6,<5", "pyyaml<7", "requests>=2.13,<3", "setuptools", "termcolor>=1.1,<2", "jellyfish>=0.7,<1", "cryptography>=2.7"],
install_requires=["attrs>=18.1,<21", "packaging", "pexpect>=4.6,<5", "pyyaml<7", "requests>=2.13,<3", "setuptools", "termcolor>=1.1,<2", "jellyfish>=0.7,<1", "cryptography>=2.7"],
extras_require = {
"develop": ["sphinx", "sphinx-autobuild", "sphinx_rtd_theme"]
},
Expand All @@ -27,6 +27,6 @@
python_requires=">= 3.6",
packages=["lib50"],
url="https://github.com/cs50/lib50",
version="3.0.8",
version="3.0.9",
include_package_data=True
)

0 comments on commit fd805a0

Please sign in to comment.