Przeglądaj źródła

Merge branch 'release/1.10.x'

rdb 6 lat temu
rodzic
commit
81b33a7afa

+ 31 - 6
direct/src/dist/FreezeTool.py

@@ -11,6 +11,7 @@ import struct
 import io
 import distutils.sysconfig as sysconf
 import zipfile
+import importlib
 
 from . import pefile
 
@@ -2349,12 +2350,36 @@ class PandaModuleFinder(modulefinder.ModuleFinder):
             code += b'\n' if isinstance(code, bytes) else '\n'
             co = compile(code, pathname, 'exec')
         elif type == imp.PY_COMPILED:
-            try:
-                marshal_data = importlib._bootstrap_external._validate_bytecode_header(fp.read())
-            except ImportError as exc:
-                self.msgout(2, "raise ImportError: " + str(exc), pathname)
-                raise
-            co = marshal.loads(marshal_data)
+            if sys.version_info >= (3, 7):
+                try:
+                    data = fp.read()
+                    importlib._bootstrap_external._classify_pyc(data, fqname, {})
+                except ImportError as exc:
+                    self.msgout(2, "raise ImportError: " + str(exc), pathname)
+                    raise
+
+                co = marshal.loads(memoryview(data)[16:])
+            elif sys.version_info >= (3, 4):
+                try:
+                    if sys.version_info >= (3, 5):
+                        marshal_data = importlib._bootstrap_external._validate_bytecode_header(fp.read())
+                    else:
+                        marshal_data = importlib._bootstrap._validate_bytecode_header(fp.read())
+                except ImportError as exc:
+                    self.msgout(2, "raise ImportError: " + str(exc), pathname)
+                    raise
+
+                co = marshal.loads(marshal_data)
+            else:
+                if fp.read(4) != imp.get_magic():
+                    self.msgout(2, "raise ImportError: Bad magic number", pathname)
+                    raise ImportError("Bad magic number in %s" % pathname)
+
+                fp.read(4)
+                if sys.version_info >= (3, 3):
+                    fp.read(4)
+
+                co = marshal.load(fp)
         else:
             co = None
 

+ 16 - 13
direct/src/dist/commands.py

@@ -112,6 +112,7 @@ PACKAGE_DATA_DIRS = {
         ('cefpython3/subprocess*', '', {'PKG_DATA_MAKE_EXECUTABLE'}),
         ('cefpython3/locals/*', 'locals', {}),
         ('cefpython3/Chromium Embedded Framework.framework/Resources', 'Chromium Embedded Framework.framework/Resources', {}),
+        ('cefpython3/Chromium Embedded Framework.framework/Chromium Embedded Framework', '', {'PKG_DATA_MAKE_EXECUTABLE'}),
     ],
 }
 
@@ -831,7 +832,7 @@ class build_apps(setuptools.Command):
                 whlfile = self._get_zip_file(whl)
                 filenames = whlfile.namelist()
                 for source_pattern, target_dir, flags in datadesc:
-                    srcglob = p3d.GlobPattern(source_pattern)
+                    srcglob = p3d.GlobPattern(source_pattern.lower())
                     source_dir = os.path.dirname(source_pattern)
                     # Relocate the target dir to the build directory.
                     target_dir = target_dir.replace('/', os.sep)
@@ -1178,18 +1179,20 @@ class build_apps(setuptools.Command):
                     dylib = dylib.replace('@loader_path/../Frameworks/', '')
                 elif dylib.startswith('@executable_path/../Frameworks/'):
                     dylib = dylib.replace('@executable_path/../Frameworks/', '')
-                elif dylib.startswith('@loader_path/'):
-                    dylib = dylib.replace('@loader_path/', '')
-
-                    # Do we need to flatten the relative reference?
-                    if '/' in dylib and flatten:
-                        new_dylib = '@loader_path/' + os.path.basename(dylib)
-                        str_size = len(cmd_data) - 16
-                        if len(new_dylib) < str_size:
-                            fp.seek(-str_size, os.SEEK_CUR)
-                            fp.write(new_dylib.encode('ascii').ljust(str_size, b'\0'))
-                        else:
-                            self.warn('Unable to rewrite dependency {}'.format(orig))
+                else:
+                    for prefix in ('@loader_path/', '@rpath/'):
+                        if dylib.startswith(prefix):
+                            dylib = dylib.replace(prefix, '')
+
+                            # Do we need to flatten the relative reference?
+                            if '/' in dylib and flatten:
+                                new_dylib = prefix + os.path.basename(dylib)
+                                str_size = len(cmd_data) - 16
+                                if len(new_dylib) < str_size:
+                                    fp.seek(-str_size, os.SEEK_CUR)
+                                    fp.write(new_dylib.encode('ascii').ljust(str_size, b'\0'))
+                                else:
+                                    self.warn('Unable to rewrite dependency {}'.format(orig))
 
                 load_dylibs.append(dylib)
 

