some fixes
This commit is contained in:
parent
d0c99e9288
commit
e7daad7dce
|
|
@ -1236,6 +1236,8 @@ report_package_progress(P3DPackage *package, double progress) {
|
|||
////////////////////////////////////////////////////////////////////
|
||||
void P3DInstance::
|
||||
report_package_done(P3DPackage *package, bool success) {
|
||||
nout << "Done downloading " << package->get_package_name()
|
||||
<< ": success = " << success << "\n";
|
||||
if (success) {
|
||||
report_package_progress(package, 1.0);
|
||||
start_next_download();
|
||||
|
|
|
|||
|
|
@ -231,7 +231,7 @@ download_desc_file() {
|
|||
// Attempt to check the desc file for freshness. If it already
|
||||
// exists, and is consistent with the server contents file, we don't
|
||||
// need to re-download it.
|
||||
string root_dir = inst_mgr->get_root_dir();
|
||||
string root_dir = inst_mgr->get_root_dir() + "/packages";
|
||||
FileSpec desc_file;
|
||||
if (!inst_mgr->get_package_desc_file(desc_file, _package_name, _package_version)) {
|
||||
nout << "Couldn't find package " << _package_fullname
|
||||
|
|
@ -242,7 +242,7 @@ download_desc_file() {
|
|||
<< desc_file.get_pathname(root_dir)
|
||||
<< " instead of " << _desc_file_pathname << "\n";
|
||||
|
||||
} else if (!desc_file.quick_verify(root_dir)) {
|
||||
} else if (!desc_file.full_verify(root_dir)) {
|
||||
nout << _desc_file_pathname << " is stale.\n";
|
||||
|
||||
} else {
|
||||
|
|
@ -337,6 +337,7 @@ got_desc_file(TiXmlDocument *doc, bool freshly_downloaded) {
|
|||
Extracts::iterator ci;
|
||||
for (ci = _extracts.begin(); ci != _extracts.end(); ++ci) {
|
||||
if (!(*ci).quick_verify(_package_dir)) {
|
||||
nout << "File is incorrect: " << (*ci).get_filename() << "\n";
|
||||
all_extracts_ok = false;
|
||||
break;
|
||||
}
|
||||
|
|
@ -664,9 +665,22 @@ report_done(bool success) {
|
|||
_failed = true;
|
||||
}
|
||||
|
||||
Instances::iterator ii;
|
||||
for (ii = _instances.begin(); ii != _instances.end(); ++ii) {
|
||||
(*ii)->report_package_done(this, success);
|
||||
if (!_allow_data_download && success) {
|
||||
// If we haven't been authorized to start downloading yet, just
|
||||
// report that we're ready to start, but that we don't have to
|
||||
// download anything.
|
||||
_download_size = 0;
|
||||
Instances::iterator ii;
|
||||
for (ii = _instances.begin(); ii != _instances.end(); ++ii) {
|
||||
(*ii)->report_package_info_ready(this);
|
||||
}
|
||||
|
||||
} else {
|
||||
// Otherwise, we can report that we're fully downloaded.
|
||||
Instances::iterator ii;
|
||||
for (ii = _instances.begin(); ii != _instances.end(); ++ii) {
|
||||
(*ii)->report_package_done(this, success);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -325,12 +325,22 @@ get_plugin(const string &download_url, const string &this_platform, bool force_d
|
|||
|
||||
HTTPClient *http = HTTPClient::get_global_ptr();
|
||||
PT(HTTPChannel) channel = http->get_document(url);
|
||||
contents_filename.make_dir();
|
||||
if (!channel->download_to_file(contents_filename)) {
|
||||
|
||||
// First, download it to a temporary file.
|
||||
Filename tempfile = Filename::temporary("", "p3d_");
|
||||
if (!channel->download_to_file(tempfile)) {
|
||||
cerr << "Unable to download " << url << "\n";
|
||||
return false;
|
||||
tempfile.unlink();
|
||||
|
||||
// Couldn't download, but fall through and try to read the
|
||||
// contents.xml file anyway. Maybe it's good enough.
|
||||
} else {
|
||||
// Successfully downloaded; move the temporary file into place.
|
||||
contents_filename.make_dir();
|
||||
contents_filename.unlink();
|
||||
tempfile.rename_to(contents_filename);
|
||||
}
|
||||
|
||||
|
||||
return read_contents_file(contents_filename, download_url, this_platform);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ from distutils.sysconfig import PREFIX, get_python_inc, get_python_version
|
|||
|
||||
import direct
|
||||
from pandac.PandaModules import *
|
||||
from pandac.extension_native_helpers import dll_suffix, dll_ext
|
||||
|
||||
# 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.
|
||||
|
|
@ -654,7 +655,7 @@ class Freezer:
|
|||
excludes.append(mdef.moduleName)
|
||||
excludeDict[mdef.moduleName] = token
|
||||
|
||||
self.mf = modulefinder.ModuleFinder(excludes = excludes)
|
||||
self.mf = PandaModuleFinder(excludes = excludes)
|
||||
|
||||
# Attempt to import the explicit modules into the modulefinder.
|
||||
for mdef in includes:
|
||||
|
|
@ -1148,3 +1149,31 @@ class Freezer:
|
|||
return False
|
||||
|
||||
return True
|
||||
|
||||
class PandaModuleFinder(modulefinder.ModuleFinder):
|
||||
""" We subclass ModuleFinder here, to add functionality for
|
||||
finding the libpandaexpress etc. modules that interrogate
|
||||
produces. """
|
||||
|
||||
def find_module(self, name, path, parent=None):
|
||||
try:
|
||||
return modulefinder.ModuleFinder.find_module(self, name, path, parent = parent)
|
||||
except ImportError:
|
||||
# It wasn't found. Maybe it's one of ours.
|
||||
if path:
|
||||
# Only if we're not looking on a particular path,
|
||||
# though.
|
||||
raise
|
||||
|
||||
# This loop is roughly lifted from
|
||||
# extension_native_helpers.Dtool_PreloadDLL().
|
||||
filename = name + dll_suffix + dll_ext
|
||||
for dir in sys.path + [sys.prefix]:
|
||||
lib = os.path.join(dir, filename)
|
||||
if os.path.exists(lib):
|
||||
file = open(lib, 'rb')
|
||||
return (file, lib, (dll_ext, 'rb', 3))
|
||||
|
||||
message = "DLL loader cannot find %s." % (name)
|
||||
raise ImportError, message
|
||||
|
||||
|
|
|
|||
|
|
@ -325,6 +325,13 @@ class Packager:
|
|||
# Don't bother, it's already here.
|
||||
return
|
||||
|
||||
if file.newName in self.targetFilenames:
|
||||
# Another file is already in the same place.
|
||||
file2 = self.targetFilenames[file.newName]
|
||||
self.packager.notify.warning(
|
||||
"%s is shadowing %s" % (file2.filename, file.filename))
|
||||
return
|
||||
|
||||
self.sourceFilenames[file.filename] = file
|
||||
|
||||
if not file.filename.exists():
|
||||
|
|
@ -1035,7 +1042,7 @@ class Packager:
|
|||
'dciman32.dll', 'comdlg32.dll', 'comctl32.dll', 'ole32.dll',
|
||||
'oleaut32.dll', 'gdiplus.dll', 'winmm.dll',
|
||||
|
||||
'libSystem.B.dylib', 'libmathCommon.A.dylib', 'libmx.A.dylib',
|
||||
'libsystem.b.dylib', 'libmathcommon.a.dylib', 'libmx.a.dylib',
|
||||
'libstdc++.6.dylib',
|
||||
]
|
||||
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ See pack3d.py for a script that generates these p3d files.
|
|||
import sys
|
||||
from direct.showbase import VFSImporter
|
||||
from direct.showbase.DirectObject import DirectObject
|
||||
from pandac.PandaModules import VirtualFileSystem, Filename, Multifile, loadPrcFileData, unloadPrcFile, getModelPath, HTTPClient, Thread, WindowProperties, readXmlStream
|
||||
from pandac.PandaModules import VirtualFileSystem, Filename, Multifile, loadPrcFileData, unloadPrcFile, getModelPath, HTTPClient, Thread, WindowProperties, readXmlStream, ExecutionEnvironment
|
||||
from direct.stdpy import file
|
||||
from direct.task.TaskManagerGlobal import taskMgr
|
||||
from direct.showbase.MessengerGlobal import messenger
|
||||
|
|
@ -291,7 +291,7 @@ class AppRunner(DirectObject):
|
|||
if self.p3dPackage:
|
||||
fullDiskAccess = self.p3dPackage.Attribute('full_disk_access')
|
||||
try:
|
||||
self.fullDiskAccess = int(fullDiskAccess)
|
||||
self.fullDiskAccess = int(fullDiskAccess or '')
|
||||
except ValueError:
|
||||
pass
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue