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

Swap out legacycrypt for crypt-r for Python 3.13+ #3141

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
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
6 changes: 3 additions & 3 deletions azurelinuxagent/common/osutil/default.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@
from pwd import getpwall

from azurelinuxagent.common.exception import OSUtilError
# 'crypt' was removed in Python 3.13; use legacycrypt instead
# 'crypt' was removed in Python 3.13; use crypt-r instead
if sys.version_info[0] == 3 and sys.version_info[1] >= 13 or sys.version_info[0] > 3:
try:
from legacycrypt import crypt
from crypt_r import crypt
except ImportError:
def crypt(password, salt):
raise OSUtilError("Please install the legacycrypt Python module to use this feature.")
raise OSUtilError("Please install the crypt-r Python module to use this feature.")
else:
from crypt import crypt # pylint: disable=deprecated-module

Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
distro; python_version >= '3.8'
pyasn1
legacycrypt; python_version >= '3.13'
crypt-r; python_version >= '3.13'
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -318,11 +318,11 @@ def run(self):
# module was deprecated. Depending on the Linux distribution the
# implementation may be broken prior to Python 3.8 where the functionality
# will be removed from Python 3.
# * In version 3.13 of Python, the crypt module was removed and legacycrypt is
# * In version 3.13 of Python, the crypt module was removed and crypt-r is
# required instead.
requires = [
"distro;python_version>='3.8'",
"legacycrypt;python_version>='3.13'",
"crypt-r;python_version>='3.13'",
]

modules = [] # pylint: disable=invalid-name
Expand Down
Loading