SHA256
1
0
forked from pool/Mesa
Mesa/U_python-Use-key-functions-when-sorting-containers.patch
Stefan Dirsch dbe2ec5f48 Accepting request 637103 from home:mimi_vx:branches:X11:XOrg
- update to 18.2.1
  * Lot of fixes for Vulkan drivers.

- get rid of libwayland-egl1/libwayland-egl-devel completely; also
  for older Leap versions

- update to 18.2.0
  * This release consists of nearly 2200 commits from approximately
    130 developers.
  * The top highlights include:
    - OpenGL 4.3 on virgl.
    - OpenGL 4.4 Compatibility profile on radeonsi.
    - OpenGL ES 3.2 on radeonsi and virgl.
    - GL_ARB_ES3_2_compatibility on radeonsi.
    - GL_ARB_fragment_shader_interlock on i965.
    - GL_ARB_sample_locations and GL_NV_sample_locations on nvc0 (GM200+).
    - GL_ANDROID_extension_pack_es31a on radeonsi.
    - GL_KHR_texture_compression_astc_ldr on radeonsi.
    - GL_NV_conservative_raster and GL_NV_conservative_raster_dilate on
      nvc0 (GM200+).
    - GL_NV_conservative_raster_pre_snap_triangles on nvc0 (GP102+).
    - multisampled images on nvc0 (GM107+) (now supported on GF100+).
  * Additional features:
    - ANV Extensions:
      - VK_KHR_bind_memory2.
      - VK_KHR_external_fence.
      - VK_KHR_external_fence_capabilities.
      - VK_KHR_external_semaphore.
      - VK_KHR_external_semaphore_capabilities.
      - VK_KHR_maintenance2.

OBS-URL: https://build.opensuse.org/request/show/637103
OBS-URL: https://build.opensuse.org/package/show/X11:XOrg/Mesa?expand=0&rev=774
2018-09-23 10:25:38 +00:00

62 lines
2.1 KiB
Diff

From 8d3ff6244c7cc5a8399afcf0d1d98d7fd8148452 Mon Sep 17 00:00:00 2001
From: Mathieu Bridon <bochecha@daitauha.fr>
Date: Thu, 9 Aug 2018 10:27:23 +0200
Subject: [PATCH] python: Use key-functions when sorting containers
In Python 2, the traditional way to sort containers was to use a
comparison function (which returned either -1, 0 or 1 when passed two
objects) and pass that as the "cmp" argument to the container's sort()
method.
Python 2.4 introduced key-functions, which instead only operate on a
given item, and return a sorting key for this item.
In general, this runs faster, because the cmp-function has to get run
multiple times for each item of the container.
Python 3 removed the cmp-function, enforcing usage of key-functions
instead.
This change makes the script compatible with Python 2 and Python 3.
Signed-off-by: Mathieu Bridon <bochecha@daitauha.fr>
Reviewed-by: Eric Engestrom <eric.engestrom@intel.com>
Reviewed-by: Dylan Baker <dylan@pnwbakers.com>
---
src/mapi/mapi_abi.py | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/mapi/mapi_abi.py b/src/mapi/mapi_abi.py
index e4ce2b6caf..d4c48ec430 100644
--- a/src/mapi/mapi_abi.py
+++ b/src/mapi/mapi_abi.py
@@ -32,6 +32,7 @@ import os
GLAPI = os.path.join(".", os.path.dirname(sys.argv[0]), "glapi/gen")
sys.path.append(GLAPI)
+from operator import attrgetter
import re
from optparse import OptionParser
import gl_XML
@@ -291,7 +292,7 @@ class ABIPrinter(object):
# sort entries by their names
self.entries_sorted_by_names = self.entries[:]
- self.entries_sorted_by_names.sort(lambda x, y: cmp(x.name, y.name))
+ self.entries_sorted_by_names.sort(key=attrgetter('name'))
self.indent = ' ' * 3
self.noop_warn = 'noop_warn'
@@ -441,7 +442,7 @@ class ABIPrinter(object):
"""Return the string pool for use by stubs."""
# sort entries by their names
sorted_entries = self.entries[:]
- sorted_entries.sort(lambda x, y: cmp(x.name, y.name))
+ sorted_entries.sort(key=attrgetter('name'))
pool = []
offsets = {}
--
2.16.4