Merge branch 'release/1.10.x'

This commit is contained in:
rdb 2020-12-31 00:05:10 +01:00
commit cf60284ca9
18 changed files with 62 additions and 18 deletions

View File

@ -548,7 +548,7 @@ class SelectionRay(SelectionQueue):
if xy: if xy:
mx = xy[0] mx = xy[0]
my = xy[1] my = xy[1]
elif direct: elif base.direct:
mx = SEditor.dr.mouseX mx = SEditor.dr.mouseX
my = SEditor.dr.mouseY my = SEditor.dr.mouseY
else: else:

View File

@ -4,7 +4,7 @@ import time
class RotatingLog: class RotatingLog:
""" """
A file() (or open()) replacement that will automatically open and write An `open()` replacement that will automatically open and write
to a new file if the prior file is too large or after a time interval. to a new file if the prior file is too large or after a time interval.
""" """

View File

@ -669,6 +669,8 @@ class DirectSession(DirectObject):
if not taskMgr.hasTaskNamed('resizeObjectHandles'): if not taskMgr.hasTaskNamed('resizeObjectHandles'):
dnp = self.selected.last dnp = self.selected.last
if dnp: if dnp:
direct = base.direct
if self.manipulationControl.fMultiView: if self.manipulationControl.fMultiView:
for i in range(3): for i in range(3):
sf = 30.0 * direct.drList[i].orthoFactor sf = 30.0 * direct.drList[i].orthoFactor

View File

@ -56,7 +56,7 @@ class DistributedLargeBlobSender(DistributedObject.DistributedObject):
except OSError: except OSError:
DistributedLargeBlobSender.notify.error( DistributedLargeBlobSender.notify.error(
'could not access %s' % bPath) 'could not access %s' % bPath)
f = file(filename, 'rb') f = open(filename, 'rb')
self.blob = f.read() self.blob = f.read()
f.close() f.close()
os.unlink(filename) os.unlink(filename)

View File

@ -42,7 +42,7 @@ class DistributedLargeBlobSenderAI(DistributedObjectAI.DistributedObjectAI):
break break
# NOTE: there's a small chance of a race condition here, if # NOTE: there's a small chance of a race condition here, if
# the file is created by another AI just after the stat fails # the file is created by another AI just after the stat fails
f = file(filename, 'wb') f = open(filename, 'wb')
f.write(s) f.write(s)
f.close() f.close()
os.chdir(origDir) os.chdir(origDir)

View File

@ -77,6 +77,8 @@ defaultHiddenImports = {
'numpy.core._dtype_ctypes', 'numpy.core._dtype_ctypes',
'numpy.core._methods', 'numpy.core._methods',
], ],
'pandas.compat': ['lzma', 'cmath'],
'pandas._libs.tslibs.conversion': ['pandas._libs.tslibs.base'],
} }
# These are overrides for specific modules. # These are overrides for specific modules.

View File

@ -4,7 +4,6 @@ See the :ref:`distribution` section of the programming manual for information
on how to use these commands. on how to use these commands.
""" """
import collections
import os import os
import plistlib import plistlib
import pkg_resources import pkg_resources
@ -211,8 +210,10 @@ class build_apps(setuptools.Command):
# manylinux1/linux # manylinux1/linux
'libdl.so.*', 'libstdc++.so.*', 'libm.so.*', 'libgcc_s.so.*', 'libdl.so.*', 'libstdc++.so.*', 'libm.so.*', 'libgcc_s.so.*',
'libpthread.so.*', 'libc.so.*', 'ld-linux-x86-64.so.*', 'libpthread.so.*', 'libc.so.*', 'ld-linux-x86-64.so.*',
'libgl.so.*', 'libx11.so.*', 'libreadline.so.*', 'libncursesw.so.*', 'libgl.so.*', 'libx11.so.*', 'libncursesw.so.*', 'libz.so.*',
'libbz2.so.*', 'libz.so.*', 'liblzma.so.*', 'librt.so.*', 'libutil.so.*', 'librt.so.*', 'libutil.so.*', 'libnsl.so.1', 'libXext.so.6',
'libXrender.so.1', 'libICE.so.6', 'libSM.so.6',
'libgobject-2.0.so.0', 'libgthread-2.0.so.0', 'libglib-2.0.so.0',
# macOS # macOS
'/usr/lib/libc++.1.dylib', '/usr/lib/libc++.1.dylib',

