Drop use of deprecated distutils, going away in Python 3.12

f38
Paul Howarth 3 years ago
parent f386e9cd05
commit c0acebf377

@ -0,0 +1,78 @@
--- lib/Crypto/SelfTest/PublicKey/test_DSA.py
+++ lib/Crypto/SelfTest/PublicKey/test_DSA.py
@@ -223,7 +223,7 @@ def get_tests(config={}):
from Crypto.PublicKey import _fastmath
tests += list_test_cases(DSAFastMathTest)
except ImportError:
- from distutils.sysconfig import get_config_var
+ from sysconfig import get_config_var
import inspect
_fm_path = os.path.normpath(os.path.dirname(os.path.abspath(
inspect.getfile(inspect.currentframe())))
--- lib/Crypto/SelfTest/PublicKey/test_RSA.py
+++ lib/Crypto/SelfTest/PublicKey/test_RSA.py
@@ -393,7 +393,7 @@ def get_tests(config={}):
from Crypto.PublicKey import _fastmath
tests += list_test_cases(RSAFastMathTest)
except ImportError:
- from distutils.sysconfig import get_config_var
+ from sysconfig import get_config_var
import inspect
_fm_path = os.path.normpath(os.path.dirname(os.path.abspath(
inspect.getfile(inspect.currentframe())))
--- lib/Crypto/Util/number.py
+++ lib/Crypto/Util/number.py
@@ -41,7 +41,7 @@ except ImportError:
# see an exception raised if _fastmath exists but cannot be imported,
# uncomment the below
#
- # from distutils.sysconfig import get_config_var
+ # from sysconfig import get_config_var
# import inspect, os
# _fm_path = os.path.normpath(os.path.dirname(os.path.abspath(
# inspect.getfile(inspect.currentframe())))
--- setup.py
+++ setup.py
@@ -1,6 +1,6 @@
#! /usr/bin/env python
#
-# setup.py : Distutils setup script
+# setup.py : setuptools setup script
#
# Part of the Python Cryptography Toolkit
#
@@ -36,11 +36,10 @@
__revision__ = "$Id$"
-from distutils import core
-from distutils.ccompiler import new_compiler
-from distutils.core import Extension, Command
-from distutils.command.build import build
-from distutils.command.build_ext import build_ext
+from setuptools import setup
+from setuptools.command.build_ext import new_compiler
+from setuptools import Extension, Command
+from setuptools.command.build_ext import build_ext
import os, sys, re
import struct
@@ -53,8 +52,7 @@ if sys.version[0:1] != '3':
# .gcov files
USE_GCOV = 0
-
-from distutils.command.build_py import build_py
+from setuptools.command.build_py import build_py
# Work around the print / print() issue with Python 2.x and 3.x. We only need
# to print at one point of the code, which makes this easy
@@ -385,7 +383,7 @@ kw = {'name':"pycrypto",
]
}
-core.setup(**kw)
+setup(**kw)
def touch(path):
import os, time

@ -23,12 +23,14 @@ Patch7: pycrypto-2.6.1-drop-py2.1-support.patch
Patch8: python-crypto-2.6.1-python3.10.patch Patch8: python-crypto-2.6.1-python3.10.patch
Patch9: python-crypto-2.6.1-python3.11.patch Patch9: python-crypto-2.6.1-python3.11.patch
Patch10: python-crypto-2.6.1-python3only.patch Patch10: python-crypto-2.6.1-python3only.patch
Patch11: python-crypto-2.6.1-no-distutils.patch
BuildRequires: coreutils BuildRequires: coreutils
BuildRequires: findutils BuildRequires: findutils
BuildRequires: gcc BuildRequires: gcc
BuildRequires: gmp-devel >= 4.1 BuildRequires: gmp-devel >= 4.1
BuildRequires: libtomcrypt-devel >= 1.16 BuildRequires: libtomcrypt-devel >= 1.16
BuildRequires: python%{python3_pkgversion}-devel BuildRequires: python%{python3_pkgversion}-devel
BuildRequires: python%{python3_pkgversion}-setuptools
%description %description
PyCrypto is a collection of both secure hash functions (such as MD5 and PyCrypto is a collection of both secure hash functions (such as MD5 and
@ -97,6 +99,9 @@ rm -rf src/libtom
# Convert all code to Python 3 before the ability to use 2to3 goes away # Convert all code to Python 3 before the ability to use 2to3 goes away
%patch10 %patch10
# Drop use of deprecated distutils, going away in Python 3.12
%patch11
%build %build
%global optflags %{optflags} -fno-strict-aliasing %global optflags %{optflags} -fno-strict-aliasing
%py3_build %py3_build
@ -122,6 +127,7 @@ PYTHONPATH=%{buildroot}%{python3_sitearch} %{__python3} pct-speedtest.py
%changelog %changelog
* Thu Nov 11 2021 Paul Howarth <paul@city-fan.org> - 2.6.1-38 * Thu Nov 11 2021 Paul Howarth <paul@city-fan.org> - 2.6.1-38
- Convert all code to Python 3 before the ability to use 2to3 goes away - Convert all code to Python 3 before the ability to use 2to3 goes away
- Drop use of deprecated distutils, going away in Python 3.12
* Wed Nov 10 2021 Paul Howarth <paul@city-fan.org> - 2.6.1-37 * Wed Nov 10 2021 Paul Howarth <paul@city-fan.org> - 2.6.1-37
- Fix Python 3.11 compatibility (#2021808) - Fix Python 3.11 compatibility (#2021808)

Loading…
Cancel
Save