mirror of
https://github.com/panda3d/panda3d.git
synced 2025-09-30 16:58:40 -04:00
windows issues
This commit is contained in:
parent
201cdf2c86
commit
58555a2895
@ -303,6 +303,12 @@ class AppRunner(DirectObject):
|
||||
if mainName:
|
||||
moduleName = mainName
|
||||
|
||||
# Temporarily clear this flag while we import the app, so
|
||||
# that if the app calls run() within its own main.py, it
|
||||
# will properly get ignored by ShowBase.
|
||||
interactiveConsole = self.interactiveConsole
|
||||
self.interactiveConsole = False
|
||||
|
||||
try:
|
||||
__import__(moduleName)
|
||||
except ImportError:
|
||||
@ -312,6 +318,9 @@ class AppRunner(DirectObject):
|
||||
if hasattr(main, 'main') and callable(main.main):
|
||||
main.main(self)
|
||||
|
||||
# Now restore this flag.
|
||||
self.interactiveConsole = interactiveConsole
|
||||
|
||||
if self.interactiveConsole:
|
||||
# At this point, we have successfully loaded the app.
|
||||
# If the interactive_console flag is enabled, stop the
|
||||
|
@ -435,6 +435,9 @@ class Packager:
|
||||
# files). This will include the extension modules we just
|
||||
# discovered above.
|
||||
for file in self.files:
|
||||
if file.isExcluded(self):
|
||||
# Skip this file.
|
||||
continue
|
||||
ext = Filename(file.newName).getExtension()
|
||||
if file.unprocessed:
|
||||
# Add an unprocessed file verbatim.
|
||||
@ -466,6 +469,9 @@ class Packager:
|
||||
# We walk through the list as we modify it. That's OK,
|
||||
# because we may add new files that we want to process.
|
||||
for file in self.files:
|
||||
if file.isExcluded(self):
|
||||
# Skip this file.
|
||||
continue
|
||||
ext = Filename(file.newName).getExtension()
|
||||
if file.unprocessed:
|
||||
# Already handled, above.
|
||||
|
@ -130,14 +130,32 @@ run_python() {
|
||||
|
||||
// We'll need libpandaexpress to be imported before we can load
|
||||
// _vfsimporter. So, find it and load it.
|
||||
Filename libpandaexpress(_archive_file.get_dirname(),
|
||||
Filename::dso_filename("libpandaexpress.so"));
|
||||
#if defined(__APPLE__) && PY_VERSION_HEX < 0x02050000
|
||||
// On OSX, for Python versions 2.4 and before, we have to load the
|
||||
// .so file, not the .dylib file.
|
||||
libpandaexpress.set_type(Filename::T_general);
|
||||
#endif
|
||||
Filename libpandaexpress;
|
||||
|
||||
#ifdef _WIN32
|
||||
// Of course it's already resident, so use that version.
|
||||
HMODULE h = GetModuleHandle("libpandaexpress.dll");
|
||||
if (h == NULL) {
|
||||
nout << "Can't find libpandaexpress in memory.\n";
|
||||
} else {
|
||||
static const int buffer_size = 4096;
|
||||
char buffer[buffer_size];
|
||||
GetModuleFileName(h, buffer, buffer_size);
|
||||
libpandaexpress = Filename::from_os_specific(buffer);
|
||||
}
|
||||
#endif // _WIN32
|
||||
|
||||
if (libpandaexpress.empty()) {
|
||||
// Go look for it on disk.
|
||||
libpandaexpress = Filename(_archive_file.get_dirname(),
|
||||
Filename::dso_filename("libpandaexpress.so"));
|
||||
#if defined(__APPLE__) && PY_VERSION_HEX < 0x02050000
|
||||
// On OSX, for Python versions 2.4 and before, we have to load the
|
||||
// .so file, not the .dylib file.
|
||||
libpandaexpress.set_type(Filename::T_general);
|
||||
#endif
|
||||
}
|
||||
|
||||
if (!libpandaexpress.exists()) {
|
||||
nout << "Can't find " << libpandaexpress << "\n";
|
||||
return false;
|
||||
@ -350,12 +368,19 @@ run_python() {
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void P3DPythonRun::
|
||||
run_interactive_console() {
|
||||
#ifdef _WIN32
|
||||
// Make sure that control-C support is enabled for the interpreter.
|
||||
SetConsoleCtrlHandler(NULL, false);
|
||||
#endif
|
||||
|
||||
// The "readline" module makes the Python prompt friendlier, with
|
||||
// command history and everything. Simply importing it is
|
||||
// sufficient.
|
||||
PyObject *readline_module = PyImport_ImportModule("readline");
|
||||
if (readline_module == NULL) {
|
||||
PyErr_Print();
|
||||
// But, the module might not exist on certain platforms. If not,
|
||||
// no sweat.
|
||||
PyErr_Clear();
|
||||
} else {
|
||||
Py_DECREF(readline_module);
|
||||
}
|
||||
|
@ -148,11 +148,13 @@ run(int argc, char *argv[]) {
|
||||
token._value = "1";
|
||||
_tokens.push_back(token);
|
||||
|
||||
#ifndef _WIN32
|
||||
// We should also ignore SIGINT in this case, so that a
|
||||
// control-C operation will be delivered to the subordinate
|
||||
// Python process and return to a command shell, and won't
|
||||
// just kill the panda3d process.
|
||||
// We should also ignore control-C in this case, so that an
|
||||
// interrupt will be delivered to the subordinate Python
|
||||
// process and return to a command shell, and won't just kill
|
||||
// the panda3d process.
|
||||
#ifdef _WIN32
|
||||
SetConsoleCtrlHandler(NULL, true);
|
||||
#else
|
||||
struct sigaction ignore;
|
||||
memset(&ignore, 0, sizeof(ignore));
|
||||
ignore.sa_handler = SIG_IGN;
|
||||
|
Loading…
x
Reference in New Issue
Block a user