From fb4b1540370c1bc151323fbf6c961ae2c65058ba Mon Sep 17 00:00:00 2001 From: rdb Date: Mon, 3 Jan 2022 10:17:58 +0100 Subject: [PATCH 01/14] makepackage: Only add python-pmw as Recommends for deb for Python 2 There is no Pmw for Python 3 in the Ubuntu repositories --- makepanda/makepackage.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/makepanda/makepackage.py b/makepanda/makepackage.py index 6671b38eba..208a127ae2 100755 --- a/makepanda/makepackage.py +++ b/makepanda/makepackage.py @@ -394,12 +394,10 @@ def MakeInstallerLinux(version, debversion=None, rpmversion=None, rpmrelease=1, recommends = ReadFile("targetroot/debian/substvars_rec").replace("shlibs:Depends=", "").strip() provides = "panda3d" - if python2_ver or python3_ver: - recommends += ", python-pmw" - if python2_ver: depends += ", python%s" % (python2_ver) recommends += ", python-wxversion" + recommends += ", python-pmw" recommends += ", python-tk (>= %s)" % (python2_ver) provides += ", python2-panda3d" From c76ddd99584997b3e441fff908bd4c1e5c33a76a Mon Sep 17 00:00:00 2001 From: rdb Date: Mon, 3 Jan 2022 10:33:14 +0100 Subject: [PATCH 02/14] makepackage: Support building deb with more than one Python 3 version Ubuntu Hirsute, Impish, and presumably Jammy ship with both Python 3.9 and 3.10. Also, change the dependency specifications so that only one Python version is strictly required. --- makepanda/makepackage.py | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/makepanda/makepackage.py b/makepanda/makepackage.py index 208a127ae2..33ed1593c5 100755 --- a/makepanda/makepackage.py +++ b/makepanda/makepackage.py @@ -298,6 +298,8 @@ def MakeInstallerLinux(version, debversion=None, rpmversion=None, rpmrelease=1, elif version_info["version"] == sys_python3_ver: python3_ver = sys_python3_ver install_python_versions.append(version_info) + elif os.path.isdir("/usr/lib/python" + version_info["version"]): + install_python_versions.append(version_info) major_version = '.'.join(version.split('.')[:2]) if not debversion: @@ -394,17 +396,21 @@ def MakeInstallerLinux(version, debversion=None, rpmversion=None, rpmrelease=1, recommends = ReadFile("targetroot/debian/substvars_rec").replace("shlibs:Depends=", "").strip() provides = "panda3d" - if python2_ver: - depends += ", python%s" % (python2_ver) + # Require at least one of the Python versions we built for. + depends += ", " + " | ".join("python" + version_info["version"] for version_info in install_python_versions) + + # But recommend the system version of Python 3. + if python3_ver: + recommends += ", python3 (>= %s)" % (python3_ver) + recommends += ", python3-tk (>= %s)" % (python3_ver) + provides += ", python3-panda3d" + elif python2_ver: recommends += ", python-wxversion" recommends += ", python-pmw" recommends += ", python-tk (>= %s)" % (python2_ver) - provides += ", python2-panda3d" - if python3_ver: - depends += ", python%s" % (python3_ver) - recommends += ", python3-tk (>= %s)" % (python3_ver) - provides += ", python3-panda3d" + if python2_ver: + provides += ", python2-panda3d" if not PkgSkip("NVIDIACG"): depends += ", nvidia-cg-toolkit" From 822d8ce4c4fbc6dc2cab22fdca93bcc0d2fa4be7 Mon Sep 17 00:00:00 2001 From: rdb Date: Mon, 3 Jan 2022 11:31:54 +0100 Subject: [PATCH 03/14] Revert "pgraph: Don't dupe shared GeomVertexData when premunging Geom" This reverts commit f058bad802aa881a5604209afe5ef5bfd3d8fe35. Reverting because I realised the current behaviour is happening due to different mungers, which my fix ignores. Unfixes #1185 --- panda/src/pgraph/geomNode.cxx | 27 ++++----------------------- 1 file changed, 4 insertions(+), 23 deletions(-) diff --git a/panda/src/pgraph/geomNode.cxx b/panda/src/pgraph/geomNode.cxx index 367533dd46..a485851448 100644 --- a/panda/src/pgraph/geomNode.cxx +++ b/panda/src/pgraph/geomNode.cxx @@ -876,36 +876,17 @@ do_premunge(GraphicsStateGuardianBase *gsg, GeomTransformer &transformer) { Thread *current_thread = Thread::get_current_thread(); - // Cache munged vertex data, so that we don't duplicate vertex data - // unnecessarily. - std::map munged_vdata; - OPEN_ITERATE_CURRENT_AND_UPSTREAM(_cycler, current_thread) { CDStageWriter cdata(_cycler, pipeline_stage, current_thread); + GeomList::iterator gi; PT(GeomList) geoms = cdata->modify_geoms(); - for (GeomEntry &entry : *geoms) { + for (gi = geoms->begin(); gi != geoms->end(); ++gi) { + GeomEntry &entry = (*gi); CPT(RenderState) geom_state = node_state->compose(entry._state); CPT(Geom) geom = entry._geom.get_read_pointer(); PT(GeomMunger) munger = gsg->get_geom_munger(geom_state, current_thread); - - CPT(GeomVertexData) vdata = geom->get_vertex_data(); - - auto it = munged_vdata.find(vdata); - if (it != munged_vdata.end()) { - vdata = it->second; - } else { - CPT(GeomVertexData) old_vdata = std::move(vdata); - vdata = munger->premunge_data(old_vdata); - munged_vdata[std::move(old_vdata)] = vdata; - } - - CPT(Geom) pgeom = geom; - munger->premunge_geom(pgeom, vdata); - - PT(Geom) geom_copy = pgeom->make_copy(); - geom_copy->set_vertex_data(vdata); - entry._geom = std::move(geom_copy); + entry._geom = transformer.premunge_geom(geom, munger); } } CLOSE_ITERATE_CURRENT_AND_UPSTREAM(_cycler); From 524e2977ffaad96f6ebdc67ac37728bf8beb156a Mon Sep 17 00:00:00 2001 From: rdb Date: Mon, 3 Jan 2022 12:11:56 +0100 Subject: [PATCH 04/14] makepackage: Force use of xz compression for .deb files Impish defaults to zstd, which the version of reprepro on the hosting server doesn't support yet [skip ci] --- makepanda/makepackage.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/makepanda/makepackage.py b/makepanda/makepackage.py index 33ed1593c5..e8dfbecbfb 100755 --- a/makepanda/makepackage.py +++ b/makepanda/makepackage.py @@ -427,7 +427,7 @@ def MakeInstallerLinux(version, debversion=None, rpmversion=None, rpmrelease=1, oscmd("chmod 644 targetroot/DEBIAN/control targetroot/DEBIAN/md5sums") if not runtime: oscmd("chmod 644 targetroot/DEBIAN/conffiles targetroot/DEBIAN/symbols") - oscmd("fakeroot dpkg-deb -b targetroot %s_%s_%s.deb" % (pkg_name, pkg_version, pkg_arch)) + oscmd("fakeroot dpkg-deb -Zxz -b targetroot %s_%s_%s.deb" % (pkg_name, pkg_version, pkg_arch)) elif rpmbuild_present: # Invoke installpanda.py to install it into a temporary dir From e3a49050a03a6ea79248184d98787d58b926c8f4 Mon Sep 17 00:00:00 2001 From: "Stephen A. Imhoff" Date: Mon, 3 Jan 2022 22:57:03 +0000 Subject: [PATCH 05/14] Correct location searched for 64-bit libc-2.24 --- makepanda/makepanda.py | 2 +- makepanda/makewheel.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/makepanda/makepanda.py b/makepanda/makepanda.py index 86011cb217..94215cba14 100755 --- a/makepanda/makepanda.py +++ b/makepanda/makepanda.py @@ -497,7 +497,7 @@ elif target == 'linux' and (os.path.isfile("/lib/libc-2.17.so") or os.path.isfil else: PLATFORM = 'manylinux2014-i686' -elif target == 'linux' and (os.path.isfile("/lib/i386-linux-gnu/libc-2.24.so") or os.path.isfile("/lib/x86_64/libc-2.24.so")) and os.path.isdir("/opt/python"): +elif target == 'linux' and (os.path.isfile("/lib/i386-linux-gnu/libc-2.24.so") or os.path.isfile("/lib/x86_64-linux-gnu/libc-2.24.so")) and os.path.isdir("/opt/python"): # Same sloppy check for manylinux_2_24. if GetTargetArch() in ('x86_64', 'amd64'): PLATFORM = 'manylinux_2_24-x86_64' diff --git a/makepanda/makewheel.py b/makepanda/makewheel.py index 124c44a713..f0cb5cda5d 100644 --- a/makepanda/makewheel.py +++ b/makepanda/makewheel.py @@ -558,7 +558,7 @@ def makewheel(version, output_dir, platform=None): platform = platform.replace("linux", "manylinux2010") elif os.path.isfile("/lib/libc-2.17.so") or os.path.isfile("/lib64/libc-2.17.so"): platform = platform.replace("linux", "manylinux2014") - elif os.path.isfile("/lib/i386-linux-gnu/libc-2.24.so") or os.path.isfile("/lib/x86_64/libc-2.24.so"): + elif os.path.isfile("/lib/i386-linux-gnu/libc-2.24.so") or os.path.isfile("/lib/x86_64-linux-gnu/libc-2.24.so"): platform = platform.replace("linux", "manylinux_2_24") platform = platform.replace('-', '_').replace('.', '_') From 08628dc97e49f10d4bef276aa41426ab1ae8b06c Mon Sep 17 00:00:00 2001 From: rdb Date: Tue, 4 Jan 2022 10:09:36 +0100 Subject: [PATCH 06/14] windisplay: Support horizontal scroll wheel --- panda/src/windisplay/winGraphicsWindow.cxx | 29 ++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/panda/src/windisplay/winGraphicsWindow.cxx b/panda/src/windisplay/winGraphicsWindow.cxx index 624c354781..992acbc2fb 100644 --- a/panda/src/windisplay/winGraphicsWindow.cxx +++ b/panda/src/windisplay/winGraphicsWindow.cxx @@ -33,6 +33,10 @@ #define WM_TOUCH 0x0240 #endif +#ifndef WM_MOUSEHWHEEL +#define WM_MOUSEHWHEEL 0x020E +#endif + #if WINVER < 0x0601 // Not used on Windows XP, but we still need to define it. #define TOUCH_COORD_TO_PIXEL(l) ((l) / 100) @@ -1725,6 +1729,31 @@ window_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) { } break; + case WM_MOUSEHWHEEL: + { + int delta = GET_WHEEL_DELTA_WPARAM(wparam); + + POINT point; + GetCursorPos(&point); + ScreenToClient(hwnd, &point); + double time = get_message_time(); + + if (delta >= 0) { + while (delta > 0) { + handle_keypress(MouseButton::wheel_right(), point.x, point.y, time); + handle_keyrelease(MouseButton::wheel_right(), time); + delta -= WHEEL_DELTA; + } + } else { + while (delta < 0) { + handle_keypress(MouseButton::wheel_left(), point.x, point.y, time); + handle_keyrelease(MouseButton::wheel_left(), time); + delta += WHEEL_DELTA; + } + } + return 0; + } + break; case WM_IME_SETCONTEXT: if (!ime_hide) From c358f09f85e46d2dbbd848053762c1ae94ae391a Mon Sep 17 00:00:00 2001 From: rdb Date: Tue, 4 Jan 2022 10:10:27 +0100 Subject: [PATCH 07/14] windisplay: Support lmeta, rmeta, and menu keys --- panda/src/windisplay/winGraphicsWindow.cxx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/panda/src/windisplay/winGraphicsWindow.cxx b/panda/src/windisplay/winGraphicsWindow.cxx index 992acbc2fb..ec366e4ec9 100644 --- a/panda/src/windisplay/winGraphicsWindow.cxx +++ b/panda/src/windisplay/winGraphicsWindow.cxx @@ -2575,6 +2575,10 @@ lookup_key(WPARAM wparam) const { case VK_LMENU: return KeyboardButton::lalt(); case VK_RMENU: return KeyboardButton::ralt(); + case VK_LWIN: return KeyboardButton::lmeta(); + case VK_RWIN: return KeyboardButton::rmeta(); + case VK_APPS: return KeyboardButton::menu(); + default: int key = MapVirtualKey(wparam, 2); if (isascii(key) && key != 0) { @@ -2742,7 +2746,7 @@ get_keyboard_map() const { unsigned short ex_vsc[] = {0x57, 0x58, 0x011c, 0x011d, 0x0135, 0x0137, 0x0138, 0x0145, 0x0147, 0x0148, 0x0149, 0x014b, 0x014d, 0x014f, 0x0150, 0x0151, 0x0152, 0x0153, 0x015b, 0x015c, 0x015d}; - for (int k = 1; k < 84 + 17; ++k) { + for (int k = 1; k < 84 + sizeof(ex_vsc) / sizeof(short); ++k) { if (k >= 84) { vsc = ex_vsc[k - 84]; } else { From d1c756713dfbb28034af493025e702405571a789 Mon Sep 17 00:00:00 2001 From: rdb Date: Tue, 4 Jan 2022 10:10:58 +0100 Subject: [PATCH 08/14] display: Handle raw event for key between Shift and Z on ISO keyboards This key is called raw-< for lack of anything better, it's usually mapped as backslash on US keyboards but that would not allow distinguishing between the backslash key near the enter key. --- panda/src/cocoadisplay/cocoaGraphicsWindow.mm | 1 + panda/src/device/evdevInputDevice.cxx | 2 +- panda/src/windisplay/winGraphicsWindow.cxx | 3 ++- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/panda/src/cocoadisplay/cocoaGraphicsWindow.mm b/panda/src/cocoadisplay/cocoaGraphicsWindow.mm index df80308b62..87a3c96777 100644 --- a/panda/src/cocoadisplay/cocoaGraphicsWindow.mm +++ b/panda/src/cocoadisplay/cocoaGraphicsWindow.mm @@ -2261,6 +2261,7 @@ map_raw_key(unsigned short keycode) const { case 0x07: return KeyboardButton::ascii_key('x'); case 0x08: return KeyboardButton::ascii_key('c'); case 0x09: return KeyboardButton::ascii_key('v'); + case 0x0A: return KeyboardButton::ascii_key('<'); case 0x0B: return KeyboardButton::ascii_key('b'); case 0x0C: return KeyboardButton::ascii_key('q'); case 0x0D: return KeyboardButton::ascii_key('w'); diff --git a/panda/src/device/evdevInputDevice.cxx b/panda/src/device/evdevInputDevice.cxx index c4d293eb91..05507086b1 100644 --- a/panda/src/device/evdevInputDevice.cxx +++ b/panda/src/device/evdevInputDevice.cxx @@ -962,7 +962,7 @@ map_button(int code, DeviceClass device_class, int quirks) { KeyboardButton::ascii_key('.'), ButtonHandle::none(), ButtonHandle::none(), - ButtonHandle::none(), + KeyboardButton::ascii_key('<'), KeyboardButton::f11(), KeyboardButton::f12(), ButtonHandle::none(), diff --git a/panda/src/windisplay/winGraphicsWindow.cxx b/panda/src/windisplay/winGraphicsWindow.cxx index ec366e4ec9..4bc914e976 100644 --- a/panda/src/windisplay/winGraphicsWindow.cxx +++ b/panda/src/windisplay/winGraphicsWindow.cxx @@ -2724,6 +2724,7 @@ lookup_raw_key(LPARAM lparam) const { // A few additional keys don't fit well in the above table. switch (vsc) { + case 86: return KeyboardButton::ascii_key('<'); // Between lshift and z case 87: return KeyboardButton::f11(); case 88: return KeyboardButton::f12(); default: return ButtonHandle::none(); @@ -2743,7 +2744,7 @@ get_keyboard_map() const { wchar_t text[256]; UINT vsc = 0; - unsigned short ex_vsc[] = {0x57, 0x58, + unsigned short ex_vsc[] = {0x56, 0x57, 0x58, 0x011c, 0x011d, 0x0135, 0x0137, 0x0138, 0x0145, 0x0147, 0x0148, 0x0149, 0x014b, 0x014d, 0x014f, 0x0150, 0x0151, 0x0152, 0x0153, 0x015b, 0x015c, 0x015d}; for (int k = 1; k < 84 + sizeof(ex_vsc) / sizeof(short); ++k) { From 210f7aecfb8bf109eee989b975162a896ff3a6cf Mon Sep 17 00:00:00 2001 From: rdb Date: Tue, 4 Jan 2022 11:06:25 +0100 Subject: [PATCH 09/14] x11: Support mouse buttons 4 and 5 --- panda/src/x11display/x11GraphicsWindow.cxx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/panda/src/x11display/x11GraphicsWindow.cxx b/panda/src/x11display/x11GraphicsWindow.cxx index 25d18a96cf..8548d05eea 100644 --- a/panda/src/x11display/x11GraphicsWindow.cxx +++ b/panda/src/x11display/x11GraphicsWindow.cxx @@ -1990,6 +1990,8 @@ get_mouse_button(XButtonEvent &button_event) { return MouseButton::wheel_left(); } else if (index == x_wheel_right_button) { return MouseButton::wheel_right(); + } else if (index >= 8) { + return MouseButton::button(index - 5); } else { return MouseButton::button(index - 1); } From 6935d2badc3a748f05e5f98f1e73ffc360fa4801 Mon Sep 17 00:00:00 2001 From: rdb Date: Tue, 4 Jan 2022 15:20:28 +0100 Subject: [PATCH 10/14] dist: Add support for tkinter Requires adding `tkinter` to `requirements.txt`. For now, wheels are only provided for Python 3.6 and up. Fixes #780 --- direct/src/dist/FreezeTool.py | 8 ++++- direct/src/dist/commands.py | 57 +++++++++++++++++++++++------------ 2 files changed, 45 insertions(+), 20 deletions(-) diff --git a/direct/src/dist/FreezeTool.py b/direct/src/dist/FreezeTool.py index c8b42263fe..79fc0f5133 100644 --- a/direct/src/dist/FreezeTool.py +++ b/direct/src/dist/FreezeTool.py @@ -2332,7 +2332,13 @@ class PandaModuleFinder(modulefinder.ModuleFinder): return None try: - fp = zip.open(fn.replace(os.path.sep, '/'), 'r') + zip_fn = fn.replace(os.path.sep, '/') + if zip_fn.startswith('deploy_libs/_tkinter.'): + # If we have a tkinter wheel on the path, ignore the + # _tkinter extension in deploy-libs. + if any(entry.endswith(".whl") and os.path.basename(entry).startswith("tkinter-") for entry in self.path): + return None + fp = zip.open(zip_fn, 'r') except KeyError: return None diff --git a/direct/src/dist/commands.py b/direct/src/dist/commands.py index 061f641e67..609707a916 100644 --- a/direct/src/dist/commands.py +++ b/direct/src/dist/commands.py @@ -114,6 +114,7 @@ PACKAGE_DATA_DIRS = { ], 'pytz': [('pytz/zoneinfo/*', 'zoneinfo', ())], 'certifi': [('certifi/cacert.pem', '', {})], + '_tkinter_ext': [('_tkinter_ext/tcl/**', 'tcl', {})], } # Some dependencies have extra directories that need to be scanned for DLLs. @@ -147,21 +148,6 @@ import __builtin__ __builtin__.__import__ = __import__ __builtin__.__file__ = sys.executable del __builtin__ - -# Set the TCL_LIBRARY directory to the location of the Tcl/Tk/Tix files. -import os -tcl_dir = os.path.join(os.path.dirname(sys.executable), 'tcl') -if os.path.isdir(tcl_dir): - for dir in os.listdir(tcl_dir): - sub_dir = os.path.join(tcl_dir, dir) - if os.path.isdir(sub_dir): - if dir.startswith('tcl'): - os.environ['TCL_LIBRARY'] = sub_dir - if dir.startswith('tk'): - os.environ['TK_LIBRARY'] = sub_dir - if dir.startswith('tix'): - os.environ['TIX_LIBRARY'] = sub_dir -del os """ # site.py for Python 3. @@ -196,7 +182,11 @@ def get_data(path): FrozenImporter.find_spec = find_spec FrozenImporter.get_data = get_data +""" +# This addendum is only needed for legacy tkinter handling, since the new +# tkinter package already contains this logic. +SITE_PY_TKINTER_ADDENDUM = """ # Set the TCL_LIBRARY directory to the location of the Tcl/Tk/Tix files. import os tcl_dir = os.path.join(os.path.dirname(sys.executable), 'tcl') @@ -204,7 +194,7 @@ if os.path.isdir(tcl_dir): for dir in os.listdir(tcl_dir): sub_dir = os.path.join(tcl_dir, dir) if os.path.isdir(sub_dir): - if dir.startswith('tcl'): + if dir.startswith('tcl') and os.path.isfile(os.path.join(sub_dir, 'init.tcl')): os.environ['TCL_LIBRARY'] = sub_dir if dir.startswith('tk'): os.environ['TK_LIBRARY'] = sub_dir @@ -592,6 +582,7 @@ class build_apps(setuptools.Command): path = sys.path[:] p3dwhl = None wheelpaths = [] + has_tkinter_wheel = False if use_wheels: wheelpaths = self.download_wheels(platform) @@ -601,6 +592,8 @@ class build_apps(setuptools.Command): p3dwhlfn = whl p3dwhl = self._get_zip_file(p3dwhlfn) break + elif os.path.basename(whl).startswith('tkinter-'): + has_tkinter_wheel = True else: raise RuntimeError("Missing panda3d wheel for platform: {}".format(platform)) @@ -613,6 +606,11 @@ class build_apps(setuptools.Command): distutils.log.WARN ) + for whl in wheelpaths: + if os.path.basename(whl).startswith('tkinter-'): + has_tkinter_wheel = True + break + #whlfiles = {whl: self._get_zip_file(whl) for whl in wheelpaths} # Add whl files to the path so they are picked up by modulefinder @@ -756,9 +754,14 @@ class build_apps(setuptools.Command): return search_path def create_runtime(appname, mainscript, use_console): + site_py = SITE_PY + if not has_tkinter_wheel: + # Legacy handling for Tcl data files + site_py += SITE_PY_TKINTER_ADDENDUM + freezer = FreezeTool.Freezer(platform=platform, path=path) freezer.addModule('__main__', filename=mainscript) - freezer.addModule('site', filename='site.py', text=SITE_PY) + freezer.addModule('site', filename='site.py', text=site_py) for incmod in self.include_modules.get(appname, []) + self.include_modules.get('*', []): freezer.addModule(incmod) for exmod in self.exclude_modules.get(appname, []) + self.exclude_modules.get('*', []): @@ -835,6 +838,12 @@ class build_apps(setuptools.Command): for appname, scriptname in self.console_apps.items(): create_runtime(appname, scriptname, True) + # Warn if tkinter is used but hasn't been added to requirements.txt + if not has_tkinter_wheel and '_tkinter' in freezer_modules: + # The on-windows-for-windows case is handled as legacy below + if sys.platform != "win32" or not platform.startswith('win'): + self.warn("Detected use of tkinter, but tkinter is not specified in requirements.txt!") + # Copy extension modules whl_modules = [] whl_modules_ext = '' @@ -849,6 +858,11 @@ class build_apps(setuptools.Command): if not any(i.endswith(suffix) for suffix in ext_suffixes): continue + if has_tkinter_wheel and i.startswith('deploy_libs/_tkinter.'): + # Ignore this one, we have a separate tkinter package + # nowadays that contains all the dependencies. + continue + base = os.path.basename(i) module, _, ext = base.partition('.') whl_modules.append(module) @@ -917,8 +931,8 @@ class build_apps(setuptools.Command): self.copy_with_dependencies(source_path, target_path, search_path) # Copy over the tcl directory. - #TODO: get this to work on non-Windows platforms. - if sys.platform == "win32" and platform.startswith('win'): + # This is legacy, we nowadays recommend the separate tkinter wheel. + if sys.platform == "win32" and platform.startswith('win') and not has_tkinter_wheel: tcl_dir = os.path.join(sys.prefix, 'tcl') tkinter_name = 'tkinter' if sys.version_info >= (3, 0) else 'Tkinter' @@ -952,9 +966,14 @@ class build_apps(setuptools.Command): target_dir = os.path.join(builddir, target_dir) for wf in filenames: + if wf.endswith('/'): + # Skip directories. + continue + if wf.lower().startswith(source_dir.lower() + '/'): if not srcglob.matches(wf.lower()): continue + wf = wf.replace('/', os.sep) relpath = wf[len(source_dir) + 1:] source_path = os.path.join(whl, wf) From 67b89983acef147d04aa55d10ea7bd71c26030eb Mon Sep 17 00:00:00 2001 From: rdb Date: Tue, 4 Jan 2022 15:25:19 +0100 Subject: [PATCH 11/14] dist: Also accept manylinux wheels when requesting generic linux tag --- direct/src/dist/commands.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/direct/src/dist/commands.py b/direct/src/dist/commands.py index 609707a916..cb3fbc34df 100644 --- a/direct/src/dist/commands.py +++ b/direct/src/dist/commands.py @@ -476,10 +476,18 @@ class build_apps(setuptools.Command): '-d', whldir, '-r', self.requirements_path, '--only-binary', ':all:', - '--platform', platform, '--abi', abi_tag, + '--platform', platform, ] + if platform.startswith('linux_'): + # Also accept manylinux. + arch = platform[6:] + if sys.version_info >= (3, 10): + pip_args += ['--platform', 'manylinux2010_' + arch] + else: + pip_args += ['--platform', 'manylinux1_' + arch] + if self.use_optimized_wheels: pip_args += [ '--extra-index-url', self.optimized_wheel_index From 4ce5efb0449b36c77c6d015d89378cc4dcefbcd4 Mon Sep 17 00:00:00 2001 From: rdb Date: Tue, 4 Jan 2022 15:29:47 +0100 Subject: [PATCH 12/14] makewheel: Remove _tkinter.so from Panda3D wheels It is nowadays supplied in a separate wheel, see also #780 Keep it in the Windows wheel for now since that's the only platform where deploying without a separate tkinter wheel is currently supported, but will remove it on master branch --- makepanda/makewheel.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/makepanda/makewheel.py b/makepanda/makewheel.py index f0cb5cda5d..2e1b18ec45 100644 --- a/makepanda/makewheel.py +++ b/makepanda/makewheel.py @@ -673,6 +673,10 @@ __version__ = '{0}' for file in os.listdir(ext_mod_dir): if file.endswith(ext_suffix): + if file.startswith('_tkinter.') and sys.platform not in ('win32', 'cygwin'): + # Tkinter is supplied in a separate wheel. + continue + source_path = os.path.join(ext_mod_dir, file) if file.endswith('.pyd') and platform.startswith('cygwin'): From b2aa5beb96c266533fb6b93fc45babc74ea31cb5 Mon Sep 17 00:00:00 2001 From: rdb Date: Tue, 4 Jan 2022 15:33:31 +0100 Subject: [PATCH 13/14] Use 1.10.11 thirdparty tools --- .github/workflows/ci.yml | 12 ++++++------ README.md | 6 +++--- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 104acdde0c..bdc640961a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -20,16 +20,16 @@ jobs: shell: powershell run: | $wc = New-Object System.Net.WebClient - $wc.DownloadFile("https://www.panda3d.org/download/panda3d-1.10.10/panda3d-1.10.10-tools-win64.zip", "thirdparty-tools.zip") + $wc.DownloadFile("https://www.panda3d.org/download/panda3d-1.10.11/panda3d-1.10.11-tools-win64.zip", "thirdparty-tools.zip") Expand-Archive -Path thirdparty-tools.zip - Move-Item -Path thirdparty-tools/panda3d-1.10.10/thirdparty -Destination . + Move-Item -Path thirdparty-tools/panda3d-1.10.11/thirdparty -Destination . - name: Get thirdparty packages (macOS) if: runner.os == 'macOS' run: | - curl -O https://www.panda3d.org/download/panda3d-1.10.10/panda3d-1.10.10-tools-mac.tar.gz - tar -xf panda3d-1.10.10-tools-mac.tar.gz - mv panda3d-1.10.10/thirdparty thirdparty - rmdir panda3d-1.10.10 + curl -O https://www.panda3d.org/download/panda3d-1.10.11/panda3d-1.10.11-tools-mac.tar.gz + tar -xf panda3d-1.10.11-tools-mac.tar.gz + mv panda3d-1.10.11/thirdparty thirdparty + rmdir panda3d-1.10.11 (cd thirdparty/darwin-libs-a && rm -rf rocket) - name: Set up Python 3.9 uses: actions/setup-python@v2 diff --git a/README.md b/README.md index 1b3cd3d1bf..1fb6d99fb3 100644 --- a/README.md +++ b/README.md @@ -64,8 +64,8 @@ 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.10/panda3d-1.10.10-tools-win64.zip -- https://www.panda3d.org/download/panda3d-1.10.10/panda3d-1.10.10-tools-win32.zip +- https://www.panda3d.org/download/panda3d-1.10.11/panda3d-1.10.11-tools-win64.zip +- https://www.panda3d.org/download/panda3d-1.10.11/panda3d-1.10.11-tools-win32.zip After acquiring these dependencies, you can build Panda3D from the command prompt using the following command. Change the `--msvc-version` option based @@ -136,7 +136,7 @@ macOS ----- On macOS, you will need to download a set of precompiled thirdparty packages in order to -compile Panda3D, which can be acquired from [here](https://www.panda3d.org/download/panda3d-1.10.10/panda3d-1.10.10-tools-mac.tar.gz). +compile Panda3D, which can be acquired from [here](https://www.panda3d.org/download/panda3d-1.10.11/panda3d-1.10.11-tools-mac.tar.gz). After placing the thirdparty directory inside the panda3d source directory, you may build Panda3D using a command like the following: From 28b566726a509acfb85920848222234df8b87b80 Mon Sep 17 00:00:00 2001 From: rdb Date: Tue, 4 Jan 2022 15:14:16 +0100 Subject: [PATCH 14/14] dist: Suppress spurious warnings about missing tkinter modules [skip ci] --- direct/src/dist/FreezeTool.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/direct/src/dist/FreezeTool.py b/direct/src/dist/FreezeTool.py index 79fc0f5133..1e5554afa9 100644 --- a/direct/src/dist/FreezeTool.py +++ b/direct/src/dist/FreezeTool.py @@ -123,12 +123,16 @@ if sys.version_info < (3, 0): 'direct.showbase.PythonUtil': ['builtins'] + ignoreImports['direct.showbase.PythonUtil'], 'direct.showbase.ShowBase': ['builtins'], 'direct.showbase.ShowBaseGlobal': ['builtins'], + 'direct.showbase.TkGlobal': ['tkinter'], + 'direct.tkpanels.TaskManagerPanel': ['tkinter'], + 'direct.tkwidgets.WidgetPropertiesDialog': ['tkinter'], 'py._builtin': ['builtins'], }) else: # And ignore attempts to conditionally import __builtin__ in Python 3, # suppressing a warning message. ignoreImports.update({ + 'direct.directtools.DirectSession': ['tkSimpleDialog'], 'direct.p3d.AppRunner': ['__builtin__'], 'direct.showbase.ContainerLeakDetector': ['__builtin__'], 'direct.showbase.LeakDetectors': ['__builtin__'], @@ -138,6 +142,17 @@ else: 'direct.showbase.PythonUtil': ['__builtin__'] + ignoreImports['direct.showbase.PythonUtil'], 'direct.showbase.ShowBase': ['__builtin__'], 'direct.showbase.ShowBaseGlobal': ['__builtin__'], + 'direct.showbase.TkGlobal': ['Tkinter'], + 'direct.tkpanels.AnimPanel': ['tkFileDialog', 'tkSimpleDialog'], + 'direct.tkpanels.FSMInspector': ['tkSimpleDialog'], + 'direct.tkpanels.MopathRecorder': ['tkFileDialog'], + 'direct.tkpanels.ParticlePanel': ['tkFileDialog', 'tkSimpleDialog'], + 'direct.tkpanels.TaskManagerPanel': ['Tkinter'], + 'direct.tkwidgets.AppShell': ['tkFileDialog'], + 'direct.tkwidgets.EntryScale': ['tkColorChooser', 'tkSimpleDialog'], + 'direct.tkwidgets.Valuator': ['tkColorChooser'], + 'direct.tkwidgets.VectorWidgets': ['tkColorChooser'], + 'direct.tkwidgets.WidgetPropertiesDialog': ['Tkinter'], 'py._builtin': ['__builtin__'], })