mirror of
https://github.com/panda3d/panda3d.git
synced 2025-09-29 08:15:18 -04:00
Merge branch 'release/1.10.x'
This commit is contained in:
commit
e01cb590de
17
.github/workflows/ci.yml
vendored
17
.github/workflows/ci.yml
vendored
@ -355,6 +355,23 @@ jobs:
|
|||||||
rmdir panda3d-1.10.14
|
rmdir panda3d-1.10.14
|
||||||
(cd thirdparty/darwin-libs-a && rm -rf rocket)
|
(cd thirdparty/darwin-libs-a && rm -rf rocket)
|
||||||
|
|
||||||
|
- name: Set up Python 3.12
|
||||||
|
if: matrix.os != 'windows-2019'
|
||||||
|
uses: actions/setup-python@v4
|
||||||
|
with:
|
||||||
|
python-version: '3.12'
|
||||||
|
- name: Build Python 3.12
|
||||||
|
if: matrix.os != 'windows-2019'
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
python makepanda/makepanda.py --git-commit=${{github.sha}} --outputdir=built --everything --no-eigen --python-incdir="$pythonLocation/include" --python-libdir="$pythonLocation/lib" --verbose --threads=4 --windows-sdk=10
|
||||||
|
- name: Test Python 3.12
|
||||||
|
if: matrix.os != 'windows-2019'
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
python -m pip install -r requirements-test.txt
|
||||||
|
PYTHONPATH=built LD_LIBRARY_PATH=built/lib DYLD_LIBRARY_PATH=built/lib python -m pytest
|
||||||
|
|
||||||
- name: Set up Python 3.11
|
- name: Set up Python 3.11
|
||||||
uses: actions/setup-python@v4
|
uses: actions/setup-python@v4
|
||||||
with:
|
with:
|
||||||
|
@ -2650,11 +2650,11 @@ class main(wx.Frame):
|
|||||||
for inputFile in inputs:
|
for inputFile in inputs:
|
||||||
if (inputFile != ''):
|
if (inputFile != ''):
|
||||||
inputFilename = inputFile.split('\\')[-1]
|
inputFilename = inputFile.split('\\')[-1]
|
||||||
print "Compare: ", inFile, filename, inputFile, inputFilename
|
print("Compare: ", inFile, filename, inputFile, inputFilename)
|
||||||
if inputFilename == filename:
|
if inputFilename == filename:
|
||||||
inputTime = os.path.getmtime(inputFile)
|
inputTime = os.path.getmtime(inputFile)
|
||||||
outputTime = os.path.getmtime(inFile)
|
outputTime = os.path.getmtime(inFile)
|
||||||
print "Matched: ", (inputTime > outputTime)
|
print("Matched: ", (inputTime > outputTime))
|
||||||
inputChanged = (inputTime > outputTime)
|
inputChanged = (inputTime > outputTime)
|
||||||
break
|
break
|
||||||
'''
|
'''
|
||||||
@ -2848,7 +2848,7 @@ class main(wx.Frame):
|
|||||||
|
|
||||||
except ValueError:
|
except ValueError:
|
||||||
return
|
return
|
||||||
#print self.batchList
|
#print(self.batchList)
|
||||||
|
|
||||||
def OnBatchItemEdit(self, event):
|
def OnBatchItemEdit(self, event):
|
||||||
selectedItemId = self.batchTree.GetSelections()
|
selectedItemId = self.batchTree.GetSelections()
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
from distutils.core import setup
|
from setuptools import setup
|
||||||
import py2exe
|
import py2exe
|
||||||
|
|
||||||
setup(console=['Panda3DToolsGUI.py'])
|
setup(console=['Panda3DToolsGUI.py'])
|
||||||
|
84
direct/src/dist/FreezeTool.py
vendored
84
direct/src/dist/FreezeTool.py
vendored
@ -5,7 +5,6 @@ import modulefinder
|
|||||||
import sys
|
import sys
|
||||||
import os
|
import os
|
||||||
import marshal
|
import marshal
|
||||||
import imp
|
|
||||||
import platform
|
import platform
|
||||||
import struct
|
import struct
|
||||||
import io
|
import io
|
||||||
@ -13,6 +12,7 @@ import sysconfig
|
|||||||
import zipfile
|
import zipfile
|
||||||
import importlib
|
import importlib
|
||||||
import warnings
|
import warnings
|
||||||
|
from importlib import machinery
|
||||||
|
|
||||||
from . import pefile
|
from . import pefile
|
||||||
|
|
||||||
@ -24,6 +24,16 @@ except ImportError:
|
|||||||
|
|
||||||
from panda3d.core import Filename, Multifile, PandaSystem, StringStream
|
from panda3d.core import Filename, Multifile, PandaSystem, StringStream
|
||||||
|
|
||||||
|
# Old imp constants.
|
||||||
|
_PY_SOURCE = 1
|
||||||
|
_PY_COMPILED = 2
|
||||||
|
_C_EXTENSION = 3
|
||||||
|
_PKG_DIRECTORY = 5
|
||||||
|
_C_BUILTIN = 6
|
||||||
|
_PY_FROZEN = 7
|
||||||
|
|
||||||
|
_PKG_NAMESPACE_DIRECTORY = object()
|
||||||
|
|
||||||
# Check to see if we are running python_d, which implies we have a
|
# Check to see if we are running python_d, which implies we have a
|
||||||
# debug build, and we have to build the module with debug options.
|
# debug build, and we have to build the module with debug options.
|
||||||
# This is only relevant on Windows.
|
# This is only relevant on Windows.
|
||||||
@ -37,7 +47,7 @@ isDebugBuild = (python.lower().endswith('_d'))
|
|||||||
# NB. if encodings are removed, be sure to remove them from the shortcut in
|
# NB. if encodings are removed, be sure to remove them from the shortcut in
|
||||||
# deploy-stub.c.
|
# deploy-stub.c.
|
||||||
startupModules = [
|
startupModules = [
|
||||||
'imp', 'encodings', 'encodings.*', 'io', 'marshal', 'importlib.machinery',
|
'encodings', 'encodings.*', 'io', 'marshal', 'importlib.machinery',
|
||||||
'importlib.util',
|
'importlib.util',
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -262,10 +272,15 @@ class CompilationEnvironment:
|
|||||||
self.arch = '-arch x86_64'
|
self.arch = '-arch x86_64'
|
||||||
elif proc in ('arm64', 'aarch64'):
|
elif proc in ('arm64', 'aarch64'):
|
||||||
self.arch = '-arch arm64'
|
self.arch = '-arch arm64'
|
||||||
self.compileObjExe = "gcc -c %(arch)s -o %(basename)s.o -O2 -I%(pythonIPath)s %(filename)s"
|
self.compileObjExe = "clang -c %(arch)s -o %(basename)s.o -O2 -I%(pythonIPath)s %(filename)s"
|
||||||
self.compileObjDll = "gcc -fPIC -c %(arch)s -o %(basename)s.o -O2 -I%(pythonIPath)s %(filename)s"
|
self.compileObjDll = "clang -fPIC -c %(arch)s -o %(basename)s.o -O2 -I%(pythonIPath)s %(filename)s"
|
||||||
self.linkExe = "gcc %(arch)s -o %(basename)s %(basename)s.o -framework Python"
|
self.linkExe = "clang %(arch)s -o %(basename)s %(basename)s.o"
|
||||||
self.linkDll = "gcc %(arch)s -undefined dynamic_lookup -bundle -o %(basename)s.so %(basename)s.o"
|
if '/Python.framework/' in self.PythonIPath:
|
||||||
|
framework_dir = self.PythonIPath.split("/Python.framework/", 1)[0]
|
||||||
|
if framework_dir != "/System/Library/Frameworks":
|
||||||
|
self.linkExe += " -F " + framework_dir
|
||||||
|
self.linkExe += " -framework Python"
|
||||||
|
self.linkDll = "clang %(arch)s -undefined dynamic_lookup -bundle -o %(basename)s.so %(basename)s.o"
|
||||||
|
|
||||||
else:
|
else:
|
||||||
# Unix
|
# Unix
|
||||||
@ -897,12 +912,11 @@ class Freezer:
|
|||||||
|
|
||||||
# Suffix/extension for Python C extension modules
|
# Suffix/extension for Python C extension modules
|
||||||
if self.platform == PandaSystem.getPlatform():
|
if self.platform == PandaSystem.getPlatform():
|
||||||
suffixes = imp.get_suffixes()
|
suffixes = (
|
||||||
|
[(s, 'rb', _C_EXTENSION) for s in machinery.EXTENSION_SUFFIXES] +
|
||||||
# Set extension for Python files to binary mode
|
[(s, 'rb', _PY_SOURCE) for s in machinery.SOURCE_SUFFIXES] +
|
||||||
for i, suffix in enumerate(suffixes):
|
[(s, 'rb', _PY_COMPILED) for s in machinery.BYTECODE_SUFFIXES]
|
||||||
if suffix[2] == imp.PY_SOURCE:
|
)
|
||||||
suffixes[i] = (suffix[0], 'rb', imp.PY_SOURCE)
|
|
||||||
else:
|
else:
|
||||||
suffixes = [('.py', 'rb', 1), ('.pyc', 'rb', 2)]
|
suffixes = [('.py', 'rb', 1), ('.pyc', 'rb', 2)]
|
||||||
|
|
||||||
@ -1316,10 +1330,10 @@ class Freezer:
|
|||||||
ext = mdef.filename.getExtension()
|
ext = mdef.filename.getExtension()
|
||||||
if ext == 'pyc' or ext == 'pyo':
|
if ext == 'pyc' or ext == 'pyo':
|
||||||
fp = open(pathname, 'rb')
|
fp = open(pathname, 'rb')
|
||||||
stuff = ("", "rb", imp.PY_COMPILED)
|
stuff = ("", "rb", _PY_COMPILED)
|
||||||
self.mf.load_module(mdef.moduleName, fp, pathname, stuff)
|
self.mf.load_module(mdef.moduleName, fp, pathname, stuff)
|
||||||
else:
|
else:
|
||||||
stuff = ("", "rb", imp.PY_SOURCE)
|
stuff = ("", "rb", _PY_SOURCE)
|
||||||
if mdef.text:
|
if mdef.text:
|
||||||
fp = io.StringIO(mdef.text)
|
fp = io.StringIO(mdef.text)
|
||||||
else:
|
else:
|
||||||
@ -1415,7 +1429,7 @@ class Freezer:
|
|||||||
|
|
||||||
def __addPyc(self, multifile, filename, code, compressionLevel):
|
def __addPyc(self, multifile, filename, code, compressionLevel):
|
||||||
if code:
|
if code:
|
||||||
data = imp.get_magic() + b'\0\0\0\0\0\0\0\0'
|
data = importlib.util.MAGIC_NUMBER + b'\0\0\0\0\0\0\0\0'
|
||||||
data += marshal.dumps(code)
|
data += marshal.dumps(code)
|
||||||
|
|
||||||
stream = StringStream(data)
|
stream = StringStream(data)
|
||||||
@ -1605,7 +1619,7 @@ class Freezer:
|
|||||||
# trouble importing it as a builtin module. Synthesize a frozen
|
# trouble importing it as a builtin module. Synthesize a frozen
|
||||||
# module that loads it as builtin.
|
# module that loads it as builtin.
|
||||||
if '.' in moduleName and self.linkExtensionModules:
|
if '.' in moduleName and self.linkExtensionModules:
|
||||||
code = compile('import sys;del sys.modules["%s"];import imp;imp.init_builtin("%s")' % (moduleName, moduleName), moduleName, 'exec', optimize=self.optimize)
|
code = compile('import sys;del sys.modules["%s"];from importlib._bootstrap import _builtin_from_name;_builtin_from_name("%s")' % (moduleName, moduleName), moduleName, 'exec', optimize=self.optimize)
|
||||||
code = marshal.dumps(code)
|
code = marshal.dumps(code)
|
||||||
mangledName = self.mangleName(moduleName)
|
mangledName = self.mangleName(moduleName)
|
||||||
moduleDefs.append(self.makeModuleDef(mangledName, code))
|
moduleDefs.append(self.makeModuleDef(mangledName, code))
|
||||||
@ -1887,9 +1901,19 @@ class Freezer:
|
|||||||
if '.' in moduleName and not self.platform.startswith('android'):
|
if '.' in moduleName and not self.platform.startswith('android'):
|
||||||
if self.platform.startswith("macosx") and not use_console:
|
if self.platform.startswith("macosx") and not use_console:
|
||||||
# We write the Frameworks directory to sys.path[0].
|
# We write the Frameworks directory to sys.path[0].
|
||||||
code = 'import sys;del sys.modules["%s"];import sys,os,imp;imp.load_dynamic("%s",os.path.join(sys.path[0], "%s%s"))' % (moduleName, moduleName, moduleName, modext)
|
direxpr = 'sys.path[0]'
|
||||||
else:
|
else:
|
||||||
code = 'import sys;del sys.modules["%s"];import sys,os,imp;imp.load_dynamic("%s",os.path.join(os.path.dirname(sys.executable), "%s%s"))' % (moduleName, moduleName, moduleName, modext)
|
direxpr = 'os.path.dirname(sys.executable)'
|
||||||
|
|
||||||
|
code = \
|
||||||
|
f'import sys;' \
|
||||||
|
f'del sys.modules["{moduleName}"];' \
|
||||||
|
f'import sys,os;' \
|
||||||
|
f'from importlib.machinery import ExtensionFileLoader,ModuleSpec;' \
|
||||||
|
f'from importlib._bootstrap import _load;' \
|
||||||
|
f'path=os.path.join({direxpr}, "{moduleName}{modext}");' \
|
||||||
|
f'_load(ModuleSpec(name="{moduleName}", loader=ExtensionFileLoader("{moduleName}", path), origin=path))'
|
||||||
|
|
||||||
code = compile(code, moduleName, 'exec', optimize=self.optimize)
|
code = compile(code, moduleName, 'exec', optimize=self.optimize)
|
||||||
code = marshal.dumps(code)
|
code = marshal.dumps(code)
|
||||||
moduleList.append((moduleName, len(pool), len(code)))
|
moduleList.append((moduleName, len(pool), len(code)))
|
||||||
@ -2400,9 +2424,6 @@ class Freezer:
|
|||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
_PKG_NAMESPACE_DIRECTORY = object()
|
|
||||||
|
|
||||||
|
|
||||||
class PandaModuleFinder(modulefinder.ModuleFinder):
|
class PandaModuleFinder(modulefinder.ModuleFinder):
|
||||||
|
|
||||||
def __init__(self, *args, **kw):
|
def __init__(self, *args, **kw):
|
||||||
@ -2415,7 +2436,12 @@ class PandaModuleFinder(modulefinder.ModuleFinder):
|
|||||||
|
|
||||||
self.builtin_module_names = kw.pop('builtin_module_names', sys.builtin_module_names)
|
self.builtin_module_names = kw.pop('builtin_module_names', sys.builtin_module_names)
|
||||||
|
|
||||||
self.suffixes = kw.pop('suffixes', imp.get_suffixes())
|
self.suffixes = kw.pop('suffixes', (
|
||||||
|
[(s, 'rb', _C_EXTENSION) for s in machinery.EXTENSION_SUFFIXES] +
|
||||||
|
[(s, 'r', _PY_SOURCE) for s in machinery.SOURCE_SUFFIXES] +
|
||||||
|
[(s, 'rb', _PY_COMPILED) for s in machinery.BYTECODE_SUFFIXES]
|
||||||
|
))
|
||||||
|
|
||||||
self.optimize = kw.pop('optimize', -1)
|
self.optimize = kw.pop('optimize', -1)
|
||||||
|
|
||||||
modulefinder.ModuleFinder.__init__(self, *args, **kw)
|
modulefinder.ModuleFinder.__init__(self, *args, **kw)
|
||||||
@ -2563,7 +2589,7 @@ class PandaModuleFinder(modulefinder.ModuleFinder):
|
|||||||
|
|
||||||
suffix, mode, type = file_info
|
suffix, mode, type = file_info
|
||||||
self.msgin(2, "load_module", fqname, fp and "fp", pathname)
|
self.msgin(2, "load_module", fqname, fp and "fp", pathname)
|
||||||
if type == imp.PKG_DIRECTORY:
|
if type == _PKG_DIRECTORY:
|
||||||
m = self.load_package(fqname, pathname)
|
m = self.load_package(fqname, pathname)
|
||||||
self.msgout(2, "load_module ->", m)
|
self.msgout(2, "load_module ->", m)
|
||||||
return m
|
return m
|
||||||
@ -2574,7 +2600,7 @@ class PandaModuleFinder(modulefinder.ModuleFinder):
|
|||||||
m.__path__ = pathname
|
m.__path__ = pathname
|
||||||
return m
|
return m
|
||||||
|
|
||||||
if type == imp.PY_SOURCE:
|
if type == _PY_SOURCE:
|
||||||
if fqname in overrideModules:
|
if fqname in overrideModules:
|
||||||
# This module has a custom override.
|
# This module has a custom override.
|
||||||
code = overrideModules[fqname]
|
code = overrideModules[fqname]
|
||||||
@ -2598,7 +2624,7 @@ class PandaModuleFinder(modulefinder.ModuleFinder):
|
|||||||
|
|
||||||
code += b'\n' if isinstance(code, bytes) else '\n'
|
code += b'\n' if isinstance(code, bytes) else '\n'
|
||||||
co = compile(code, pathname, 'exec', optimize=self.optimize)
|
co = compile(code, pathname, 'exec', optimize=self.optimize)
|
||||||
elif type == imp.PY_COMPILED:
|
elif type == _PY_COMPILED:
|
||||||
if sys.version_info >= (3, 7):
|
if sys.version_info >= (3, 7):
|
||||||
try:
|
try:
|
||||||
data = fp.read()
|
data = fp.read()
|
||||||
@ -2752,11 +2778,11 @@ class PandaModuleFinder(modulefinder.ModuleFinder):
|
|||||||
|
|
||||||
# If we have a custom override for this module, we know we have it.
|
# If we have a custom override for this module, we know we have it.
|
||||||
if fullname in overrideModules:
|
if fullname in overrideModules:
|
||||||
return (None, '', ('.py', 'r', imp.PY_SOURCE))
|
return (None, '', ('.py', 'r', _PY_SOURCE))
|
||||||
|
|
||||||
# It's built into the interpreter.
|
# It's built into the interpreter.
|
||||||
if fullname in self.builtin_module_names:
|
if fullname in self.builtin_module_names:
|
||||||
return (None, None, ('', '', imp.C_BUILTIN))
|
return (None, None, ('', '', _C_BUILTIN))
|
||||||
|
|
||||||
# If no search path is given, look for a built-in module.
|
# If no search path is given, look for a built-in module.
|
||||||
if path is None:
|
if path is None:
|
||||||
@ -2806,7 +2832,7 @@ class PandaModuleFinder(modulefinder.ModuleFinder):
|
|||||||
for suffix, mode, _ in self.suffixes:
|
for suffix, mode, _ in self.suffixes:
|
||||||
init = os.path.join(basename, '__init__' + suffix)
|
init = os.path.join(basename, '__init__' + suffix)
|
||||||
if self._open_file(init, mode):
|
if self._open_file(init, mode):
|
||||||
return (None, basename, ('', '', imp.PKG_DIRECTORY))
|
return (None, basename, ('', '', _PKG_DIRECTORY))
|
||||||
|
|
||||||
# This may be a namespace package.
|
# This may be a namespace package.
|
||||||
if self._dir_exists(basename):
|
if self._dir_exists(basename):
|
||||||
@ -2818,7 +2844,7 @@ class PandaModuleFinder(modulefinder.ModuleFinder):
|
|||||||
# Only if we're not looking on a particular path, though.
|
# Only if we're not looking on a particular path, though.
|
||||||
if p3extend_frozen and p3extend_frozen.is_frozen_module(name):
|
if p3extend_frozen and p3extend_frozen.is_frozen_module(name):
|
||||||
# It's a frozen module.
|
# It's a frozen module.
|
||||||
return (None, name, ('', '', imp.PY_FROZEN))
|
return (None, name, ('', '', _PY_FROZEN))
|
||||||
|
|
||||||
# If we found folders on the path with this module name without an
|
# If we found folders on the path with this module name without an
|
||||||
# __init__.py file, we should consider this a namespace package.
|
# __init__.py file, we should consider this a namespace package.
|
||||||
|
3
direct/src/dist/commands.py
vendored
3
direct/src/dist/commands.py
vendored
@ -13,7 +13,6 @@ import re
|
|||||||
import shutil
|
import shutil
|
||||||
import stat
|
import stat
|
||||||
import struct
|
import struct
|
||||||
import imp
|
|
||||||
import string
|
import string
|
||||||
import tempfile
|
import tempfile
|
||||||
|
|
||||||
@ -1068,7 +1067,7 @@ class build_apps(setuptools.Command):
|
|||||||
freezer_extras.update(freezer.extras)
|
freezer_extras.update(freezer.extras)
|
||||||
freezer_modules.update(freezer.getAllModuleNames())
|
freezer_modules.update(freezer.getAllModuleNames())
|
||||||
for suffix in freezer.mf.suffixes:
|
for suffix in freezer.mf.suffixes:
|
||||||
if suffix[2] == imp.C_EXTENSION:
|
if suffix[2] == 3: # imp.C_EXTENSION:
|
||||||
ext_suffixes.add(suffix[0])
|
ext_suffixes.add(suffix[0])
|
||||||
|
|
||||||
for appname, scriptname in self.gui_apps.items():
|
for appname, scriptname in self.gui_apps.items():
|
||||||
|
@ -241,6 +241,18 @@ INLINE PyObject *PyObject_CallMethodOneArg(PyObject *obj, PyObject *name, PyObje
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* Python 3.12 */
|
||||||
|
|
||||||
|
#if PY_VERSION_HEX < 0x030C0000
|
||||||
|
# define PyLong_IsNonNegative(value) (Py_SIZE((value)) >= 0)
|
||||||
|
#else
|
||||||
|
INLINE bool PyLong_IsNonNegative(PyObject *value) {
|
||||||
|
int overflow = 0;
|
||||||
|
long longval = PyLong_AsLongAndOverflow(value, &overflow);
|
||||||
|
return overflow == 1 || longval >= 0;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Other Python implementations */
|
/* Other Python implementations */
|
||||||
|
|
||||||
#endif // HAVE_PYTHON
|
#endif // HAVE_PYTHON
|
||||||
|
@ -12,9 +12,7 @@ import os
|
|||||||
import sys
|
import sys
|
||||||
from optparse import OptionParser
|
from optparse import OptionParser
|
||||||
from makepandacore import *
|
from makepandacore import *
|
||||||
|
from locations import get_python_lib
|
||||||
# DO NOT CHANGE TO sysconfig - see GitHub issue #1230
|
|
||||||
from distutils.sysconfig import get_python_lib
|
|
||||||
|
|
||||||
|
|
||||||
MIME_INFO = (
|
MIME_INFO = (
|
||||||
|
32
makepanda/locations.py
Normal file
32
makepanda/locations.py
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
__all__ = [
|
||||||
|
'get_python_inc',
|
||||||
|
'get_config_var',
|
||||||
|
'get_python_version',
|
||||||
|
'PREFIX',
|
||||||
|
'get_python_lib',
|
||||||
|
'get_config_vars',
|
||||||
|
]
|
||||||
|
|
||||||
|
import sys
|
||||||
|
|
||||||
|
if sys.version_info < (3, 12):
|
||||||
|
from distutils.sysconfig import *
|
||||||
|
else:
|
||||||
|
from sysconfig import *
|
||||||
|
|
||||||
|
PREFIX = get_config_var('prefix')
|
||||||
|
|
||||||
|
def get_python_inc(plat_specific=False):
|
||||||
|
path_name = 'platinclude' if plat_specific else 'include'
|
||||||
|
return get_path(path_name)
|
||||||
|
|
||||||
|
def get_python_lib(plat_specific=False, standard_lib=False):
|
||||||
|
if standard_lib:
|
||||||
|
path_name = 'stdlib'
|
||||||
|
if plat_specific:
|
||||||
|
path_name = 'plat' + path_name
|
||||||
|
elif plat_specific:
|
||||||
|
path_name = 'platlib'
|
||||||
|
else:
|
||||||
|
path_name = 'purelib'
|
||||||
|
return get_path(path_name)
|
@ -942,8 +942,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.
|
||||||
# DO NOT CHANGE TO sysconfig - see #1230
|
from locations import get_python_lib
|
||||||
from distutils.sysconfig import get_python_lib
|
|
||||||
stdlib_source = get_python_lib(False, True)
|
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)
|
||||||
|
@ -30,12 +30,10 @@ 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 makepandacore import *
|
from makepandacore import *
|
||||||
|
|
||||||
|
from sysconfig import get_platform
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import zlib
|
import zlib
|
||||||
except:
|
except:
|
||||||
|
@ -21,6 +21,7 @@ import sys
|
|||||||
import threading
|
import threading
|
||||||
import _thread as thread
|
import _thread as thread
|
||||||
import time
|
import time
|
||||||
|
import locations
|
||||||
|
|
||||||
SUFFIX_INC = [".cxx",".cpp",".c",".h",".I",".yxx",".lxx",".mm",".rc",".r"]
|
SUFFIX_INC = [".cxx",".cpp",".c",".h",".I",".yxx",".lxx",".mm",".rc",".r"]
|
||||||
SUFFIX_DLL = [".dll",".dlo",".dle",".dli",".dlm",".mll",".exe",".pyd",".ocx"]
|
SUFFIX_DLL = [".dll",".dlo",".dle",".dli",".dlm",".mll",".exe",".pyd",".ocx"]
|
||||||
@ -2195,7 +2196,7 @@ def SdkLocatePython(prefer_thirdparty_python=False):
|
|||||||
# On macOS, search for the Python framework directory matching the
|
# On macOS, search for the Python framework directory matching the
|
||||||
# version number of our current Python version.
|
# version number of our current Python version.
|
||||||
sysroot = SDK.get("MACOSX", "")
|
sysroot = SDK.get("MACOSX", "")
|
||||||
version = sysconfig.get_python_version()
|
version = locations.get_python_version()
|
||||||
|
|
||||||
py_fwx = "{0}/System/Library/Frameworks/Python.framework/Versions/{1}".format(sysroot, version)
|
py_fwx = "{0}/System/Library/Frameworks/Python.framework/Versions/{1}".format(sysroot, version)
|
||||||
|
|
||||||
@ -2220,19 +2221,19 @@ 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(locations.get_python_inc())
|
||||||
# SDK["PYTHONVERSION"] = "python" + sysconfig.get_python_version()
|
# SDK["PYTHONVERSION"] = "python" + locations.get_python_version()
|
||||||
# SDK["PYTHONEXEC"] = sys.executable
|
# SDK["PYTHONEXEC"] = sys.executable
|
||||||
|
|
||||||
else:
|
else:
|
||||||
SDK["PYTHON"] = sysconfig.get_python_inc()
|
SDK["PYTHON"] = locations.get_python_inc()
|
||||||
SDK["PYTHONVERSION"] = "python" + sysconfig.get_python_version() + abiflags
|
SDK["PYTHONVERSION"] = "python" + locations.get_python_version() + abiflags
|
||||||
SDK["PYTHONEXEC"] = os.path.realpath(sys.executable)
|
SDK["PYTHONEXEC"] = os.path.realpath(sys.executable)
|
||||||
|
|
||||||
if CrossCompiling():
|
if CrossCompiling():
|
||||||
# We need a version of Python we can run.
|
# We need a version of Python we can run.
|
||||||
SDK["PYTHONEXEC"] = sys.executable
|
SDK["PYTHONEXEC"] = sys.executable
|
||||||
host_version = "python" + sysconfig.get_python_version() + abiflags
|
host_version = "python" + locations.get_python_version() + abiflags
|
||||||
if SDK["PYTHONVERSION"] != host_version:
|
if SDK["PYTHONVERSION"] != host_version:
|
||||||
exit("Host Python version (%s) must be the same as target Python version (%s)!" % (host_version, SDK["PYTHONVERSION"]))
|
exit("Host Python version (%s) must be the same as target Python version (%s)!" % (host_version, SDK["PYTHONVERSION"]))
|
||||||
|
|
||||||
@ -3386,7 +3387,7 @@ def GetExtensionSuffix():
|
|||||||
|
|
||||||
def GetPythonABI():
|
def GetPythonABI():
|
||||||
if not CrossCompiling():
|
if not CrossCompiling():
|
||||||
soabi = sysconfig.get_config_var('SOABI')
|
soabi = locations.get_config_var('SOABI')
|
||||||
if soabi:
|
if soabi:
|
||||||
return soabi
|
return soabi
|
||||||
|
|
||||||
@ -3507,8 +3508,8 @@ def GetCurrentPythonVersionInfo():
|
|||||||
"soabi": GetPythonABI(),
|
"soabi": GetPythonABI(),
|
||||||
"ext_suffix": GetExtensionSuffix(),
|
"ext_suffix": GetExtensionSuffix(),
|
||||||
"executable": sys.executable,
|
"executable": sys.executable,
|
||||||
"purelib": sysconfig.get_python_lib(False),
|
"purelib": locations.get_python_lib(False),
|
||||||
"platlib": sysconfig.get_python_lib(True),
|
"platlib": locations.get_python_lib(True),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -11,10 +11,11 @@ import tempfile
|
|||||||
import subprocess
|
import subprocess
|
||||||
import time
|
import time
|
||||||
import struct
|
import struct
|
||||||
from sysconfig import get_platform, 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
|
||||||
|
from locations import get_config_var
|
||||||
|
from sysconfig import get_platform
|
||||||
|
|
||||||
|
|
||||||
def get_abi_tag():
|
def get_abi_tag():
|
||||||
|
@ -92,19 +92,7 @@ BMPlenrgbtable(int classv, unsigned long bitcount)
|
|||||||
pm_error(er_internal, "BMPlenrgbtable");
|
pm_error(er_internal, "BMPlenrgbtable");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
switch (classv)
|
lenrgb = (classv == C_OS2) ? 3 : 4;
|
||||||
{
|
|
||||||
case C_WIN:
|
|
||||||
lenrgb = 4;
|
|
||||||
break;
|
|
||||||
case C_OS2:
|
|
||||||
lenrgb = 3;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
pm_error(er_internal, "BMPlenrgbtable");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
return (1 << bitcount) * lenrgb;
|
return (1 << bitcount) * lenrgb;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -55,6 +55,7 @@ public:
|
|||||||
unsigned long offBits;
|
unsigned long offBits;
|
||||||
|
|
||||||
unsigned short cBitCount;
|
unsigned short cBitCount;
|
||||||
|
unsigned short cCompression;
|
||||||
int indexed;
|
int indexed;
|
||||||
int classv;
|
int classv;
|
||||||
|
|
||||||
|
@ -177,6 +177,7 @@ BMPreadinfoheader(
|
|||||||
unsigned long *pcx,
|
unsigned long *pcx,
|
||||||
unsigned long *pcy,
|
unsigned long *pcy,
|
||||||
unsigned short *pcBitCount,
|
unsigned short *pcBitCount,
|
||||||
|
unsigned short *pcCompression,
|
||||||
int *pclassv)
|
int *pclassv)
|
||||||
{
|
{
|
||||||
unsigned long cbFix;
|
unsigned long cbFix;
|
||||||
@ -185,6 +186,7 @@ BMPreadinfoheader(
|
|||||||
unsigned long cx = 0;
|
unsigned long cx = 0;
|
||||||
unsigned long cy = 0;
|
unsigned long cy = 0;
|
||||||
unsigned short cBitCount = 0;
|
unsigned short cBitCount = 0;
|
||||||
|
unsigned long cCompression = 0;
|
||||||
int classv = 0;
|
int classv = 0;
|
||||||
|
|
||||||
cbFix = GetLong(fp);
|
cbFix = GetLong(fp);
|
||||||
@ -229,7 +231,9 @@ BMPreadinfoheader(
|
|||||||
* for the required total.
|
* for the required total.
|
||||||
*/
|
*/
|
||||||
if (classv != C_OS2) {
|
if (classv != C_OS2) {
|
||||||
for (int i = 0; i < (int)cbFix - 16; i += 4) {
|
cCompression = GetLong(fp);
|
||||||
|
|
||||||
|
for (int i = 0; i < (int)cbFix - 20; i += 4) {
|
||||||
GetLong(fp);
|
GetLong(fp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -273,11 +277,13 @@ BMPreadinfoheader(
|
|||||||
pm_message("cy: %d", cy);
|
pm_message("cy: %d", cy);
|
||||||
pm_message("cPlanes: %d", cPlanes);
|
pm_message("cPlanes: %d", cPlanes);
|
||||||
pm_message("cBitCount: %d", cBitCount);
|
pm_message("cBitCount: %d", cBitCount);
|
||||||
|
pm_message("cCompression: %d", cCompression);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
*pcx = cx;
|
*pcx = cx;
|
||||||
*pcy = cy;
|
*pcy = cy;
|
||||||
*pcBitCount = cBitCount;
|
*pcBitCount = cBitCount;
|
||||||
|
*pcCompression = cCompression;
|
||||||
*pclassv = classv;
|
*pclassv = classv;
|
||||||
|
|
||||||
*ppos += cbFix;
|
*ppos += cbFix;
|
||||||
@ -401,45 +407,84 @@ BMPreadbits(xel *array, xelval *alpha_array,
|
|||||||
unsigned long cx,
|
unsigned long cx,
|
||||||
unsigned long cy,
|
unsigned long cy,
|
||||||
unsigned short cBitCount,
|
unsigned short cBitCount,
|
||||||
int /* classv */,
|
unsigned long cCompression,
|
||||||
int indexed,
|
int indexed,
|
||||||
pixval *R,
|
pixval *R,
|
||||||
pixval *G,
|
pixval *G,
|
||||||
pixval *B)
|
pixval *B)
|
||||||
{
|
{
|
||||||
long y;
|
long y;
|
||||||
|
|
||||||
readto(fp, ppos, offBits);
|
readto(fp, ppos, offBits);
|
||||||
|
|
||||||
if(cBitCount > 24 && cBitCount != 32)
|
if (cBitCount > 24 && cBitCount != 32) {
|
||||||
{
|
pm_error("%s: cannot handle cBitCount: %d", ifname, cBitCount);
|
||||||
pm_error("%s: cannot handle cBitCount: %d"
|
}
|
||||||
,ifname
|
|
||||||
,cBitCount);
|
if (cCompression == 1) {
|
||||||
|
// RLE8 compression
|
||||||
|
xel *row = array + (cy - 1) * cx;
|
||||||
|
xel *p = row;
|
||||||
|
unsigned long nbyte = 0;
|
||||||
|
while (true) {
|
||||||
|
int first = GetByte(fp);
|
||||||
|
int second = GetByte(fp);
|
||||||
|
nbyte += 2;
|
||||||
|
|
||||||
|
if (first != 0) {
|
||||||
|
// Repeated index.
|
||||||
|
for (int i = 0; i < first; ++i) {
|
||||||
|
PPM_ASSIGN(*p, R[second], G[second], B[second]);
|
||||||
|
++p;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
/*
|
else if (second == 0) {
|
||||||
* The picture is stored bottom line first, top line last
|
// End of line.
|
||||||
*/
|
row -= cx;
|
||||||
|
p = row;
|
||||||
for (y = (long)cy - 1; y >= 0; y--)
|
}
|
||||||
{
|
else if (second == 1) {
|
||||||
int rc;
|
// End of image.
|
||||||
rc = BMPreadrow(fp, ppos, array + y*cx, alpha_array + y*cx, cx, cBitCount, indexed, R, G, B);
|
break;
|
||||||
if(rc == -1)
|
}
|
||||||
{
|
else if (second == 2) {
|
||||||
pm_error("%s: couldn't read row %d"
|
// Delta.
|
||||||
,ifname
|
int xoffset = GetByte(fp);
|
||||||
,y);
|
int yoffset = GetByte(fp);
|
||||||
}
|
nbyte += 2;
|
||||||
if(rc%4)
|
row -= cx * yoffset;
|
||||||
{
|
p += xoffset - cx * yoffset;
|
||||||
pm_error("%s: row had bad number of bytes: %d"
|
}
|
||||||
,ifname
|
else {
|
||||||
,rc);
|
// Absolute run.
|
||||||
}
|
for (int i = 0; i < second; ++i) {
|
||||||
|
int v = GetByte(fp);
|
||||||
|
++nbyte;
|
||||||
|
PPM_ASSIGN(*p, R[v], G[v], B[v]);
|
||||||
|
++p;
|
||||||
}
|
}
|
||||||
|
nbyte += second;
|
||||||
|
if (second % 2) {
|
||||||
|
// Pad to 16-bit boundary.
|
||||||
|
GetByte(fp);
|
||||||
|
++nbyte;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
*ppos += nbyte;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// The picture is stored bottom line first, top line last
|
||||||
|
for (y = (long)cy - 1; y >= 0; y--) {
|
||||||
|
int rc = BMPreadrow(fp, ppos, array + y*cx, alpha_array + y*cx, cx, cBitCount, indexed, R, G, B);
|
||||||
|
if (rc == -1) {
|
||||||
|
pm_error("%s: couldn't read row %d", ifname, y);
|
||||||
|
}
|
||||||
|
if (rc % 4) {
|
||||||
|
pm_error("%s: row had bad number of bytes: %d", ifname, rc);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -474,7 +519,7 @@ Reader(PNMFileType *type, istream *file, bool owns_file, string magic_number) :
|
|||||||
pos = 0;
|
pos = 0;
|
||||||
|
|
||||||
BMPreadfileheader(file, &pos, &offBits);
|
BMPreadfileheader(file, &pos, &offBits);
|
||||||
BMPreadinfoheader(file, &pos, &cx, &cy, &cBitCount, &classv);
|
BMPreadinfoheader(file, &pos, &cx, &cy, &cBitCount, &cCompression, &classv);
|
||||||
|
|
||||||
if (offBits != BMPoffbits(classv, cBitCount)) {
|
if (offBits != BMPoffbits(classv, cBitCount)) {
|
||||||
pnmimage_bmp_cat.warning()
|
pnmimage_bmp_cat.warning()
|
||||||
@ -523,9 +568,10 @@ Reader(PNMFileType *type, istream *file, bool owns_file, string magic_number) :
|
|||||||
int PNMFileTypeBMP::Reader::
|
int PNMFileTypeBMP::Reader::
|
||||||
read_data(xel *array, xelval *alpha_array) {
|
read_data(xel *array, xelval *alpha_array) {
|
||||||
BMPreadbits(array, alpha_array, _file, &pos, offBits, _x_size, _y_size,
|
BMPreadbits(array, alpha_array, _file, &pos, offBits, _x_size, _y_size,
|
||||||
cBitCount, classv, indexed, R, G, B);
|
cBitCount, cCompression, indexed, R, G, B);
|
||||||
|
|
||||||
if (pos != BMPlenfile(classv, cBitCount, _x_size, _y_size)) {
|
if (cCompression != 1 &&
|
||||||
|
pos != BMPlenfile(classv, cBitCount, _x_size, _y_size)) {
|
||||||
pnmimage_bmp_cat.warning()
|
pnmimage_bmp_cat.warning()
|
||||||
<< "Read " << pos << " bytes, expected to read "
|
<< "Read " << pos << " bytes, expected to read "
|
||||||
<< BMPlenfile(classv, cBitCount, _x_size, _y_size) << " bytes\n";
|
<< BMPlenfile(classv, cBitCount, _x_size, _y_size) << " bytes\n";
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
*/
|
*/
|
||||||
void Extension<BitArray>::
|
void Extension<BitArray>::
|
||||||
__init__(PyObject *init_value) {
|
__init__(PyObject *init_value) {
|
||||||
if (!PyLong_Check(init_value) || Py_SIZE(init_value) < 0) {
|
if (!PyLong_Check(init_value) || !PyLong_IsNonNegative(init_value)) {
|
||||||
PyErr_SetString(PyExc_ValueError, "BitArray constructor requires a positive integer");
|
PyErr_SetString(PyExc_ValueError, "BitArray constructor requires a positive integer");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -76,7 +76,7 @@ __getstate__() const {
|
|||||||
*/
|
*/
|
||||||
void Extension<BitArray>::
|
void Extension<BitArray>::
|
||||||
__setstate__(PyObject *state) {
|
__setstate__(PyObject *state) {
|
||||||
if (Py_SIZE(state) >= 0) {
|
if (PyLong_IsNonNegative(state)) {
|
||||||
__init__(state);
|
__init__(state);
|
||||||
} else {
|
} else {
|
||||||
PyObject *inverted = PyNumber_Invert(state);
|
PyObject *inverted = PyNumber_Invert(state);
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
template<class BMType>
|
template<class BMType>
|
||||||
INLINE void Extension<DoubleBitMask<BMType> >::
|
INLINE void Extension<DoubleBitMask<BMType> >::
|
||||||
__init__(PyObject *init_value) {
|
__init__(PyObject *init_value) {
|
||||||
if (!PyLong_Check(init_value) || Py_SIZE(init_value) < 0) {
|
if (!PyLong_Check(init_value) || !PyLong_IsNonNegative(init_value)) {
|
||||||
PyErr_SetString(PyExc_ValueError, "DoubleBitMask constructor requires a positive integer");
|
PyErr_SetString(PyExc_ValueError, "DoubleBitMask constructor requires a positive integer");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
import os
|
import os
|
||||||
|
import platform
|
||||||
|
import pytest
|
||||||
|
|
||||||
from panda3d import core
|
from panda3d import core
|
||||||
|
|
||||||
@ -16,12 +18,14 @@ def run_cg_compile_check(gsg, shader_path, expect_fail=False):
|
|||||||
assert shader is not None
|
assert shader is not None
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.skipif(platform.machine().lower() == 'arm64', reason="Cg not supported on arm64")
|
||||||
def test_cg_compile_error(gsg):
|
def test_cg_compile_error(gsg):
|
||||||
"""Test getting compile errors from bad Cg shaders"""
|
"""Test getting compile errors from bad Cg shaders"""
|
||||||
shader_path = core.Filename(SHADERS_DIR, 'cg_bad.sha')
|
shader_path = core.Filename(SHADERS_DIR, 'cg_bad.sha')
|
||||||
run_cg_compile_check(gsg, shader_path, expect_fail=True)
|
run_cg_compile_check(gsg, shader_path, expect_fail=True)
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.skipif(platform.machine().lower() == 'arm64', reason="Cg not supported on arm64")
|
||||||
def test_cg_from_file(gsg):
|
def test_cg_from_file(gsg):
|
||||||
"""Test compiling Cg shaders from files"""
|
"""Test compiling Cg shaders from files"""
|
||||||
shader_path = core.Filename(SHADERS_DIR, 'cg_simple.sha')
|
shader_path = core.Filename(SHADERS_DIR, 'cg_simple.sha')
|
||||||
|
58
tests/dist/test_FreezeTool.py
vendored
Normal file
58
tests/dist/test_FreezeTool.py
vendored
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
from direct.dist.FreezeTool import Freezer, PandaModuleFinder
|
||||||
|
import sys
|
||||||
|
|
||||||
|
|
||||||
|
def test_Freezer_moduleSuffixes():
|
||||||
|
freezer = Freezer()
|
||||||
|
|
||||||
|
for suffix, mode, type in freezer.mf.suffixes:
|
||||||
|
if type == 2: # imp.PY_SOURCE
|
||||||
|
assert mode == 'rb'
|
||||||
|
|
||||||
|
|
||||||
|
def test_Freezer_getModulePath_getModuleStar(tmp_path):
|
||||||
|
# Package 1 can be imported
|
||||||
|
package1 = tmp_path / "package1"
|
||||||
|
package1.mkdir()
|
||||||
|
(package1 / "submodule1.py").write_text("")
|
||||||
|
(package1 / "__init__.py").write_text("")
|
||||||
|
|
||||||
|
# Package 2 can not be imported
|
||||||
|
package2 = tmp_path / "package2"
|
||||||
|
package2.mkdir()
|
||||||
|
(package2 / "submodule2.py").write_text("")
|
||||||
|
(package2 / "__init__.py").write_text("raise ImportError\n")
|
||||||
|
|
||||||
|
# Module 1 can be imported
|
||||||
|
(tmp_path / "module1.py").write_text("")
|
||||||
|
|
||||||
|
# Module 2 can not be imported
|
||||||
|
(tmp_path / "module2.py").write_text("raise ImportError\n")
|
||||||
|
|
||||||
|
backup = sys.path
|
||||||
|
try:
|
||||||
|
# Don't fail if first item on path does not exist
|
||||||
|
sys.path = [str(tmp_path / "nonexistent"), str(tmp_path)]
|
||||||
|
|
||||||
|
freezer = Freezer()
|
||||||
|
assert freezer.getModulePath("nonexist") == None
|
||||||
|
assert freezer.getModulePath("package1") == [str(package1)]
|
||||||
|
assert freezer.getModulePath("package2") == [str(package2)]
|
||||||
|
assert freezer.getModulePath("package1.submodule1") == None
|
||||||
|
assert freezer.getModulePath("package1.nonexist") == None
|
||||||
|
assert freezer.getModulePath("package2.submodule2") == None
|
||||||
|
assert freezer.getModulePath("package2.nonexist") == None
|
||||||
|
assert freezer.getModulePath("module1") == None
|
||||||
|
assert freezer.getModulePath("module2") == None
|
||||||
|
|
||||||
|
assert freezer.getModuleStar("nonexist") == None
|
||||||
|
assert freezer.getModuleStar("package1") == ['submodule1']
|
||||||
|
assert freezer.getModuleStar("package2") == ['submodule2']
|
||||||
|
assert freezer.getModuleStar("package1.submodule1") == None
|
||||||
|
assert freezer.getModuleStar("package1.nonexist") == None
|
||||||
|
assert freezer.getModuleStar("package2.submodule2") == None
|
||||||
|
assert freezer.getModuleStar("package2.nonexist") == None
|
||||||
|
assert freezer.getModuleStar("module1") == None
|
||||||
|
assert freezer.getModuleStar("module2") == None
|
||||||
|
finally:
|
||||||
|
sys.path = backup
|
@ -118,6 +118,9 @@ def test_bitarray_pickle():
|
|||||||
ba = BitArray(123)
|
ba = BitArray(123)
|
||||||
assert ba == pickle.loads(pickle.dumps(ba, -1))
|
assert ba == pickle.loads(pickle.dumps(ba, -1))
|
||||||
|
|
||||||
|
ba = BitArray(1 << 128)
|
||||||
|
assert ba == pickle.loads(pickle.dumps(ba, -1))
|
||||||
|
|
||||||
ba = BitArray(94187049178237918273981729127381723)
|
ba = BitArray(94187049178237918273981729127381723)
|
||||||
assert ba == pickle.loads(pickle.dumps(ba, -1))
|
assert ba == pickle.loads(pickle.dumps(ba, -1))
|
||||||
|
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
# missing imports. It is useful for a quick and dirty test to make sure
|
# missing imports. It is useful for a quick and dirty test to make sure
|
||||||
# that there are no obvious build issues.
|
# that there are no obvious build issues.
|
||||||
import pytest
|
import pytest
|
||||||
|
import sys
|
||||||
|
|
||||||
# This will print out imports on the command line.
|
# This will print out imports on the command line.
|
||||||
#import direct.showbase.VerboseImport
|
#import direct.showbase.VerboseImport
|
||||||
@ -9,7 +10,7 @@ import pytest
|
|||||||
|
|
||||||
|
|
||||||
def test_imports_panda3d():
|
def test_imports_panda3d():
|
||||||
import importlib, os, sys
|
import importlib, os
|
||||||
import panda3d
|
import panda3d
|
||||||
|
|
||||||
# Look for panda3d.* modules in builtins - pfreeze might put them there.
|
# Look for panda3d.* modules in builtins - pfreeze might put them there.
|
||||||
@ -165,7 +166,8 @@ def test_imports_direct():
|
|||||||
import direct.showbase.TaskThreaded
|
import direct.showbase.TaskThreaded
|
||||||
import direct.showbase.ThreeUpShow
|
import direct.showbase.ThreeUpShow
|
||||||
import direct.showbase.Transitions
|
import direct.showbase.Transitions
|
||||||
import direct.showbase.VFSImporter
|
if sys.version_info < (3, 12):
|
||||||
|
import direct.showbase.VFSImporter
|
||||||
import direct.showbase.WxGlobal
|
import direct.showbase.WxGlobal
|
||||||
import direct.showutil.BuildGeometry
|
import direct.showutil.BuildGeometry
|
||||||
import direct.showutil.Effects
|
import direct.showutil.Effects
|
||||||
|
Loading…
x
Reference in New Issue
Block a user