From afd7fc8a2530278944cd9c030f17f47b78fea83b Mon Sep 17 00:00:00 2001 From: rdb Date: Tue, 31 Dec 2019 17:15:07 +0100 Subject: [PATCH 01/22] dxgsg9: don't try to Release() vertex buffer if it failed to create --- panda/src/dxgsg9/dxGraphicsStateGuardian9.cxx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/panda/src/dxgsg9/dxGraphicsStateGuardian9.cxx b/panda/src/dxgsg9/dxGraphicsStateGuardian9.cxx index ca3fb07d79..bd36f99da3 100644 --- a/panda/src/dxgsg9/dxGraphicsStateGuardian9.cxx +++ b/panda/src/dxgsg9/dxGraphicsStateGuardian9.cxx @@ -615,8 +615,10 @@ release_vertex_buffer(VertexBufferContext *vbc) { } #endif - dvbc->_vbuffer->Release(); - dvbc->_vbuffer = nullptr; + if (dvbc->_vbuffer != nullptr) { + dvbc->_vbuffer->Release(); + dvbc->_vbuffer = nullptr; + } delete dvbc; } From c02bbe50afd97c46e87b666e9ae1e223f5da9b2f Mon Sep 17 00:00:00 2001 From: rdb Date: Tue, 31 Dec 2019 17:15:34 +0100 Subject: [PATCH 02/22] p3d: add deprecation notice to all direct.p3d modules --- direct/src/p3d/DWBPackageInstaller.py | 5 +++++ direct/src/p3d/FileSpec.py | 5 +++++ direct/src/p3d/HostInfo.py | 5 +++++ direct/src/p3d/InstalledHostData.py | 5 +++++ direct/src/p3d/InstalledPackageData.py | 5 +++++ direct/src/p3d/PackageInfo.py | 5 +++++ direct/src/p3d/PackageInstaller.py | 5 +++++ direct/src/p3d/PackageMerger.py | 5 +++++ direct/src/p3d/PatchMaker.py | 5 +++++ direct/src/p3d/ScanDirectoryNode.py | 5 +++++ direct/src/p3d/SeqValue.py | 5 +++++ 11 files changed, 55 insertions(+) diff --git a/direct/src/p3d/DWBPackageInstaller.py b/direct/src/p3d/DWBPackageInstaller.py index c4daa67cb1..3f9aab4c77 100644 --- a/direct/src/p3d/DWBPackageInstaller.py +++ b/direct/src/p3d/DWBPackageInstaller.py @@ -1,3 +1,8 @@ +""" +.. deprecated:: 1.10.0 + The p3d packaging system has been replaced with the new setuptools-based + system. See the :ref:`distribution` manual section. +""" __all__ = ["DWBPackageInstaller"] from direct.p3d.PackageInstaller import PackageInstaller diff --git a/direct/src/p3d/FileSpec.py b/direct/src/p3d/FileSpec.py index ddd1dafd6e..c709426e37 100644 --- a/direct/src/p3d/FileSpec.py +++ b/direct/src/p3d/FileSpec.py @@ -1,3 +1,8 @@ +""" +.. deprecated:: 1.10.0 + The p3d packaging system has been replaced with the new setuptools-based + system. See the :ref:`distribution` manual section. +""" __all__ = ["FileSpec"] import os diff --git a/direct/src/p3d/HostInfo.py b/direct/src/p3d/HostInfo.py index 4e5efdcd3e..08b2081497 100644 --- a/direct/src/p3d/HostInfo.py +++ b/direct/src/p3d/HostInfo.py @@ -1,3 +1,8 @@ +""" +.. deprecated:: 1.10.0 + The p3d packaging system has been replaced with the new setuptools-based + system. See the :ref:`distribution` manual section. +""" __all__ = ["HostInfo"] from panda3d.core import HashVal, Filename, PandaSystem, DocumentSpec, Ramfile diff --git a/direct/src/p3d/InstalledHostData.py b/direct/src/p3d/InstalledHostData.py index d98abb6d18..1a8a0f9dba 100644 --- a/direct/src/p3d/InstalledHostData.py +++ b/direct/src/p3d/InstalledHostData.py @@ -1,3 +1,8 @@ +""" +.. deprecated:: 1.10.0 + The p3d packaging system has been replaced with the new setuptools-based + system. See the :ref:`distribution` manual section. +""" __all__ = ["InstalledHostData"] from panda3d.core import URLSpec diff --git a/direct/src/p3d/InstalledPackageData.py b/direct/src/p3d/InstalledPackageData.py index 09ee81cda6..34af2163e3 100644 --- a/direct/src/p3d/InstalledPackageData.py +++ b/direct/src/p3d/InstalledPackageData.py @@ -1,3 +1,8 @@ +""" +.. deprecated:: 1.10.0 + The p3d packaging system has been replaced with the new setuptools-based + system. See the :ref:`distribution` manual section. +""" __all__ = ["InstalledPackageData"] class InstalledPackageData: diff --git a/direct/src/p3d/PackageInfo.py b/direct/src/p3d/PackageInfo.py index 08a73365b8..324a87546d 100644 --- a/direct/src/p3d/PackageInfo.py +++ b/direct/src/p3d/PackageInfo.py @@ -1,3 +1,8 @@ +""" +.. deprecated:: 1.10.0 + The p3d packaging system has been replaced with the new setuptools-based + system. See the :ref:`distribution` manual section. +""" __all__ = ["PackageInfo"] from panda3d.core import Filename, DocumentSpec, Multifile, Decompressor, EUOk, EUSuccess, VirtualFileSystem, Thread, getModelPath, ExecutionEnvironment, PStatCollector, TiXmlDocument, TiXmlDeclaration, TiXmlElement diff --git a/direct/src/p3d/PackageInstaller.py b/direct/src/p3d/PackageInstaller.py index cec1e07b11..3f17604071 100644 --- a/direct/src/p3d/PackageInstaller.py +++ b/direct/src/p3d/PackageInstaller.py @@ -1,3 +1,8 @@ +""" +.. deprecated:: 1.10.0 + The p3d packaging system has been replaced with the new setuptools-based + system. See the :ref:`distribution` manual section. +""" __all__ = ["PackageInstaller"] from direct.showbase.DirectObject import DirectObject diff --git a/direct/src/p3d/PackageMerger.py b/direct/src/p3d/PackageMerger.py index a22d8f5f2d..ac4b614732 100644 --- a/direct/src/p3d/PackageMerger.py +++ b/direct/src/p3d/PackageMerger.py @@ -1,3 +1,8 @@ +""" +.. deprecated:: 1.10.0 + The p3d packaging system has been replaced with the new setuptools-based + system. See the :ref:`distribution` manual section. +""" __all__ = ["PackageMerger", "PackageMergerError"] from direct.p3d.FileSpec import FileSpec diff --git a/direct/src/p3d/PatchMaker.py b/direct/src/p3d/PatchMaker.py index c1624b3cc1..6c50df2e0c 100644 --- a/direct/src/p3d/PatchMaker.py +++ b/direct/src/p3d/PatchMaker.py @@ -1,3 +1,8 @@ +""" +.. deprecated:: 1.10.0 + The p3d packaging system has been replaced with the new setuptools-based + system. See the :ref:`distribution` manual section. +""" __all__ = ["PatchMaker"] from direct.p3d.FileSpec import FileSpec diff --git a/direct/src/p3d/ScanDirectoryNode.py b/direct/src/p3d/ScanDirectoryNode.py index 429b8f0fd2..c38431101d 100644 --- a/direct/src/p3d/ScanDirectoryNode.py +++ b/direct/src/p3d/ScanDirectoryNode.py @@ -1,3 +1,8 @@ +""" +.. deprecated:: 1.10.0 + The p3d packaging system has been replaced with the new setuptools-based + system. See the :ref:`distribution` manual section. +""" __all__ = ["ScanDirectoryNode"] from panda3d.core import VirtualFileSystem, VirtualFileMountSystem, Filename, TiXmlDocument diff --git a/direct/src/p3d/SeqValue.py b/direct/src/p3d/SeqValue.py index 958132f74b..2fa01ace34 100644 --- a/direct/src/p3d/SeqValue.py +++ b/direct/src/p3d/SeqValue.py @@ -1,3 +1,8 @@ +""" +.. deprecated:: 1.10.0 + The p3d packaging system has been replaced with the new setuptools-based + system. See the :ref:`distribution` manual section. +""" __all__ = ["SeqValue"] class SeqValue: From 2b9cc61d0428bd4ce79eabf0a189ec10596662e7 Mon Sep 17 00:00:00 2001 From: rdb Date: Thu, 2 Jan 2020 00:36:29 +0100 Subject: [PATCH 03/22] grutil: fix wrong method name in LineSegs docstrings --- panda/src/grutil/lineSegs.I | 2 +- panda/src/grutil/lineSegs.cxx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/panda/src/grutil/lineSegs.I b/panda/src/grutil/lineSegs.I index 5236f13b74..5a7b533e1d 100644 --- a/panda/src/grutil/lineSegs.I +++ b/panda/src/grutil/lineSegs.I @@ -99,7 +99,7 @@ draw_to(PN_stdfloat x, PN_stdfloat y, PN_stdfloat z) { * Creates a new GeomNode that will render the series of line segments and * points described via calls to move_to() and draw_to(). The lines and * points are created with the color and thickness established by calls to - * set_color() and set_thick(). + * set_color() and set_thickness(). * * If dynamic is true, the line segments will be created with the dynamic Geom * setting, optimizing them for runtime vertex animation. diff --git a/panda/src/grutil/lineSegs.cxx b/panda/src/grutil/lineSegs.cxx index 534c1f5700..bdf7912d7e 100644 --- a/panda/src/grutil/lineSegs.cxx +++ b/panda/src/grutil/lineSegs.cxx @@ -164,7 +164,7 @@ get_current_position() { * Appends to an existing GeomNode a new Geom that will render the series of * line segments and points described via calls to move_to() and draw_to(). * The lines and points are created with the color and thickness established - * by calls to set_color() and set_thick(). + * by calls to set_color() and set_thickness(). * * If dynamic is true, the line segments will be created with the dynamic Geom * setting, optimizing them for runtime vertex animation. From 7ca66bfe6f1634abc3f73d843e3318f98d09e278 Mon Sep 17 00:00:00 2001 From: rdb Date: Thu, 2 Jan 2020 01:06:03 +0100 Subject: [PATCH 04/22] tkpanels: work around tkinter bug cancelling file open dialog on macOS Fixes #811 --- direct/src/tkpanels/AnimPanel.py | 2 +- direct/src/tkpanels/MopathRecorder.py | 2 +- direct/src/tkpanels/ParticlePanel.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/direct/src/tkpanels/AnimPanel.py b/direct/src/tkpanels/AnimPanel.py index a8348c299d..ca5cbe0d25 100644 --- a/direct/src/tkpanels/AnimPanel.py +++ b/direct/src/tkpanels/AnimPanel.py @@ -276,7 +276,7 @@ class AnimPanel(AppShell): title = 'Load Animation', parent = self.component('hull') ) - if not animFilename: + if not animFilename and animFilename != 'None': # no file selected, canceled return diff --git a/direct/src/tkpanels/MopathRecorder.py b/direct/src/tkpanels/MopathRecorder.py index 8ff2341865..1cf65cd0aa 100644 --- a/direct/src/tkpanels/MopathRecorder.py +++ b/direct/src/tkpanels/MopathRecorder.py @@ -1638,7 +1638,7 @@ class MopathRecorder(AppShell, DirectObject): initialdir = path, title = 'Load Nurbs Curve', parent = self.parent) - if mopathFilename: + if mopathFilename and mopathFilename != 'None': self.reset() nodePath = loader.loadModel( Filename.fromOsSpecific(mopathFilename)) diff --git a/direct/src/tkpanels/ParticlePanel.py b/direct/src/tkpanels/ParticlePanel.py index b7a632f61a..d82677b5e5 100644 --- a/direct/src/tkpanels/ParticlePanel.py +++ b/direct/src/tkpanels/ParticlePanel.py @@ -1272,7 +1272,7 @@ class ParticlePanel(AppShell): initialdir = path, title = 'Load Particle Effect', parent = self.parent) - if particleFilename: + if particleFilename and particleFilename != 'None': # Delete existing particles and forces self.particleEffect.loadConfig( Filename.fromOsSpecific(particleFilename)) From 438130a157cc393e898c6d2175c91ab24cb9fe27 Mon Sep 17 00:00:00 2001 From: rdb Date: Thu, 2 Jan 2020 01:10:10 +0100 Subject: [PATCH 05/22] readme: update build instructions for Windows --- README.md | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index d2c4f3fe4f..375982711e 100644 --- a/README.md +++ b/README.md @@ -52,11 +52,11 @@ Building Panda3D Windows ------- -You can build Panda3D with the Microsoft Visual C++ 2015 or 2017 compiler, +You can build Panda3D with the Microsoft Visual C++ 2015, 2017 or 2019 compiler, which can be downloaded for free from the [Visual Studio site](https://visualstudio.microsoft.com/downloads/). You will also need to install the [Windows 10 SDK](https://developer.microsoft.com/en-us/windows/downloads/windows-10-sdk), -and if you intend to target Windows XP, you will also need the -[Windows 7.1 SDK](https://www.microsoft.com/en-us/download/details.aspx?id=8279). +and if you intend to target Windows XP, you will also need the Windows 7.1A +SDK (which can be installed from the Visual Studio Installer). You will also need to have the third-party dependency libraries available for the build scripts to use. These are available from one of these two URLs, @@ -64,16 +64,17 @@ depending on whether you are on a 32-bit or 64-bit system, or you can [click here](https://github.com/rdb/panda3d-thirdparty) for instructions on building them from source. -https://www.panda3d.org/download/panda3d-1.10.4.1/panda3d-1.10.4.1-tools-win64.zip -https://www.panda3d.org/download/panda3d-1.10.4.1/panda3d-1.10.4.1-tools-win32.zip +- https://www.panda3d.org/download/panda3d-1.10.5/panda3d-1.10.5-tools-win64.zip +- https://www.panda3d.org/download/panda3d-1.10.5/panda3d-1.10.5-tools-win32.zip -After acquiring these dependencies, you may simply build Panda3D from the -command prompt using the following command. (Change `14.1` to `14` if you are -using Visual C++ 2015 instead of 2017. Add the `--windows-sdk=10` option if -you don't need to support Windows XP and did not install the Windows 7.1 SDK.) +After acquiring these dependencies, you can build Panda3D from the command +prompt using the following command. Change the `--msvc-version` option based +on your version of Visual C++; 2019 is 14.2, 2017 is 14.1, and 2015 is 14. +Remove the `--windows-sdk=10` option if you need to support Windows XP, which +requires the Windows 7.1A SDK. ```bash -makepanda\makepanda.bat --everything --installer --msvc-version=14.1 --no-eigen --threads=2 +makepanda\makepanda.bat --everything --installer --msvc-version=14.2 --windows-sdk=10 --no-eigen --threads=2 ``` When the build succeeds, it will produce an .exe file that you can use to From 3367fe266f2ccb1495f8e2e90c9bc1c5dcc29751 Mon Sep 17 00:00:00 2001 From: rdb Date: Fri, 3 Jan 2020 18:19:39 +0100 Subject: [PATCH 06/22] tkpanels: properly test "None" return from askopenfilename --- direct/src/tkpanels/AnimPanel.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/direct/src/tkpanels/AnimPanel.py b/direct/src/tkpanels/AnimPanel.py index ca5cbe0d25..12bc1feefd 100644 --- a/direct/src/tkpanels/AnimPanel.py +++ b/direct/src/tkpanels/AnimPanel.py @@ -276,7 +276,7 @@ class AnimPanel(AppShell): title = 'Load Animation', parent = self.component('hull') ) - if not animFilename and animFilename != 'None': + if not animFilename or animFilename == 'None': # no file selected, canceled return From fe1ecd5e791dd98bf96009b216c3d0960d99ea56 Mon Sep 17 00:00:00 2001 From: rdb Date: Fri, 3 Jan 2020 18:48:23 +0100 Subject: [PATCH 07/22] pgraph: fix ShaderInput ordering for vector inputs with small floats Fixes #827 --- panda/src/pgraph/shaderInput.I | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/panda/src/pgraph/shaderInput.I b/panda/src/pgraph/shaderInput.I index b8e182421f..d0a0e79fbb 100644 --- a/panda/src/pgraph/shaderInput.I +++ b/panda/src/pgraph/shaderInput.I @@ -490,7 +490,19 @@ operator < (const ShaderInput &other) const { return false; case M_vector: - return _stored_vector < other._stored_vector; + if (_stored_vector[0] != other._stored_vector[0]) { + return (_stored_vector[0] < other._stored_vector[0]) ? -1 : 1; + } + if (_stored_vector[1] != other._stored_vector[1]) { + return (_stored_vector[1] < other._stored_vector[1]) ? -1 : 1; + } + if (_stored_vector[2] != other._stored_vector[2]) { + return (_stored_vector[2] < other._stored_vector[2]) ? -1 : 1; + } + if (_stored_vector[3] != other._stored_vector[3]) { + return (_stored_vector[3] < other._stored_vector[3]) ? -1 : 1; + } + return 0; case M_numeric: return _stored_ptr._ptr < other._stored_ptr._ptr; From b60c3e6c7e9e045b4b6aa7eca7374e1ab9ec5efc Mon Sep 17 00:00:00 2001 From: rdb Date: Fri, 3 Jan 2020 18:52:55 +0100 Subject: [PATCH 08/22] tests: add unit tests for ShaderInput comparison (#827) --- tests/pgraph/test_shaderinput.py | 44 ++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 tests/pgraph/test_shaderinput.py diff --git a/tests/pgraph/test_shaderinput.py b/tests/pgraph/test_shaderinput.py new file mode 100644 index 0000000000..d046394dcd --- /dev/null +++ b/tests/pgraph/test_shaderinput.py @@ -0,0 +1,44 @@ +from panda3d.core import ShaderInput, Vec4 + + +def test_shaderinput_vector_compare(): + i0 = ShaderInput('a', Vec4(0, 0, 0, 0)) + i1 = ShaderInput('a', Vec4(1e-9, 0, 0, 0)) + i2 = ShaderInput('a', Vec4(1e-8, 0, 0, 0)) + i3 = ShaderInput('a', Vec4(2, 0, 0, 0)) + + assert i0 == i0 + assert i1 == i1 + assert i2 == i2 + assert i3 == i3 + + assert i0 != i1 + assert i0 != i2 + assert i0 != i3 + assert i1 != i2 + assert i2 != i3 + assert i1 != i3 + + assert not i0 < i0 + assert not i1 < i1 + assert not i2 < i2 + assert not i3 < i3 + + assert i0 < i1 + assert i0 < i2 + assert i0 < i3 + assert i1 < i2 + assert i2 < i3 + assert i1 < i3 + + assert not i0 > i0 + assert not i1 > i1 + assert not i2 > i2 + assert not i3 > i3 + + assert i3 > i1 + assert i2 > i1 + assert i3 > i2 + assert i1 > i0 + assert i2 > i0 + assert i3 > i0 From 135931c9260e7dbbceb7385a65130a2189f374d5 Mon Sep 17 00:00:00 2001 From: rdb Date: Fri, 3 Jan 2020 22:00:09 +0100 Subject: [PATCH 09/22] pgraph: fix faulty comparison code of ShaderInput vectors --- panda/src/pgraph/shaderInput.I | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/panda/src/pgraph/shaderInput.I b/panda/src/pgraph/shaderInput.I index d0a0e79fbb..a7318cdc2b 100644 --- a/panda/src/pgraph/shaderInput.I +++ b/panda/src/pgraph/shaderInput.I @@ -491,16 +491,16 @@ operator < (const ShaderInput &other) const { case M_vector: if (_stored_vector[0] != other._stored_vector[0]) { - return (_stored_vector[0] < other._stored_vector[0]) ? -1 : 1; + return _stored_vector[0] < other._stored_vector[0]; } if (_stored_vector[1] != other._stored_vector[1]) { - return (_stored_vector[1] < other._stored_vector[1]) ? -1 : 1; + return _stored_vector[1] < other._stored_vector[1]; } if (_stored_vector[2] != other._stored_vector[2]) { - return (_stored_vector[2] < other._stored_vector[2]) ? -1 : 1; + return _stored_vector[2] < other._stored_vector[2]; } if (_stored_vector[3] != other._stored_vector[3]) { - return (_stored_vector[3] < other._stored_vector[3]) ? -1 : 1; + return _stored_vector[3] < other._stored_vector[3]; } return 0; From cef70a4fe5ac73c7088cdf2ccabee77fca0b035b Mon Sep 17 00:00:00 2001 From: rdb Date: Sat, 4 Jan 2020 01:20:18 +0100 Subject: [PATCH 10/22] tests: remove __gt__ asserts from test_shaderinput_vector_compare This fails in Python 2, and we don't actually provide this operator or make any guarantees about greater-than ordering, so it was silly to test for it to begin with. --- tests/pgraph/test_shaderinput.py | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/tests/pgraph/test_shaderinput.py b/tests/pgraph/test_shaderinput.py index d046394dcd..68bb6b2e24 100644 --- a/tests/pgraph/test_shaderinput.py +++ b/tests/pgraph/test_shaderinput.py @@ -30,15 +30,3 @@ def test_shaderinput_vector_compare(): assert i1 < i2 assert i2 < i3 assert i1 < i3 - - assert not i0 > i0 - assert not i1 > i1 - assert not i2 > i2 - assert not i3 > i3 - - assert i3 > i1 - assert i2 > i1 - assert i3 > i2 - assert i1 > i0 - assert i2 > i0 - assert i3 > i0 From 24783924d0116fc836a796b0a3aa09cd00121b1e Mon Sep 17 00:00:00 2001 From: rdb Date: Sat, 4 Jan 2020 01:21:22 +0100 Subject: [PATCH 11/22] pgraph: fix int return from bool method --- panda/src/pgraph/shaderInput.I | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/panda/src/pgraph/shaderInput.I b/panda/src/pgraph/shaderInput.I index a7318cdc2b..2ace5d614b 100644 --- a/panda/src/pgraph/shaderInput.I +++ b/panda/src/pgraph/shaderInput.I @@ -502,7 +502,7 @@ operator < (const ShaderInput &other) const { if (_stored_vector[3] != other._stored_vector[3]) { return _stored_vector[3] < other._stored_vector[3]; } - return 0; + return false; case M_numeric: return _stored_ptr._ptr < other._stored_ptr._ptr; From 0e1b5248858be6f2edf62ee6284581447feecb68 Mon Sep 17 00:00:00 2001 From: rdb Date: Sat, 4 Jan 2020 01:07:48 +0100 Subject: [PATCH 12/22] gobj: fix Material ambient/diffuse/specular when reading from bam Fixes #828 --- panda/src/gobj/material.cxx | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/panda/src/gobj/material.cxx b/panda/src/gobj/material.cxx index 091c7eff2f..a87c978c1c 100644 --- a/panda/src/gobj/material.cxx +++ b/panda/src/gobj/material.cxx @@ -544,6 +544,11 @@ fillin(DatagramIterator &scan, BamReader *manager) { } _refractive_index = scan.get_stdfloat(); + if ((_flags & (F_base_color | F_metallic)) == (F_base_color | F_metallic)) { + // Compute the ambient, diffuse and specular settings. + set_base_color(_base_color); + } + } else { _ambient.read_datagram(scan); _diffuse.read_datagram(scan); From 2d4647ea33f84d342282bb7a7986101993f3ded3 Mon Sep 17 00:00:00 2001 From: Donny Lawrence Date: Sat, 4 Jan 2020 02:57:21 +0100 Subject: [PATCH 13/22] makepackage: Change macOS install location Starting with macOS 10.15, we can no longer install into /Developer/Panda3D due to it not being one of the sanctioned writable directories. This commit changes the default install location to /Library/Developer/Panda3D, which is the next best place to put it (discussion on this can be found in #760). To keep compatibility with those who may rely on the old location, some postinstall scripts have been added that create symlinks to the new location if running on 10.14 or older. Fixes #760 Closes #825 --- makepanda/makepackage.py | 192 +++++++++++++++++++++++++++------------ 1 file changed, 132 insertions(+), 60 deletions(-) diff --git a/makepanda/makepackage.py b/makepanda/makepackage.py index 260513aacd..139054eb8c 100755 --- a/makepanda/makepackage.py +++ b/makepanda/makepackage.py @@ -162,6 +162,18 @@ flatsize: INSTSIZEMB deps: {DEPENDS} """ +# Since we're adding a bunch of install scripts to the macOS intaller, we'll +# put the platform-checking code in some variables to reduce repetition. +MACOS_SCRIPT_PREFIX = \ +"""#!/bin/bash +IFS=. +read -a version_info <<< "`sw_vers -productVersion`'" +if (( ${version_info[1]} < 15 )); then +""" + +MACOS_SCRIPT_POSTFIX = \ +"""fi +""" def MakeInstallerNSIS(version, file, title, installdir, runtime=False, compressor="lzma", **kwargs): outputdir = GetOutputDir() @@ -461,7 +473,7 @@ def MakeInstallerLinux(version, debversion=None, rpmrelease=1, runtime=False, exit("To build an installer, either rpmbuild or dpkg-deb must be present on your system!") -def MakeInstallerOSX(version, runtime=False, python_versions=[], **kwargs): +def MakeInstallerOSX(version, runtime=False, python_versions=[], installdir="/Library/Developer/Panda3D", **kwargs): outputdir = GetOutputDir() if runtime: @@ -484,40 +496,38 @@ def MakeInstallerOSX(version, runtime=False, python_versions=[], **kwargs): if (os.path.exists("dstroot")): oscmd("rm -rf dstroot") if (os.path.exists("Panda3D-rw.dmg")): oscmd('rm -f Panda3D-rw.dmg') - oscmd("mkdir -p dstroot/base/Developer/Panda3D/lib") - oscmd("mkdir -p dstroot/base/Developer/Panda3D/etc") - oscmd("cp %s/etc/Config.prc dstroot/base/Developer/Panda3D/etc/Config.prc" % outputdir) - oscmd("cp %s/etc/Confauto.prc dstroot/base/Developer/Panda3D/etc/Confauto.prc" % outputdir) - oscmd("cp -R %s/models dstroot/base/Developer/Panda3D/models" % outputdir) - oscmd("cp -R doc/LICENSE dstroot/base/Developer/Panda3D/LICENSE") - oscmd("cp -R doc/ReleaseNotes dstroot/base/Developer/Panda3D/ReleaseNotes") - oscmd("cp -R %s/Frameworks dstroot/base/Developer/Panda3D/Frameworks" % outputdir) + oscmd("mkdir -p dstroot/base/%s/lib" % installdir) + oscmd("mkdir -p dstroot/base/%s/etc" % installdir) + oscmd("cp %s/etc/Config.prc dstroot/base/%s/etc/Config.prc" % (outputdir, installdir)) + oscmd("cp %s/etc/Confauto.prc dstroot/base/%s/etc/Confauto.prc" % (outputdir, installdir)) + oscmd("cp -R %s/models dstroot/base/%s/models" % (outputdir, installdir)) + oscmd("cp -R doc/LICENSE dstroot/base/%s/LICENSE" % installdir) + oscmd("cp -R doc/ReleaseNotes dstroot/base/%s/ReleaseNotes" % installdir) + oscmd("cp -R %s/Frameworks dstroot/base/%s/Frameworks" % (outputdir, installdir)) if os.path.isdir(outputdir+"/plugins"): - oscmd("cp -R %s/plugins dstroot/base/Developer/Panda3D/plugins" % outputdir) + oscmd("cp -R %s/plugins dstroot/base/%s/plugins" % (outputdir, installdir)) # Libraries that shouldn't be in base, but are instead in other modules. no_base_libs = ['libp3ffmpeg', 'libp3fmod_audio', 'libfmodex', 'libfmodexL'] for base in os.listdir(outputdir+"/lib"): if not base.endswith(".a") and base.split('.')[0] not in no_base_libs: - libname = "dstroot/base/Developer/Panda3D/lib/" + base + libname = ("dstroot/base/%s/lib/" % installdir) + base # We really need to specify -R in order not to follow symlinks # On OSX, just specifying -P is not enough to do that. oscmd("cp -R -P " + outputdir + "/lib/" + base + " " + libname) - oscmd("mkdir -p dstroot/tools/Developer/Panda3D/bin") - oscmd("mkdir -p dstroot/tools/Developer/Tools") - oscmd("ln -s ../Panda3D/bin dstroot/tools/Developer/Tools/Panda3D") + oscmd("mkdir -p dstroot/tools/%s/bin" % installdir) oscmd("mkdir -p dstroot/tools/etc/paths.d") # Trailing newline is important, works around a bug in OSX - WriteFile("dstroot/tools/etc/paths.d/Panda3D", "/Developer/Panda3D/bin\n") + WriteFile("dstroot/tools/etc/paths.d/Panda3D", "/%s/bin\n" % installdir) oscmd("mkdir -m 0755 -p dstroot/tools/usr/local/share/man/man1") oscmd("install -m 0644 doc/man/*.1 dstroot/tools/usr/local/share/man/man1/") for base in os.listdir(outputdir+"/bin"): if not base.startswith("deploy-stub"): - binname = "dstroot/tools/Developer/Panda3D/bin/" + base + binname = ("dstroot/tools/%s/bin/" % installdir) + base # OSX needs the -R argument to copy symbolic links correctly, it doesn't have -d. How weird. oscmd("cp -R " + outputdir + "/bin/" + base + " " + binname) @@ -527,74 +537,74 @@ def MakeInstallerOSX(version, runtime=False, python_versions=[], **kwargs): oscmd("mkdir -p dstroot/pythoncode/usr/local/bin") oscmd("ln -s %s dstroot/pythoncode/usr/local/bin/ppython" % (python_versions[0]["executable"])) - oscmd("mkdir -p dstroot/pythoncode/Developer/Panda3D/panda3d") - oscmd("cp -R %s/pandac dstroot/pythoncode/Developer/Panda3D/pandac" % outputdir) - oscmd("cp -R %s/direct dstroot/pythoncode/Developer/Panda3D/direct" % outputdir) - oscmd("cp -R %s/*.so dstroot/pythoncode/Developer/Panda3D/" % outputdir, True) - oscmd("cp -R %s/*.py dstroot/pythoncode/Developer/Panda3D/" % outputdir, True) + oscmd("mkdir -p dstroot/pythoncode/%s/panda3d" % installdir) + oscmd("cp -R %s/pandac dstroot/pythoncode/%s/pandac" % (outputdir, installdir)) + oscmd("cp -R %s/direct dstroot/pythoncode/%s/direct" % (outputdir, installdir)) + oscmd("cp -R %s/*.so dstroot/pythoncode/%s/" % (outputdir, installdir), True) + oscmd("cp -R %s/*.py dstroot/pythoncode/%s/" % (outputdir, installdir), True) if os.path.isdir(outputdir+"/Pmw"): - oscmd("cp -R %s/Pmw dstroot/pythoncode/Developer/Panda3D/Pmw" % outputdir) + oscmd("cp -R %s/Pmw dstroot/pythoncode/%s/Pmw" % (outputdir, installdir)) # Copy over panda3d.dist-info directory. if os.path.isdir(outputdir + "/panda3d.dist-info"): - oscmd("cp -R %s/panda3d.dist-info dstroot/pythoncode/Developer/Panda3D/panda3d.dist-info" % (outputdir)) + oscmd("cp -R %s/panda3d.dist-info dstroot/pythoncode/%s/panda3d.dist-info" % (outputdir, installdir)) for base in os.listdir(outputdir+"/panda3d"): if base.endswith('.py'): - libname = "dstroot/pythoncode/Developer/Panda3D/panda3d/" + base + libname = ("dstroot/pythoncode/%s/panda3d/" % installdir) + base oscmd("cp -R " + outputdir + "/panda3d/" + base + " " + libname) for version_info in python_versions: pyver = version_info["version"] oscmd("mkdir -p dstroot/pybindings%s/Library/Python/%s/site-packages" % (pyver, pyver)) - oscmd("mkdir -p dstroot/pybindings%s/Developer/Panda3D/panda3d" % (pyver)) + oscmd("mkdir -p dstroot/pybindings%s/%s/panda3d" % (pyver, installdir)) # Copy over extension modules. suffix = version_info["ext_suffix"] for base in os.listdir(outputdir+"/panda3d"): if base.endswith(suffix) and '.' not in base[:-len(suffix)]: - libname = "dstroot/pybindings%s/Developer/Panda3D/panda3d/%s" % (pyver, base) + libname = "dstroot/pybindings%s/%s/panda3d/%s" % (pyver, installdir, base) # We really need to specify -R in order not to follow symlinks # On OSX, just specifying -P is not enough to do that. oscmd("cp -R -P " + outputdir + "/panda3d/" + base + " " + libname) # Write a .pth file. oscmd("mkdir -p dstroot/pybindings%s/Library/Python/%s/site-packages" % (pyver, pyver)) - WriteFile("dstroot/pybindings%s/Library/Python/%s/site-packages/Panda3D.pth" % (pyver, pyver), "/Developer/Panda3D") + WriteFile("dstroot/pybindings%s/Library/Python/%s/site-packages/Panda3D.pth" % (pyver, pyver), installdir) # Somewhere in Python 2.7.13 and 3.7, the above path was removed from # sys.path of the python.org distribution. See bpo-28440 and GH #502. if pyver not in ("3.0", "3.1", "3.2", "3.3", "3.4", "3.5", "3.6"): dir = "dstroot/pybindings%s/Library/Frameworks/Python.framework/Versions/%s/lib/python%s/site-packages" % (pyver, pyver, pyver) oscmd("mkdir -p %s" % (dir)) - WriteFile("%s/Panda3D.pth" % (dir), "/Developer/Panda3D") + WriteFile("%s/Panda3D.pth" % (dir), installdir) # Also place it somewhere the Homebrew version of Python can find it. dir = "dstroot/pybindings%s/usr/local/lib/python%s/site-packages" % (pyver, pyver) oscmd("mkdir -p %s" % (dir)) - WriteFile("%s/Panda3D.pth" % (dir), "/Developer/Panda3D") + WriteFile("%s/Panda3D.pth" % (dir), installdir) if not PkgSkip("FFMPEG"): - oscmd("mkdir -p dstroot/ffmpeg/Developer/Panda3D/lib") - oscmd("cp -R %s/lib/libp3ffmpeg.* dstroot/ffmpeg/Developer/Panda3D/lib/" % outputdir) + oscmd("mkdir -p dstroot/ffmpeg/%s/lib" % installdir) + oscmd("cp -R %s/lib/libp3ffmpeg.* dstroot/ffmpeg/%s/lib/" % (outputdir, installdir)) #if not PkgSkip("OPENAL"): # oscmd("mkdir -p dstroot/openal/Developer/Panda3D/lib") # oscmd("cp -R %s/lib/libp3openal_audio.* dstroot/openal/Developer/Panda3D/lib/" % outputdir) if not PkgSkip("FMODEX"): - oscmd("mkdir -p dstroot/fmodex/Developer/Panda3D/lib") - oscmd("cp -R %s/lib/libp3fmod_audio.* dstroot/fmodex/Developer/Panda3D/lib/" % outputdir) - oscmd("cp -R %s/lib/libfmodex* dstroot/fmodex/Developer/Panda3D/lib/" % outputdir) + oscmd("mkdir -p dstroot/fmodex/%s/lib" % installdir) + oscmd("cp -R %s/lib/libp3fmod_audio.* dstroot/fmodex/%s/lib/" % (outputdir, installdir)) + oscmd("cp -R %s/lib/libfmodex* dstroot/fmodex/%s/lib/" % (outputdir, installdir)) - oscmd("mkdir -p dstroot/headers/Developer/Panda3D/lib") - oscmd("cp -R %s/include dstroot/headers/Developer/Panda3D/include" % outputdir) + oscmd("mkdir -p dstroot/headers/%s/lib" % installdir) + oscmd("cp -R %s/include dstroot/headers/%s/include" % (outputdir, installdir)) if os.path.isfile(outputdir + "/lib/libp3pystub.a"): - oscmd("cp -R -P %s/lib/libp3pystub.a dstroot/headers/Developer/Panda3D/lib/" % outputdir) + oscmd("cp -R -P %s/lib/libp3pystub.a dstroot/headers/%s/lib/" % (outputdir, installdir)) if os.path.isdir("samples"): - oscmd("mkdir -p dstroot/samples/Developer/Examples/Panda3D") - oscmd("cp -R samples/* dstroot/samples/Developer/Examples/Panda3D/") + oscmd("mkdir -p dstroot/samples/%s/samples" % installdir) + oscmd("cp -R samples/* dstroot/samples/%s/samples" % installdir) DeleteVCS("dstroot") DeleteBuildFiles("dstroot") @@ -602,11 +612,11 @@ def MakeInstallerOSX(version, runtime=False, python_versions=[], **kwargs): # Compile Python files. Do this *after* the DeleteVCS step, above, which # deletes __pycache__ directories. for version_info in python_versions: - if os.path.isdir("dstroot/pythoncode/Developer/Panda3D/Pmw"): - oscmd("%s -m compileall -q -f -d /Developer/Panda3D/Pmw dstroot/pythoncode/Developer/Panda3D/Pmw" % (version_info["executable"]), True) - oscmd("%s -m compileall -q -f -d /Developer/Panda3D/direct dstroot/pythoncode/Developer/Panda3D/direct" % (version_info["executable"])) - oscmd("%s -m compileall -q -f -d /Developer/Panda3D/pandac dstroot/pythoncode/Developer/Panda3D/pandac" % (version_info["executable"])) - oscmd("%s -m compileall -q -f -d /Developer/Panda3D/panda3d dstroot/pythoncode/Developer/Panda3D/panda3d" % (version_info["executable"])) + if os.path.isdir("dstroot/pythoncode/%s/Pmw" % installdir): + oscmd("%s -m compileall -q -f -d %s/Pmw dstroot/pythoncode/%s/Pmw" % (version_info["executable"], installdir, installdir), True) + oscmd("%s -m compileall -q -f -d %s/direct dstroot/pythoncode/%s/direct" % (version_info["executable"], installdir, installdir)) + oscmd("%s -m compileall -q -f -d %s/pandac dstroot/pythoncode/%s/pandac" % (version_info["executable"], installdir, installdir)) + oscmd("%s -m compileall -q -f -d %s/panda3d dstroot/pythoncode/%s/panda3d" % (version_info["executable"], installdir, installdir)) oscmd("chmod -R 0775 dstroot/*") # We need to be root to perform a chown. Bleh. @@ -617,6 +627,55 @@ def MakeInstallerOSX(version, runtime=False, python_versions=[], **kwargs): oscmd("mkdir -p dstroot/Panda3D/Panda3D.mpkg/Contents/Resources/en.lproj/") pkgs = ["base", "tools", "headers"] + + # Starting with 1.10.5, Panda3D is installed by default in + # /Library/Developer/Panda3D instead of /Developer/Panda3D. To keep + # compatibility for those who rely on the old location, we add a symlink + # if they're running macOS 10.14 or less. We also remove the old + # installation. + script_components = set() + def write_script(component, phase, contents): + if installdir == "/Developer/Panda3D": return + + script_components.add(component) + oscmd("mkdir -p dstroot/scripts/%s" % component) + ln_script = open("dstroot/scripts/%s/%s" % (component, phase), "w") + ln_script.write(MACOS_SCRIPT_PREFIX) + ln_script.write(contents) + ln_script.write(MACOS_SCRIPT_POSTFIX) + ln_script.close() + oscmd("chmod +x dstroot/scripts/%s/%s" % (component, phase)) + + write_script('base', 'postinstall', """ + pkgutil --pkg-info org.panda3d.panda3d.base.pkg + if [ $? = 0 ]; then + rm -rf /Developer/Panda3D + fi + mkdir -p /Developer + ln -s %s /Developer/Panda3D + """ % installdir) + # We don't specify rm -r since /Developer/Panda3D/Tools is a symlink + write_script('tools', 'postinstall', """ + pkgutil --pkg-info org.panda3d.panda3d.tools.pkg + if [ $? = 0 ]; then + rm -f /Developer/Tools/Panda3D + fi + mkdir -p /Developer/Tools + ln -s %s/bin /Developer/Tools/Panda3D + """ % installdir) + + if os.path.isdir("samples"): + pkgs.append("samples") + + write_script('samples', 'postinstall', """ + pkgutil --pkg-info org.panda3d.panda3d.samples.pkg + if [ $? = 0 ]; then + rm -f /Developer/Examples/Panda3D + fi + mkdir -p /Developer/Examples + ln -s %s/samples /Developer/Examples/Panda3D + """ % installdir) + if python_versions: pkgs.append("pythoncode") for version_info in python_versions: @@ -624,30 +683,36 @@ def MakeInstallerOSX(version, runtime=False, python_versions=[], **kwargs): if not PkgSkip("FFMPEG"): pkgs.append("ffmpeg") #if not PkgSkip("OPENAL"): pkgs.append("openal") if not PkgSkip("FMODEX"): pkgs.append("fmodex") - if os.path.isdir("samples"): pkgs.append("samples") + for pkg in pkgs: identifier = "org.panda3d.panda3d.%s.pkg" % pkg + scripts_path = "dstroot/scripts/%s" % pkg plist = open("/tmp/Info_plist", "w") plist.write(Info_plist.format(package_id=identifier, version=version)) plist.close() if not os.path.isdir("dstroot/" + pkg): os.makedirs("dstroot/" + pkg) + if pkg in script_components: + pkg_scripts = ' --scripts ' + scripts_path + else: + pkg_scripts = '' + if os.path.exists("/usr/bin/pkgbuild"): # This new package builder is used in Lion and above. - cmd = '/usr/bin/pkgbuild --identifier ' + identifier + ' --version ' + version + ' --root dstroot/' + pkg + '/ dstroot/Panda3D/Panda3D.mpkg/Contents/Packages/' + pkg + '.pkg' + cmd = '/usr/bin/pkgbuild --identifier ' + identifier + ' --version ' + version + ' --root dstroot/' + pkg + '/ dstroot/Panda3D/Panda3D.mpkg/Contents/Packages/' + pkg + '.pkg' + pkg_scripts # In older versions, we use PackageMaker. Apple keeps changing its location. elif os.path.exists("/Developer/usr/bin/packagemaker"): - cmd = '/Developer/usr/bin/packagemaker --info /tmp/Info_plist --version ' + version + ' --out dstroot/Panda3D/Panda3D.mpkg/Contents/Packages/' + pkg + '.pkg ' + target + ' --domain system --root dstroot/' + pkg + '/ --no-relocate' + cmd = '/Developer/usr/bin/packagemaker --info /tmp/Info_plist --version ' + version + ' --out dstroot/Panda3D/Panda3D.mpkg/Contents/Packages/' + pkg + '.pkg ' + target + ' --domain system --root dstroot/' + pkg + '/ --no-relocate' + pkg_scripts elif os.path.exists("/Applications/Xcode.app/Contents/Applications/PackageMaker.app/Contents/MacOS/PackageMaker"): - cmd = '/Applications/Xcode.app/Contents/Applications/PackageMaker.app/Contents/MacOS/PackageMaker --info /tmp/Info_plist --version ' + version + ' --out dstroot/Panda3D/Panda3D.mpkg/Contents/Packages/' + pkg + '.pkg ' + target + ' --domain system --root dstroot/' + pkg + '/ --no-relocate' + cmd = '/Applications/Xcode.app/Contents/Applications/PackageMaker.app/Contents/MacOS/PackageMaker --info /tmp/Info_plist --version ' + version + ' --out dstroot/Panda3D/Panda3D.mpkg/Contents/Packages/' + pkg + '.pkg ' + target + ' --domain system --root dstroot/' + pkg + '/ --no-relocate' + pkg_scripts elif os.path.exists("/Developer/Tools/PackageMaker.app/Contents/MacOS/PackageMaker"): - cmd = '/Developer/Tools/PackageMaker.app/Contents/MacOS/PackageMaker --info /tmp/Info_plist --version ' + version + ' --out dstroot/Panda3D/Panda3D.mpkg/Contents/Packages/' + pkg + '.pkg ' + target + ' --domain system --root dstroot/' + pkg + '/ --no-relocate' + cmd = '/Developer/Tools/PackageMaker.app/Contents/MacOS/PackageMaker --info /tmp/Info_plist --version ' + version + ' --out dstroot/Panda3D/Panda3D.mpkg/Contents/Packages/' + pkg + '.pkg ' + target + ' --domain system --root dstroot/' + pkg + '/ --no-relocate' + pkg_scripts elif os.path.exists("/Developer/Tools/packagemaker"): - cmd = '/Developer/Tools/packagemaker -build -f dstroot/' + pkg + '/ -p dstroot/Panda3D/Panda3D.mpkg/Contents/Packages/' + pkg + '.pkg -i /tmp/Info_plist' + cmd = '/Developer/Tools/packagemaker -build -f dstroot/' + pkg + '/ -p dstroot/Panda3D/Panda3D.mpkg/Contents/Packages/' + pkg + '.pkg -i /tmp/Info_plist' + pkg_scripts elif os.path.exists("/Applications/PackageMaker.app/Contents/MacOS/PackageMaker"): - cmd = '/Applications/PackageMaker.app/Contents/MacOS/PackageMaker --info /tmp/Info_plist --version ' + version + ' --out dstroot/Panda3D/Panda3D.mpkg/Contents/Packages/' + pkg + '.pkg ' + target + ' --domain system --root dstroot/' + pkg + '/ --no-relocate' + cmd = '/Applications/PackageMaker.app/Contents/MacOS/PackageMaker --info /tmp/Info_plist --version ' + version + ' --out dstroot/Panda3D/Panda3D.mpkg/Contents/Packages/' + pkg + '.pkg ' + target + ' --domain system --root dstroot/' + pkg + '/ --no-relocate' + pkg_scripts else: exit("Neither pkgbuild nor PackageMaker could be found!") oscmd(cmd) @@ -688,15 +753,15 @@ def MakeInstallerOSX(version, runtime=False, python_versions=[], **kwargs): dist.write(' \n') dist.write(' \n') dist.write(' \n') - dist.write(' \n') + dist.write(' \n' % installdir) dist.write(' \n') dist.write(' \n') - dist.write(' \n') + dist.write(' \n' % installdir) dist.write(' \n') dist.write(' \n') if python_versions: - dist.write(' \n') + dist.write(' \n' % installdir) dist.write(' \n') dist.write(' \n') @@ -735,11 +800,11 @@ def MakeInstallerOSX(version, runtime=False, python_versions=[], **kwargs): dist.write(' \n') if os.path.isdir("samples"): - dist.write(' \n') + dist.write(' \n' % installdir) dist.write(' \n') dist.write(' \n') - dist.write(' \n') + dist.write(' \n' % installdir) dist.write(' \n') dist.write(' \n') for pkg in pkgs: @@ -1006,8 +1071,14 @@ def MakeInstallerAndroid(version, **kwargs): def MakeInstaller(version, **kwargs): target = GetTarget() if target == 'windows': + if kwargs.get('installdir') is None: + dir = "C:\\Panda3D-" + version + if GetTargetArch() == 'x64': + dir += '-x64' + else: + dir = kwargs['installdir'] + fn = "Panda3D-" - dir = "Panda3D-" + version runtime = kwargs.get('runtime', False) if runtime: @@ -1026,9 +1097,8 @@ def MakeInstaller(version, **kwargs): fn += "-dbg" if GetTargetArch() == 'x64': fn += '-x64' - dir += '-x64' - MakeInstallerNSIS(version, fn + '.exe', title, 'C:\\' + dir, **kwargs) + MakeInstallerNSIS(version, fn + '.exe', title, dir, **kwargs) if not runtime: MakeDebugSymbolArchive(fn + '-pdb.zip', dir) elif target == 'linux': @@ -1054,6 +1124,7 @@ if __name__ == "__main__": parser.add_option('', '--verbose', dest='verbose', help='Enable verbose output', action='store_true', default=False) parser.add_option('', '--runtime', dest='runtime', help='Runtime instead of SDK', action='store_true', default=False) parser.add_option('', '--lzma', dest='compressor', help='Use LZMA compression', action='store_const', const='lzma', default='zlib') + parser.add_option('', '--installdir', dest='installdir', help='Where on the system the installer should put the SDK/runtime (Windows, macOS)') (options, args) = parser.parse_args() SetVerbose(options.verbose) @@ -1087,4 +1158,5 @@ if __name__ == "__main__": debversion=options.debversion, rpmrelease=options.rpmrelease, runtime=options.runtime, - python_versions=ReadPythonVersionInfoFile()) + python_versions=ReadPythonVersionInfoFile(), + installdir=options.installdir) From c28ab63481a9c632fbf8e499085232fe0886460d Mon Sep 17 00:00:00 2001 From: rdb Date: Sat, 4 Jan 2020 02:58:54 +0100 Subject: [PATCH 14/22] doc: add release notes for Panda3D 1.10.5 --- doc/ReleaseNotes | 60 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) diff --git a/doc/ReleaseNotes b/doc/ReleaseNotes index 56b4b0d49d..17a153f6e6 100644 --- a/doc/ReleaseNotes +++ b/doc/ReleaseNotes @@ -1,3 +1,63 @@ +------------------------ RELEASE 1.10.5 ----------------------- + +This is a recommended bugfix release, especially for macOS users. + +* Fix DPI scaling issue in macOS 10.15 "Catalina" (#794) +* Fix crash on macOS Catalina without "Input Monitoring" permission (#795) +* macOS installer now installs to /Library/Developer/Panda3D (#760) +* macOS thirdparty packages are now linked with libc++ (#584) +* Homebrew Python should now locate Panda libraries correctly (#755) +* Work around Tk bug cancelling Load Params in Particle Panel on macOS (#811) +* Add support for Autodesk Maya 2020 +* Fix maya2egg erroring when running from a pip installation (#709) +* Support .pz and .gz compressed models in deployment system +* Support implicit namespace packages in deployment system (#778) +* Fix error with distutils package when deploying in a "virtualenv" env (#747) +* Fix "NameError: name 'mdef' is not defined" error when deploying (#721) +* Deployment system now strips weird -psn_* argument passed to macOS GUI apps +* Fix custom loader hooks sometimes not working with Actor (#750) +* Fix defaults for package_data_dirs in deployment system (#779) +* Fix issues with adding icons to deployed executable (#718) +* Add PNMImage.quantize() that palettizes using median cut algorithm +* Fix stereo and MRT FBO rendering in OpenGL ES (#815) +* RTM_copy_ram mode is now fixed for multiview textures in OpenGL +* Fix OpenGL multisample FBO issue with 16-bit float buffer (#756) +* Fix DirectX 9 crash when resizing vertex buffer in certain ways (#824) +* Workaround for infinite loop in Triangulator for certain polygons (#737) +* Fix dcparser issue with unpacking uint64 and int64 (#751) +* Fix ability to compile dcparser outside of the Panda3D codebase (#759) +* Fix all direct.stdpy.threading2 threads behaving daemonically (#758) +* direct.stdpy.threading2.Thread instances provide daemon and name properties +* Workaround for Tkinter crash on Windows when resizing window (#586) +* Fix possible stack overflow when reading many bytes from a stream (#754) +* Fix mouse confinement region on Windows not updating on window resize (#727) +* Fix mouse confinement being lost on Windows when window loses focus (#729) +* Support adjusting particle birth offset time (#769) +* Support building against OpenEXR 2.4 on Windows (#799) +* Fix ability to pass a tuple to loader.loadModel +* Fix an issue in interrogate with generating C bindings (#722) +* Fix a variety of ABI compatibility issues with NDEBUG builds +* Fix static linking of harfbuzz and freetype in makepanda +* Fix ability to specify --python-incdir and -libdir to makepanda on macOS +* `ls()` and `bam-info -ls` now list included animations +* Fix white ambient color when loading PBR materials from .bam/cache (#828) +* Fix inconsistent behavior when passing small values to shader inputs (#827) +* Fix very rare NVIDIA driver crash when mixing GLSL and Cg shaders +* Fix issue passing unicode to DirectScrolledList (#752) +* Fix interrogate parser issue with function-like macro expansion +* Interrogate now finds types nested in explicitly specialized template class +* Improve performance reading all data from a file with direct.stdpy.file +* PandaSystem now records whether libc++ or libstdc++ was used on macOS +* makepanda.bat now builds against Python 3.7 by default +* Many improvements to API documentation +* pandac/input/*.in interrogatedb files are now included in .whl builds +* Fix division exception in ServerRepository (#762) +* Fix ShaderBuffer contexts not being cleared at GSG destruction +* Fix DirectOptionMenu item text scale reset on item unhighlight (#768) +* Python particle classes now have snake-case aliases +* Fix crash printing out cached buffer contexts +* Rudimentary, experimental, low-level handling of digitizer input devices + ------------------------ RELEASE 1.10.4.1 --------------------- This release fixes only one critical regression: calling destroy() From b7017669a17e1539c410081e1e00acf3437f3707 Mon Sep 17 00:00:00 2001 From: rdb Date: Sat, 4 Jan 2020 14:14:12 +0100 Subject: [PATCH 15/22] makepackage: fix None installdir when not passing in any on macOS --- makepanda/makepackage.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/makepanda/makepackage.py b/makepanda/makepackage.py index 139054eb8c..a12c493aa3 100755 --- a/makepanda/makepackage.py +++ b/makepanda/makepackage.py @@ -473,9 +473,12 @@ def MakeInstallerLinux(version, debversion=None, rpmrelease=1, runtime=False, exit("To build an installer, either rpmbuild or dpkg-deb must be present on your system!") -def MakeInstallerOSX(version, runtime=False, python_versions=[], installdir="/Library/Developer/Panda3D", **kwargs): +def MakeInstallerOSX(version, runtime=False, python_versions=[], installdir=None, **kwargs): outputdir = GetOutputDir() + if installdir is None: + installdir = "/Library/Developer/Panda3D" + if runtime: # Invoke the make_installer script. AddToPathEnv("DYLD_LIBRARY_PATH", outputdir + "/plugins") From 399797d0b1cc4c720c047482b81df67bf24a35a7 Mon Sep 17 00:00:00 2001 From: rdb Date: Sat, 4 Jan 2020 21:06:46 +0100 Subject: [PATCH 16/22] physics: fix assertions when particles get very large positions Fixes #822 --- doc/ReleaseNotes | 1 + panda/src/physics/linearFrictionForce.cxx | 3 +-- panda/src/physics/linearNoiseForce.cxx | 13 ++++--------- 3 files changed, 6 insertions(+), 11 deletions(-) diff --git a/doc/ReleaseNotes b/doc/ReleaseNotes index 17a153f6e6..a89062a341 100644 --- a/doc/ReleaseNotes +++ b/doc/ReleaseNotes @@ -8,6 +8,7 @@ This is a recommended bugfix release, especially for macOS users. * macOS thirdparty packages are now linked with libc++ (#584) * Homebrew Python should now locate Panda libraries correctly (#755) * Work around Tk bug cancelling Load Params in Particle Panel on macOS (#811) +* Fix NaN assertions when particles get very large positions (#822) * Add support for Autodesk Maya 2020 * Fix maya2egg erroring when running from a pip installation (#709) * Support .pz and .gz compressed models in deployment system diff --git a/panda/src/physics/linearFrictionForce.cxx b/panda/src/physics/linearFrictionForce.cxx index 78ebd3d0c4..c953568390 100644 --- a/panda/src/physics/linearFrictionForce.cxx +++ b/panda/src/physics/linearFrictionForce.cxx @@ -61,8 +61,7 @@ get_child_vector(const PhysicsObject* po) { physics_debug(" v "<get_position(); // get all of the components - int int_x, int_y, int_z; + PN_stdfloat int_x, int_y, int_z; PN_stdfloat frac_x, frac_y, frac_z; - int_x = (int) p[0]; - frac_x = p[0] - int_x; - - int_y = (int) p[1]; - frac_y = p[1] - int_y; - - int_z = (int) p[2]; - frac_z = p[2] - int_z; + frac_x = std::modf(p[0], &int_x); + frac_y = std::modf(p[1], &int_y); + frac_z = std::modf(p[2], &int_z); // apply the cubic smoother to the fractional values PN_stdfloat cubic_x, cubic_y, cubic_z; From 8137bea8f863a1e88908908f4c22e0674b781861 Mon Sep 17 00:00:00 2001 From: rdb Date: Sun, 5 Jan 2020 18:52:26 +0100 Subject: [PATCH 17/22] makepackage: fix regression in MakeInstaller on Windows --- makepanda/makepackage.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/makepanda/makepackage.py b/makepanda/makepackage.py index a12c493aa3..ec78a5277e 100755 --- a/makepanda/makepackage.py +++ b/makepanda/makepackage.py @@ -1074,12 +1074,11 @@ def MakeInstallerAndroid(version, **kwargs): def MakeInstaller(version, **kwargs): target = GetTarget() if target == 'windows': - if kwargs.get('installdir') is None: + dir = kwargs.pop('installdir', None) + if dir is None: dir = "C:\\Panda3D-" + version if GetTargetArch() == 'x64': dir += '-x64' - else: - dir = kwargs['installdir'] fn = "Panda3D-" From f68604a3f5b8a1fdd9f78dc732b182ea6b0b6055 Mon Sep 17 00:00:00 2001 From: LD Date: Sun, 5 Jan 2020 21:25:04 +0100 Subject: [PATCH 18/22] cocoadisplay: Fix regression introduced by 45461e667a84b793048db0092596b5c23dbe6b38 Closes #829 --- panda/src/cocoadisplay/cocoaGraphicsWindow.mm | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/panda/src/cocoadisplay/cocoaGraphicsWindow.mm b/panda/src/cocoadisplay/cocoaGraphicsWindow.mm index a14f099d3e..6f4689bda0 100644 --- a/panda/src/cocoadisplay/cocoaGraphicsWindow.mm +++ b/panda/src/cocoadisplay/cocoaGraphicsWindow.mm @@ -1131,7 +1131,9 @@ find_display_mode(int width, int height) { } #endif CFArrayRef modes = CGDisplayCopyAllDisplayModes(_display, options); - CFRelease(options); + if (options != NULL) { + CFRelease(options); + } size_t num_modes = CFArrayGetCount(modes); CGDisplayModeRef mode; @@ -1166,12 +1168,12 @@ find_display_mode(int width, int height) { // As explained above, we want to select the fullscreen display mode using // the same scaling factor, but only for MacOS 10.15+ To do this we check - // the mode width and heightbut also actual pixel widh and height. + // the mode width and height but also actual pixel widh and height. if (CGDisplayModeGetWidth(mode) == width && CGDisplayModeGetHeight(mode) == height && CGDisplayModeGetRefreshRate(mode) == refresh_rate && #if __MAC_OS_X_VERSION_MAX_ALLOWED >= 1080 - (floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_14 || + (floor(NSAppKitVersionNumber) <= NSAppKitVersionNumber10_14 || (CGDisplayModeGetPixelWidth(mode) == expected_pixel_width && CGDisplayModeGetPixelHeight(mode) == expected_pixel_height)) && #endif From ca89b7420a46df3723c5d6c60ef451f7725d063f Mon Sep 17 00:00:00 2001 From: rdb Date: Mon, 6 Jan 2020 00:32:29 +0100 Subject: [PATCH 19/22] Update Python 2.7 EOL warnings to indicate that EOL date is reached [skip ci] --- direct/src/dist/commands.py | 5 ++--- makepanda/makepanda.py | 10 +++++----- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/direct/src/dist/commands.py b/direct/src/dist/commands.py index 36c98949c0..7ec1290d5b 100644 --- a/direct/src/dist/commands.py +++ b/direct/src/dist/commands.py @@ -41,9 +41,8 @@ if sys.version_info < (3, 0): # Warn the user. They might be using Python 2 by accident. print("=================================================================") - print("WARNING: You are using Python 2, which will soon be discontinued.") - print("WARNING: Please use Python 3 for best results and continued") - print("WARNING: support after the EOL date of December 31st, 2019.") + print("WARNING: You are using Python 2, which has reached the end of its") + print("WARNING: life as of January 1, 2020. Please upgrade to Python 3.") print("=================================================================") sys.stdout.flush() time.sleep(4.0) diff --git a/makepanda/makepanda.py b/makepanda/makepanda.py index 237535771b..eae8c16d70 100755 --- a/makepanda/makepanda.py +++ b/makepanda/makepanda.py @@ -595,11 +595,11 @@ if RUNTIME and not HOST_URL: if not PkgSkip("PYTHON") and SDK["PYTHONVERSION"] == "python2.7": warn_prefix = "%sWARNING:%s " % (GetColor("red"), GetColor()) - print("=========================================================================") - print(warn_prefix + "Python 2.7 will reach EOL after December 31, 2019, and will not") - print(warn_prefix + "be supported after that date. Please ensure you are prepared") - print(warn_prefix + "by planning your upgrade to Python 3 now.") - print("=========================================================================") + print("==========================================================================") + print(warn_prefix + "Python 2.7 has reached EOL as of January 1, 2020 and is no longer") + print(warn_prefix + "maintained. Panda3D will soon cease to work with this version.") + print(warn_prefix + "Please upgrade to Python 3 now.") + print("==========================================================================") sys.stdout.flush() # Give the user some time to contemplate their sins time.sleep(6.0) From 4032560e51ee64916e047ed6e4919c0543fed1b7 Mon Sep 17 00:00:00 2001 From: rdb Date: Mon, 6 Jan 2020 03:25:35 +0100 Subject: [PATCH 20/22] makepanda: use Python 3.8 by default in makepanda.bat Fall back to Python 3.7, but never to 2.7, since it is EOL --- makepanda/makepanda.bat | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/makepanda/makepanda.bat b/makepanda/makepanda.bat index ec843cc0ae..b35ce51cb2 100644 --- a/makepanda/makepanda.bat +++ b/makepanda/makepanda.bat @@ -16,10 +16,10 @@ if %PROCESSOR_ARCHITECTURE% == AMD64 ( set thirdparty=thirdparty if defined MAKEPANDA_THIRDPARTY set thirdparty=%MAKEPANDA_THIRDPARTY% -if exist %thirdparty%\win-python3.7%suffix%\python.exe ( - set pythondir=win-python3.7%suffix% +if exist %thirdparty%\win-python3.8%suffix%\python.exe ( + set pythondir=win-python3.8%suffix% ) else ( - set pythondir=win-python%suffix% + set pythondir=win-python3.7%suffix% ) if not exist makepanda\makepanda.py goto :missing1 From d21d58f12c3e0d0a136256be941181a6b9698faa Mon Sep 17 00:00:00 2001 From: rdb Date: Mon, 6 Jan 2020 03:32:01 +0100 Subject: [PATCH 21/22] makepackage: don't install Python 2.7 bindings by default in installer --- makepanda/installer.nsi | 10 +++------- makepanda/makepackage.py | 8 ++++---- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/makepanda/installer.nsi b/makepanda/installer.nsi index f800fa222c..f96f6f15b9 100644 --- a/makepanda/installer.nsi +++ b/makepanda/installer.nsi @@ -136,12 +136,8 @@ var MANPAGE !if "${PYVER}" == "${INCLUDE_PYVER}" SectionIn 1 2 3 !else - !if "${PYVER}" == "2.7" - SectionIn 1 2 - !else - ; See .onInit function where this is dynamically enabled. - SectionIn 2 - !endif + ; See .onInit function where this is dynamically enabled. + SectionIn 2 !endif SetDetailsPrint both @@ -528,7 +524,7 @@ Function .onInit SetRegView ${REGVIEW} !endif - ; We never check for 2.7; it is always enabled in Auto mode + ; We never check for 2.7; it is always disabled in Auto mode !if "${REGVIEW}" == "32" !insertmacro MaybeEnablePyBindingSection 3.5-32 !insertmacro MaybeEnablePyBindingSection 3.6-32 diff --git a/makepanda/makepackage.py b/makepanda/makepackage.py index 395cbbb467..9729f0e3f3 100755 --- a/makepanda/makepackage.py +++ b/makepanda/makepackage.py @@ -650,9 +650,9 @@ def MakeInstallerOSX(version, python_versions=[], installdir=None, **kwargs): for version_info in python_versions: pyver = version_info["version"] - if pyver == "2.7": - # Always install Python 2.7 by default; it's included on macOS. - cond = "true" + if pyver in ("2.7", "3.4"): + # Don't install these EOL versions of Python by default. + cond = "false" else: cond = "isPythonVersionInstalled('%s')" % (pyver) dist.write(' \n' % (pyver, cond, pyver, pyver)) @@ -963,7 +963,7 @@ def MakeInstaller(version, **kwargs): fn += version python_versions = kwargs.get('python_versions', []) - if len(python_versions) == 1 and python_versions[0]["version"] != "2.7": + if len(python_versions) == 1: fn += '-py' + python_versions[0]["version"] if GetOptimize() <= 2: From aad8b45df4a202e8034fe1d3d96d89e5c135d26d Mon Sep 17 00:00:00 2001 From: rdb Date: Mon, 6 Jan 2020 03:34:07 +0100 Subject: [PATCH 22/22] makepanda: update Python 2.7 EOL warning --- makepanda/makepanda.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/makepanda/makepanda.py b/makepanda/makepanda.py index 3e1b50ce42..dcf6cb50b6 100755 --- a/makepanda/makepanda.py +++ b/makepanda/makepanda.py @@ -2588,7 +2588,7 @@ __version__ = '%s' if __debug__: import sys if sys.version_info < (3, 0): - sys.stderr.write("WARNING: Python 2.7 will reach EOL after December 31, 2019.\\n") + sys.stderr.write("WARNING: Python 2.7 has reached EOL as of January 1, 2020.\\n") sys.stderr.write("To suppress this warning, upgrade to Python 3.\\n") sys.stderr.flush() del sys