From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: "Jan Alexander Steffens (heftig)" <heftig@archlinux.org>
Date: Sat, 25 Jun 2022 20:41:40 +0000
Subject: [PATCH] gyp-fix-cmake

(From Fedora, with fixed exception type)
---
 pylib/gyp/generator/cmake.py | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/pylib/gyp/generator/cmake.py b/pylib/gyp/generator/cmake.py
index 4a2041cf2687..12461dc1d48b 100644
--- a/pylib/gyp/generator/cmake.py
+++ b/pylib/gyp/generator/cmake.py
@@ -40,9 +40,9 @@ import gyp.xcode_emulation
 
 try:
   # maketrans moved to str in python3.
-  _maketrans = string.maketrans
-except NameError:
   _maketrans = str.maketrans
+except AttributeError:
+  _maketrans = string.maketrans
 
 generator_default_variables = {
   'EXECUTABLE_PREFIX': '',
@@ -281,7 +281,7 @@ def WriteActions(target_name, actions, extra_sources, extra_deps,
     dirs = set(dir for dir in (os.path.dirname(o) for o in outputs) if dir)
 
     if int(action.get('process_outputs_as_sources', False)):
-      extra_sources.extend(zip(cmake_outputs, outputs))
+      extra_sources.extend(list(zip(cmake_outputs, outputs)))
 
     # add_custom_command
     output.write('add_custom_command(OUTPUT ')
@@ -987,7 +987,7 @@ def WriteTarget(namer, qualified_target, target_dicts, build_dir, config_to_use,
 
     # XCode settings
     xcode_settings = config.get('xcode_settings', {})
-    for xcode_setting, xcode_value in xcode_settings.viewitems():
+    for xcode_setting, xcode_value in xcode_settings.items():
       SetTargetProperty(output, cmake_target_name,
                         "XCODE_ATTRIBUTE_%s" % xcode_setting, xcode_value,
                         '' if isinstance(xcode_value, str) else ' ')
