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