mirror of
https://github.com/panda3d/panda3d.git
synced 2025-09-27 23:34:57 -04:00
makepanda: Replace references to deprecated distutils module
distutils is deprecated as of Python 3.10 (see PEP 632) and will be removed in Python 3.12.
This commit is contained in:
parent
f3c481578e
commit
2fcacd1bab
@ -10,7 +10,7 @@
|
||||
|
||||
import os
|
||||
import sys
|
||||
from distutils.sysconfig import get_python_lib
|
||||
import sysconfig
|
||||
from optparse import OptionParser
|
||||
from makepandacore import *
|
||||
|
||||
@ -141,7 +141,7 @@ def GetLibDir():
|
||||
|
||||
# If Python is installed into /usr/lib64, it's probably safe
|
||||
# to assume that we should install there as well.
|
||||
python_lib = get_python_lib(1)
|
||||
python_lib = sysconfig.get_path("platlib")
|
||||
if python_lib.startswith('/usr/lib64/') or \
|
||||
python_lib.startswith('/usr/local/lib64/'):
|
||||
return "lib64"
|
||||
|
@ -6,6 +6,7 @@ import shutil
|
||||
import glob
|
||||
import re
|
||||
import subprocess
|
||||
import sysconfig
|
||||
from makepandacore import *
|
||||
from installpanda import *
|
||||
|
||||
@ -910,8 +911,7 @@ def MakeInstallerAndroid(version, **kwargs):
|
||||
shutil.copy(os.path.join(source_dir, base), target)
|
||||
|
||||
# Copy the Python standard library to the .apk as well.
|
||||
from distutils.sysconfig import get_python_lib
|
||||
stdlib_source = get_python_lib(False, True)
|
||||
stdlib_source = sysconfig.get_path("stdlib")
|
||||
stdlib_target = os.path.join("apkroot", "lib", "python{0}.{1}".format(*sys.version_info))
|
||||
copy_python_tree(stdlib_source, stdlib_target)
|
||||
|
||||
|
@ -21,6 +21,7 @@ try:
|
||||
import threading
|
||||
import signal
|
||||
import shutil
|
||||
import sysconfig
|
||||
import plistlib
|
||||
import queue
|
||||
except KeyboardInterrupt:
|
||||
@ -30,7 +31,10 @@ except:
|
||||
print("Please install the development package of Python and try again.")
|
||||
exit(1)
|
||||
|
||||
from distutils.util import get_platform
|
||||
if sys.version_info >= (3, 10):
|
||||
from sysconfig import get_platform
|
||||
else:
|
||||
from distutils.util import get_platform
|
||||
from makepandacore import *
|
||||
|
||||
try:
|
||||
|
@ -6,7 +6,6 @@
|
||||
########################################################################
|
||||
|
||||
import configparser
|
||||
from distutils import sysconfig
|
||||
import fnmatch
|
||||
import getpass
|
||||
import glob
|
||||
@ -18,6 +17,7 @@ import shutil
|
||||
import signal
|
||||
import subprocess
|
||||
import sys
|
||||
import sysconfig
|
||||
import threading
|
||||
import _thread as thread
|
||||
import time
|
||||
@ -2187,12 +2187,12 @@ def SdkLocatePython(prefer_thirdparty_python=False):
|
||||
LibDirectory("PYTHON", py_fwx + "/lib")
|
||||
|
||||
#elif GetTarget() == 'windows':
|
||||
# SDK["PYTHON"] = os.path.dirname(sysconfig.get_python_inc())
|
||||
# SDK["PYTHON"] = os.path.dirname(sysconfig.get_path("include"))
|
||||
# SDK["PYTHONVERSION"] = "python" + sysconfig.get_python_version()
|
||||
# SDK["PYTHONEXEC"] = sys.executable
|
||||
|
||||
else:
|
||||
SDK["PYTHON"] = sysconfig.get_python_inc()
|
||||
SDK["PYTHON"] = sysconfig.get_path("include")
|
||||
SDK["PYTHONVERSION"] = "python" + sysconfig.get_python_version() + abiflags
|
||||
SDK["PYTHONEXEC"] = os.path.realpath(sys.executable)
|
||||
|
||||
@ -3471,14 +3471,13 @@ def GetCurrentPythonVersionInfo():
|
||||
if PkgSkip("PYTHON"):
|
||||
return
|
||||
|
||||
from distutils.sysconfig import get_python_lib
|
||||
return {
|
||||
"version": SDK["PYTHONVERSION"][6:].rstrip('dmu'),
|
||||
"soabi": GetPythonABI(),
|
||||
"ext_suffix": GetExtensionSuffix(),
|
||||
"executable": sys.executable,
|
||||
"purelib": get_python_lib(False),
|
||||
"platlib": get_python_lib(True),
|
||||
"purelib": sysconfig.get_path("purelib"),
|
||||
"platlib": sysconfig.get_path("platlib"),
|
||||
}
|
||||
|
||||
|
||||
|
@ -11,8 +11,7 @@ import tempfile
|
||||
import subprocess
|
||||
import time
|
||||
import struct
|
||||
from distutils.util import get_platform
|
||||
from distutils.sysconfig import get_config_var
|
||||
from sysconfig import get_platform, get_config_var
|
||||
from optparse import OptionParser
|
||||
from base64 import urlsafe_b64encode
|
||||
from makepandacore import LocateBinary, GetExtensionSuffix, SetVerbose, GetVerbose, GetMetadataValue, CrossCompiling, GetThirdpartyDir, SDK, GetStrip
|
||||
|
Loading…
x
Reference in New Issue
Block a user