diff --git a/cmake/macros/Interrogate.cmake b/cmake/macros/Interrogate.cmake index 7d6300ec7f..eea12f9568 100644 --- a/cmake/macros/Interrogate.cmake +++ b/cmake/macros/Interrogate.cmake @@ -341,10 +341,15 @@ function(add_python_module module) # Keep command lines short file(RELATIVE_PATH workdir_rel "${CMAKE_CURRENT_BINARY_DIR}" "${workdir_abs}") + get_target_property(target_module "${target}" IGATE_MODULE) + if(NOT target_module) + set(target_module "${module}") + endif() + interrogate_sources(${target} "${workdir_abs}/${target}_igate.cxx" "${workdir_abs}/${target}.in" - "-python-native;-module;${module}") + "-python-native;-module;${target_module}") get_target_property(target_extensions "${target}" IGATE_EXTENSIONS) list(APPEND infiles_rel "${workdir_rel}/${target}.in") diff --git a/direct/src/cluster/ClusterClient.py b/direct/src/cluster/ClusterClient.py index e5c0b7ba6a..e0735c6f6f 100644 --- a/direct/src/cluster/ClusterClient.py +++ b/direct/src/cluster/ClusterClient.py @@ -2,14 +2,16 @@ from panda3d.core import ( ClockObject, - ConnectionWriter, Point3, - QueuedConnectionManager, - QueuedConnectionReader, VBase3, Vec3, decomposeMatrix, ) +from panda3d.net import ( + ConnectionWriter, + QueuedConnectionManager, + QueuedConnectionReader, +) from .ClusterMsgs import ( CLUSTER_DAEMON_PORT, CLUSTER_NAMED_MOVEMENT_DONE, diff --git a/direct/src/cluster/ClusterMsgs.py b/direct/src/cluster/ClusterMsgs.py index 299e6cb43f..91e3716c86 100644 --- a/direct/src/cluster/ClusterMsgs.py +++ b/direct/src/cluster/ClusterMsgs.py @@ -3,7 +3,7 @@ # This module is intended to supply routines and dataformats common to # both ClusterClient and ClusterServer. -from panda3d.core import NetDatagram +from panda3d.net import NetDatagram from direct.distributed.PyDatagram import PyDatagram from direct.distributed.PyDatagramIterator import PyDatagramIterator import time diff --git a/direct/src/cluster/ClusterServer.py b/direct/src/cluster/ClusterServer.py index 5d62146cc1..7842c34097 100644 --- a/direct/src/cluster/ClusterServer.py +++ b/direct/src/cluster/ClusterServer.py @@ -1,12 +1,14 @@ from panda3d.core import ( ClockObject, + Vec3, +) +from panda3d.net import ( ConnectionWriter, NetAddress, PointerToConnection, QueuedConnectionListener, QueuedConnectionManager, QueuedConnectionReader, - Vec3, ) from .ClusterMsgs import ( CLUSTER_CAM_FRUSTUM, diff --git a/direct/src/distributed/ServerRepository.py b/direct/src/distributed/ServerRepository.py index 58ffc5dde7..3ae6e90f6d 100644 --- a/direct/src/distributed/ServerRepository.py +++ b/direct/src/distributed/ServerRepository.py @@ -4,19 +4,21 @@ from panda3d.core import ( ConfigVariableBool, ConfigVariableDouble, ConfigVariableInt, - ConnectionWriter, DatagramIterator, Filename, + TPLow, + UniqueIdAllocator, + VirtualFileSystem, + getModelPath, +) +from panda3d.net import ( + ConnectionWriter, NetAddress, NetDatagram, PointerToConnection, QueuedConnectionListener, QueuedConnectionManager, QueuedConnectionReader, - TPLow, - UniqueIdAllocator, - VirtualFileSystem, - getModelPath, ) from panda3d.direct import DCFile from direct.distributed.MsgTypesCMU import ( diff --git a/makepanda/makepanda.py b/makepanda/makepanda.py index 9b9df6a61d..4a06177670 100755 --- a/makepanda/makepanda.py +++ b/makepanda/makepanda.py @@ -2866,7 +2866,8 @@ del_files = ['core.py', 'core.pyc', 'core.pyo', '_core.pyd', '_core.so', 'direct.py', 'direct.pyc', 'direct.pyo', '_direct.pyd', '_direct.so', - 'dtoolconfig.pyd', 'dtoolconfig.so'] + 'dtoolconfig.pyd', 'dtoolconfig.so', + 'net.pyd', 'net.so'] for basename in del_files: path = os.path.join(GetOutputDir(), 'panda3d', basename) @@ -2914,6 +2915,20 @@ if not PkgSkip("PYTHON"): if __debug__: print("Warning: panda3d.dtoolconfig is deprecated, use panda3d.interrogatedb instead.") from .interrogatedb import * +""") + + # Add this for forward compatibility. + ConditionalWriteFile(GetOutputDir() + '/panda3d/net.py', """\ +__all__ = 'BufferedDatagramConnection', 'Buffered_DatagramConnection', 'Connection', 'ConnectionListener', 'ConnectionManager', 'ConnectionReader', 'ConnectionWriter', 'DatagramGeneratorNet', 'DatagramSinkNet', 'Dtool_BorrowThisReference', 'Dtool_PyNativeInterface', 'NetAddress', 'NetDatagram', 'PointerToBaseConnection', 'PointerToBase_Connection', 'PointerToConnection', 'PointerTo_Connection', 'QueuedConnectionListener', 'QueuedConnectionManager', 'QueuedConnectionReader', 'QueuedReturnConnectionListenerData', 'QueuedReturnDatagram', 'QueuedReturnNetDatagram', 'QueuedReturnPointerToConnection', 'QueuedReturn_ConnectionListenerData', 'QueuedReturn_Datagram', 'QueuedReturn_NetDatagram', 'QueuedReturn_PointerTo_Connection', 'RecentConnectionReader', 'SocketAddress', 'SocketFdset', 'SocketIP', 'SocketTCP', 'SocketTCPListen', 'SocketUDP', 'SocketUDPIncoming', 'SocketUDPOutgoing', 'Socket_Address', 'Socket_IP', 'Socket_TCP', 'Socket_TCP_Listen', 'Socket_UDP', 'Socket_UDP_Incoming', 'Socket_UDP_Outgoing', 'Socket_fdset' + +from . import core + +scope = globals() +for name in __all__: + if hasattr(core, name): + scope[name] = getattr(core, name) + +del core, scope, name """) # PandaModules is now deprecated; generate a shim for backward compatibility. @@ -3904,7 +3919,7 @@ if GetTarget() != 'emscripten': OPTS=['DIR:panda/src/nativenet'] IGATEFILES=GetDirectoryContents('panda/src/nativenet', ["*.h", "*_composite*.cxx"]) TargetAdd('libp3nativenet.in', opts=OPTS, input=IGATEFILES) -TargetAdd('libp3nativenet.in', opts=['IMOD:panda3d.core', 'ILIB:libp3nativenet', 'SRCDIR:panda/src/nativenet']) +TargetAdd('libp3nativenet.in', opts=['IMOD:panda3d.net', 'ILIB:libp3nativenet', 'SRCDIR:panda/src/nativenet']) # # DIRECTORY: panda/src/net/ @@ -3919,7 +3934,7 @@ OPTS=['DIR:panda/src/net'] IGATEFILES=GetDirectoryContents('panda/src/net', ["*.h", "*_composite*.cxx"]) IGATEFILES.remove("datagram_ui.h") TargetAdd('libp3net.in', opts=OPTS, input=IGATEFILES) -TargetAdd('libp3net.in', opts=['IMOD:panda3d.core', 'ILIB:libp3net', 'SRCDIR:panda/src/net']) +TargetAdd('libp3net.in', opts=['IMOD:panda3d.net', 'ILIB:libp3net', 'SRCDIR:panda/src/net']) # # DIRECTORY: panda/src/pstatclient/ diff --git a/panda/CMakeLists.txt b/panda/CMakeLists.txt index 99a2d65fe4..cb33932d9c 100644 --- a/panda/CMakeLists.txt +++ b/panda/CMakeLists.txt @@ -135,6 +135,18 @@ ${win32_init}") if __debug__: print(\"Warning: panda3d.dtoolconfig is deprecated, use panda3d.interrogatedb instead.\") from .interrogatedb import * +") + + set(net_file "__all__ = 'BufferedDatagramConnection', 'Buffered_DatagramConnection', 'Connection', 'ConnectionListener', 'ConnectionManager', 'ConnectionReader', 'ConnectionWriter', 'DatagramGeneratorNet', 'DatagramSinkNet', 'Dtool_BorrowThisReference', 'Dtool_PyNativeInterface', 'NetAddress', 'NetDatagram', 'PointerToBaseConnection', 'PointerToBase_Connection', 'PointerToConnection', 'PointerTo_Connection', 'QueuedConnectionListener', 'QueuedConnectionManager', 'QueuedConnectionReader', 'QueuedReturnConnectionListenerData', 'QueuedReturnDatagram', 'QueuedReturnNetDatagram', 'QueuedReturnPointerToConnection', 'QueuedReturn_ConnectionListenerData', 'QueuedReturn_Datagram', 'QueuedReturn_NetDatagram', 'QueuedReturn_PointerTo_Connection', 'RecentConnectionReader', 'SocketAddress', 'SocketFdset', 'SocketIP', 'SocketTCP', 'SocketTCPListen', 'SocketUDP', 'SocketUDPIncoming', 'SocketUDPOutgoing', 'Socket_Address', 'Socket_IP', 'Socket_TCP', 'Socket_TCP_Listen', 'Socket_UDP', 'Socket_UDP_Incoming', 'Socket_UDP_Outgoing', 'Socket_fdset' + +from . import core + +scope = globals() +for name in __all__: + if hasattr(core, name): + scope[name] = getattr(core, name) + +del core, scope, name ") if(IS_MULTICONFIG) @@ -142,10 +154,16 @@ from .interrogatedb import * # Generate an __init__.py in the per-configuration directory. file(WRITE "${PROJECT_BINARY_DIR}/${config}/panda3d/__init__.py" ${init_file}) file(WRITE "${PROJECT_BINARY_DIR}/${config}/panda3d/dtoolconfig.py" ${dtoolconfig_file}) + if(HAVE_NET) + file(WRITE "${PROJECT_BINARY_DIR}/${config}/panda3d/net.py" ${net_file}) + endif() endforeach(config) else() file(WRITE "${PROJECT_BINARY_DIR}/panda3d/__init__.py" ${init_file}) file(WRITE "${PROJECT_BINARY_DIR}/panda3d/dtoolconfig.py" ${dtoolconfig_file}) + if(HAVE_NET) + file(WRITE "${PROJECT_BINARY_DIR}/${config}/panda3d/net.py" ${net_file}) + endif() endif() # Also generate a panda3d.dist-info directory. diff --git a/panda/src/nativenet/CMakeLists.txt b/panda/src/nativenet/CMakeLists.txt index d9071630e6..381a1cf66a 100644 --- a/panda/src/nativenet/CMakeLists.txt +++ b/panda/src/nativenet/CMakeLists.txt @@ -37,6 +37,10 @@ add_component_library(p3nativenet SYMBOL BUILDING_PANDA_NATIVENET target_link_libraries(p3nativenet p3pandabase pandaexpress) target_interrogate(p3nativenet ALL) +# These are temporarily built with -module panda3d.net, even though they are +# still part of panda3d.core, see #1466 +set_target_properties(p3nativenet PROPERTIES IGATE_MODULE panda3d.net) + if(NOT BUILD_METALIBS) install(TARGETS p3nativenet EXPORT Core COMPONENT Core diff --git a/panda/src/net/CMakeLists.txt b/panda/src/net/CMakeLists.txt index d811b806e8..6c0d3e79c3 100644 --- a/panda/src/net/CMakeLists.txt +++ b/panda/src/net/CMakeLists.txt @@ -36,6 +36,10 @@ add_component_library(p3net SYMBOL BUILDING_PANDA_NET target_link_libraries(p3net p3nativenet p3pipeline p3pandabase pandaexpress) target_interrogate(p3net ALL) +# These are temporarily built with -module panda3d.net, even though they are +# still part of panda3d.core, see #1466 +set_target_properties(p3net PROPERTIES IGATE_MODULE panda3d.net) + if(WIN32) target_link_libraries(p3net iphlpapi.lib) endif()