View File

@ -24,7 +24,7 @@ class DistributedCameraOV(DistributedObjectOV):
self.fixtures = fixtures self.fixtures = fixtures
def storeToFile(self, name): def storeToFile(self, name):
f = file('cameras-%s.txt' % name, 'w') f = open('cameras-%s.txt' % name, 'w')
f.writelines(self.getObject().pack()) f.writelines(self.getObject().pack())
f.close() f.close()
@ -35,7 +35,7 @@ class DistributedCameraOV(DistributedObjectOV):
def loadFromFile(self, name): def loadFromFile(self, name):
self.b_setFixtures([]) self.b_setFixtures([])
f = file('cameras-%s.txt' % name, 'r'); f = open('cameras-%s.txt' % name, 'r')
for line in f.readlines(): for line in f.readlines():
pos,hpr,fov = self.unpackFixture(line) pos,hpr,fov = self.unpackFixture(line)
self.addFixture([pos[0],pos[1],pos[2], self.addFixture([pos[0],pos[1],pos[2],

View File

@ -97,7 +97,7 @@ class DistributedCartesianGridAI(DistributedNodeAI, CartesianGridBase):
def updateGridTask(self, task=None): def updateGridTask(self, task=None):
# Run through all grid objects and update their parents if needed # Run through all grid objects and update their parents if needed
missingObjs = [] missingObjs = []
for avId in self.gridObjects.keys(): for avId in list(self.gridObjects.keys()):
av = self.gridObjects[avId] av = self.gridObjects[avId]
# handle a missing object after it is already gone? # handle a missing object after it is already gone?
if (av.isEmpty()): if (av.isEmpty()):

View File

@ -26,7 +26,7 @@ class DistributedNodeUD(DistributedObjectUD):
def setParentStr(self, parentToken): def setParentStr(self, parentToken):
self.notify.debugCall() self.notify.debugCall()
if len(parentTokenStr) > 0: if len(parentToken) > 0:
self.do_setParent(parentToken) self.do_setParent(parentToken)
def setParent(self, parentToken): def setParent(self, parentToken):

View File

@ -270,9 +270,7 @@ class DoCollectionManager:
def deleteDistributedObjects(self): def deleteDistributedObjects(self):
# Get rid of all the distributed objects # Get rid of all the distributed objects
for doId in self.doId2do.keys(): for doId, do in list(self.doId2do.items()):
# Look up the object
do = self.doId2do[doId]
self.deleteDistObject(do) self.deleteDistObject(do)
# Get rid of everything that manages distributed objects # Get rid of everything that manages distributed objects

View File

@ -125,7 +125,7 @@ class ForceGroup(DirectObject):
elif isinstance(f, AngularForce): elif isinstance(f, AngularForce):
if isinstance(f, AngularVectorForce): if isinstance(f, AngularVectorForce):
vec = f.getQuat() vec = f.getQuat()
file.write(fname + ' = AngularVectorForce(Quat(%.4f, %.4f, %.4f))\n' % (vec[0], vec[1], vec[2], vec[3])) file.write(fname + ' = AngularVectorForce(Quat(%.4f, %.4f, %.4f, %.4f))\n' % (vec[0], vec[1], vec[2], vec[3]))
file.write(fname + '.setActive(%d)\n' % f.getActive()) file.write(fname + '.setActive(%d)\n' % f.getActive())
file.write(targ + '.addForce(%s)\n' % fname) file.write(targ + '.addForce(%s)\n' % fname)

View File

@ -1,4 +1,6 @@
from . import ForceGroup from . import ForceGroup
from direct.showbase.PhysicsManagerGlobal import physicsMgr
class GlobalForceGroup(ForceGroup.ForceGroup): class GlobalForceGroup(ForceGroup.ForceGroup):
@ -6,7 +8,7 @@ class GlobalForceGroup(ForceGroup.ForceGroup):
ForceGroup.ForceGroup.__init__(self, name) ForceGroup.ForceGroup.__init__(self, name)
def addForce(self, force): def addForce(self, force):
ForceGroup.ForceGroup.addForce(force) ForceGroup.ForceGroup.addForce(self, force)
if (force.isLinear() == 0): if (force.isLinear() == 0):
# Physics manager will need an angular integrator # Physics manager will need an angular integrator
base.addAngularIntegrator() base.addAngularIntegrator()
@ -16,7 +18,7 @@ class GlobalForceGroup(ForceGroup.ForceGroup):
physicsMgr.addAngularForce(force) physicsMgr.addAngularForce(force)
def removeForce(self, force): def removeForce(self, force):
ForceGroup.ForceGroup.removeForce(force) ForceGroup.ForceGroup.removeForce(self, force)
if (force.isLinear() == 1): if (force.isLinear() == 1):
physicsMgr.removeLinearForce(force) physicsMgr.removeLinearForce(force)
else: else:

View File

@ -30,6 +30,7 @@ from copyreg import dispatch_table
# with the local pickle.py. # with the local pickle.py.
pickle = __import__('pickle') pickle = __import__('pickle')
PicklingError = pickle.PicklingError
BasePickler = pickle._Pickler BasePickler = pickle._Pickler
BaseUnpickler = pickle._Unpickler BaseUnpickler = pickle._Unpickler

View File

@ -34,6 +34,7 @@ __all__ = [
'Semaphore', 'BoundedSemaphore', 'Semaphore', 'BoundedSemaphore',
'Event', 'Event',
'Timer', 'Timer',
'ThreadError',
'local', 'local',
'current_thread', 'current_thread',
'main_thread', 'main_thread',
@ -46,6 +47,7 @@ TIMEOUT_MAX = _thread.TIMEOUT_MAX
local = _thread._local local = _thread._local
_newname = _thread._newname _newname = _thread._newname
ThreadError = _thread.error
class ThreadBase: class ThreadBase:
""" A base class for both Thread and ExternalThread in this """ A base class for both Thread and ExternalThread in this

View File

@ -0,0 +1,19 @@
from direct.particles.GlobalForceGroup import GlobalForceGroup
from panda3d import physics
def test_GlobalForceGroup():
gfg = GlobalForceGroup()
force1 = physics.LinearVectorForce((1, 0, 0))
force2 = physics.LinearVectorForce((0, 1, 0))
gfg.addForce(force1)
assert tuple(gfg) == (force1,)
gfg.addForce(force2)
assert tuple(gfg) == (force1, force2)
gfg.removeForce(force1)
assert tuple(gfg) == (force2,)
gfg.removeForce(force1)
assert tuple(gfg) == (force2,)
gfg.removeForce(force2)
assert tuple(gfg) == ()

View File

@ -1,4 +1,5 @@
from direct.stdpy.pickle import dumps, loads from direct.stdpy.pickle import dumps, loads, PicklingError
import pytest
def test_reduce_persist(): def test_reduce_persist():
@ -9,3 +10,12 @@ def test_reduce_persist():
parent2, child2 = loads(dumps([parent, child])) parent2, child2 = loads(dumps([parent, child]))
assert tuple(parent2.children) == (child2,) assert tuple(parent2.children) == (child2,)
def test_pickle_error():
class ErroneousPickleable(object):
def __reduce__(self):
return 12345
with pytest.raises(PicklingError):
dumps(ErroneousPickleable())

View File

@ -0,0 +1,7 @@
from direct.stdpy import threading
import pytest
def test_threading_error():
with pytest.raises(threading.ThreadError):
threading.stack_size()