+ 4 - 0
makepanda/makepackage.py

@@ -610,6 +610,10 @@ def MakeInstallerOSX(version, python_versions=[], installdir=None, **kwargs):
     dist.write('    </allowed-os-versions>\n')
     dist.write('    <options customize="always" allow-external-scripts="no" rootVolumeOnly="false" hostArchitectures="x86_64"/>\n')
     dist.write('    <license language="en" mime-type="text/plain">%s</license>\n' % ReadFile("doc/LICENSE"))
+    dist.write('    <readme language="en" mime-type="text/plain">')
+    dist.write('WARNING: From Panda3D version 1.10.5 onwards, the default installation has been changed from /Developer/Panda3D to /Library/Developer/Panda3D\n')
+    dist.write('This installation script will remove any existing installation in /Developer and if possible create a symbolic link towards /Library/Developer/Panda3D\n')
+    dist.write('    </readme>')
     dist.write('    <script>\n')
     dist.write('    function isPythonVersionInstalled(version) {\n')
     dist.write('        return system.files.fileExistsAtPath("/usr/bin/python" + version)\n')

+ 12 - 0
panda/src/device/winRawInputDevice.cxx

@@ -69,6 +69,18 @@ static const struct DeviceMapping {
   {0x0955, 0x7214, InputDevice::DeviceClass::gamepad, 0,
     {"face_a", "face_b", 0, "face_x", "face_y", "rshoulder", "lshoulder", "rshoulder", 0, 0, 0, "start", 0, "lstick", "rstick", 0}
   },
+  // Dualshock (PS4)
+  {0x054c, 0x05c4, InputDevice::DeviceClass::gamepad, 0,
+    {"face_x", "face_a", "face_b", "face_y", "lshoulder", "rshoulder", "ltrigger", "rtrigger", "back", "start", "lstick", "rstick", "guide", 0}
+  },
+  // Dualshock 2nd Gen (PS4 Slim)
+  {0x054c, 0x09cc, InputDevice::DeviceClass::gamepad, 0,
+    {"face_x", "face_a", "face_b", "face_y", "lshoulder", "rshoulder", "ltrigger", "rtrigger", "back", "start", "lstick", "rstick", "guide", 0}
+  },
+  // Dualshock 2nd Gen (PS4 wireless adapter)
+  {0x054c, 0x0ba0, InputDevice::DeviceClass::gamepad, 0,
+    {"face_x", "face_a", "face_b", "face_y", "lshoulder", "rshoulder", "ltrigger", "rtrigger", "back", "start", "lstick", "rstick", "guide", 0}
+  },
   {0},
 };
 

+ 11 - 17
panda/src/display/graphicsPipe.cxx

@@ -56,36 +56,30 @@ union cpuid_info {
 };
 
 /**
- * Returns the highest cpuid leaf that is supported by the CPU.
+ * Gets cpuid info for the given leaf.
  */
-static inline uint32_t get_cpuid_max(uint32_t leaf) {
+static inline void get_cpuid(uint32_t leaf, cpuid_info &info) {
 #if defined(__GNUC__) && !defined(__APPLE__)
-  return __get_cpuid_max(leaf, nullptr);
+  __cpuid(leaf, info.eax, info.ebx, info.ecx, info.edx);
 #elif defined(_MSC_VER)
-  uint32_t p[4] = {0};
-  __cpuid((int *)p, leaf);
-  return p[0];
+  __cpuid((int *)info.str, leaf);
 #else
-  unsigned int eax = 0;
   __asm__ ("cpuid\n\t"
-           : "=a" (eax)
+           : "=a" (info.eax), "=b" (info.ebx), "=c" (info.ecx), "=d" (info.edx)
            : "0" (leaf));
-  return eax;
 #endif
 }
 
 /**
- * Gets cpuid info for the given leaf.
+ * Returns the highest cpuid leaf that is supported by the CPU.
  */
-static inline void get_cpuid(uint32_t leaf, cpuid_info &info) {
+static inline uint32_t get_cpuid_max(uint32_t leaf) {
 #if defined(__GNUC__) && !defined(__APPLE__)
-  __cpuid(leaf, info.eax, info.ebx, info.ecx, info.edx);
-#elif defined(_MSC_VER)
-  __cpuid((int *)info.str, leaf);
+  return __get_cpuid_max(leaf, nullptr);
 #else
-  __asm__ ("cpuid\n\t"
-           : "=a" (info.eax), "=b" (info.ebx), "=c" (info.ecx), "=d" (info.edx)
-           : "0" (leaf));
+  cpuid_info info;
+  get_cpuid(leaf, info);
+  return info.eax;
 #endif
 }
 #endif