Merge branch 'release/1.10.x'

This commit is contained in:
rdb
2024-10-31 13:13:00 +01:00
6 changed files with 55 additions and 16 deletions

View File

@@ -75,6 +75,7 @@ def _model_to_bam(_build_cmd, srcpath, dstpath):
src_fn = p3d.Filename.from_os_specific(srcpath)
dst_fn = p3d.Filename.from_os_specific(dstpath)
dst_fn.set_binary()
_register_python_loaders()
@@ -85,8 +86,30 @@ def _model_to_bam(_build_cmd, srcpath, dstpath):
if not node:
raise IOError('Failed to load model: %s' % (srcpath))
if not p3d.NodePath(node).write_bam_file(dst_fn):
raise IOError('Failed to write .bam file: %s' % (dstpath))
stream = p3d.OFileStream()
if not dst_fn.open_write(stream):
raise IOError('Failed to open .bam file for writing: %s' % (dstpath))
# We pass it the source filename here so that texture files are made
# relative to the original pathname and don't point from the destination
# back into the source directory.
dout = p3d.DatagramOutputFile()
if not dout.open(stream, src_fn) or not dout.write_header("pbj\0\n\r"):
raise IOError('Failed to write to .bam file: %s' % (dstpath))
writer = p3d.BamWriter(dout)
writer.root_node = node
writer.init()
if _build_cmd.bam_embed_textures:
writer.set_file_texture_mode(p3d.BamEnums.BTM_rawdata)
else:
writer.set_file_texture_mode(p3d.BamEnums.BTM_relative)
writer.write_object(node)
writer.flush()
writer = None
dout.close()
dout = None
stream.close()
macosx_binary_magics = (
@@ -312,6 +335,7 @@ class build_apps(setuptools.Command):
]
self.file_handlers = {}
self.bam_model_extensions = ['.egg', '.gltf', '.glb']
self.bam_embed_textures = False
self.exclude_dependencies = [
# Windows
'kernel32.dll', 'user32.dll', 'wsock32.dll', 'ws2_32.dll',
@@ -326,7 +350,8 @@ class build_apps(setuptools.Command):
# manylinux1/linux
'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.*', 'ld-linux-aarch64.so.*',
'libgl.so.*', 'libx11.so.*', 'libncursesw.so.*', 'libz.so.*',
'librt.so.*', 'libutil.so.*', 'libnsl.so.1', 'libXext.so.6',
'libXrender.so.1', 'libICE.so.6', 'libSM.so.6', 'libEGL.so.1',

View File

@@ -725,11 +725,16 @@ def makewheel(version, output_dir, platform=None):
whl.ignore_deps.update(MANYLINUX_LIBS)
# Add libpython for deployment.
suffix = ''
gil_disabled = get_config_var("Py_GIL_DISABLED")
if gil_disabled and int(gil_disabled):
suffix = 't'
if is_windows:
pylib_name = 'python{0}{1}.dll'.format(*sys.version_info)
pylib_name = 'python{0}{1}{2}.dll'.format(sys.version_info[0], sys.version_info[1], suffix)
pylib_path = os.path.join(get_config_var('BINDIR'), pylib_name)
elif is_macosx:
pylib_name = 'libpython{0}.{1}.dylib'.format(*sys.version_info)
pylib_name = 'libpython{0}.{1}{2}.dylib'.format(sys.version_info[0], sys.version_info[1], suffix)
pylib_path = os.path.join(get_config_var('LIBDIR'), pylib_name)
else:
pylib_name = get_config_var('LDLIBRARY')

View File

@@ -14,7 +14,7 @@ import tempfile
from optparse import OptionParser
def test_wheel(wheel, verbose=False):
def test_wheel(wheel, verbose=False, ignores=[]):
envdir = tempfile.mkdtemp(prefix="venv-")
print("Setting up virtual environment in {0}".format(envdir))
sys.stdout.flush()
@@ -61,6 +61,9 @@ def test_wheel(wheel, verbose=False):
test_cmd = [python, "-m", "pytest", "tests"]
if verbose:
test_cmd.append("--verbose")
for ignore in ignores:
test_cmd.append("--ignore")
test_cmd.append(ignore)
# Put the location of the python DLL on the path, for deploy-stub test
# This is needed because venv does not install a copy of the python DLL
@@ -87,6 +90,7 @@ def test_wheel(wheel, verbose=False):
if __name__ == "__main__":
parser = OptionParser(usage="%prog [options] file...")
parser.add_option('', '--verbose', dest = 'verbose', help = 'Enable verbose output', action = 'store_true', default = False)
parser.add_option('', '--ignore', dest = 'ignores', help = 'Ignores given test directory (may be repeated)', action = 'append', default = [])
(options, args) = parser.parse_args()
if not args:
@@ -94,4 +98,4 @@ if __name__ == "__main__":
sys.exit(1)
for arg in args:
test_wheel(arg, verbose=options.verbose)
test_wheel(arg, verbose=options.verbose, ignores=options.ignores)

View File

@@ -10183,13 +10183,15 @@ do_write_datagram_header(CData *cdata, BamWriter *manager, Datagram &me, bool &h
<< "Texture file " << cdata->_fullpath
<< " found as " << filename << "\n";
}
if (!has_bam_dir || !alpha_filename.make_relative_to(bam_dir, true)) {
alpha_filename.find_on_searchpath(get_model_path());
}
if (gobj_cat.is_debug()) {
gobj_cat.debug()
<< "Alpha image " << cdata->_alpha_fullpath
<< " found as " << alpha_filename << "\n";
if (!alpha_filename.empty()) {
if (!has_bam_dir || !alpha_filename.make_relative_to(bam_dir, true)) {
alpha_filename.find_on_searchpath(get_model_path());
}
if (gobj_cat.is_debug()) {
gobj_cat.debug()
<< "Alpha image " << cdata->_alpha_fullpath
<< " found as " << alpha_filename << "\n";
}
}
break;

View File

@@ -96,6 +96,9 @@ get_file_texture_mode() const {
* Changes the BamTextureMode preference for the Bam file currently being
* written. Texture objects written to this Bam file will be encoded
* according to the specified mode.
*
* This should be called after the call to init(), or it will be overwritten
* with the default mode in the config file.
*/
INLINE void BamWriter::
set_file_texture_mode(BamTextureMode file_texture_mode) {

View File

@@ -96,7 +96,7 @@ PUBLISHED:
MAKE_PROPERTY(file_version, get_file_version);
MAKE_PROPERTY(file_endian, get_file_endian);
MAKE_PROPERTY(file_stdfloat_double, get_file_stdfloat_double);
MAKE_PROPERTY(file_texture_mode, get_file_texture_mode);
MAKE_PROPERTY(file_texture_mode, get_file_texture_mode, set_file_texture_mode);
MAKE_PROPERTY(root_node, get_root_node, set_root_node);
public:
@@ -135,7 +135,7 @@ private:
// Stores the PandaNode representing the root of the node hierarchy we are
// currently writing, if any, for the purpose of writing NodePaths. This is
// a TypedWritable since PandaNode is defined in pgraph.
TypedWritable *_root_node;
TypedWritable *_root_node = nullptr;
// This is the set of all TypeHandles already written.
pset<int, int_hash> _types_written;