From 60c75e32b69a155ec8de92b2e5f3266b218ae4fe Mon Sep 17 00:00:00 2001
From: Michael Dickens <michaelld@macports.org>
Date: Fri, 30 Dec 2016 21:20:29 -0500
Subject: [PATCH 1/1] py*-sip: update to 4.19, which provides SIP API 12.0 &
 thus requires dependent ports to be rev-bumped. This new API changes internal
 struct variable names, and the transition isn't entirely complete even though
 there's a new release ... so add in a temporary patch to fix the major
 variable name change from 'type' to 'wt_td' in the generated SIP code.

---
 python/py-sip/Portfile                          | 10 ++++--
 python/py-sip/files/patch-configure.py.diff     |  2 +-
 python/py-sip/files/patch-sipgen_gencode.c.diff | 47 +++++++++++++++++++++++++
 3 files changed, 55 insertions(+), 4 deletions(-)
 create mode 100644 python/py-sip/files/patch-sipgen_gencode.c.diff

diff --git a/python/py-sip/Portfile b/python/py-sip/Portfile
index 98ac9c9..48ea92e 100644
--- a/python/py-sip/Portfile
+++ b/python/py-sip/Portfile
@@ -20,7 +20,7 @@ long_description \
 
 homepage            http://www.riverbankcomputing.co.uk/software/sip/intro
 
-version             4.18.1
+version             4.19
 
 # from siplib/sip.h.in:
 #
@@ -31,6 +31,7 @@ version             4.18.1
 # removed or the order changed then the major number must be
 # incremented and the minor number set to 0.
 #
+# SIP 4.19[.0] provides SIP API 12.0
 # SIP 4.18.[0-1] provides SIP API 11.3
 # SIP 4.17.0 provides SIP API 11.2
 # SIP 4.16.[8-9] provides SIP API 11.2
@@ -55,13 +56,16 @@ if {${name} ne ${subport}} {
         distname        sip-${version}
     }
 
-    checksums           rmd160 adcbd5a87b375e1b357922b608db45862ccf37ea \
-                        sha256 9bce7a2dbf7f105bf68ad1bab58eebc0ce33087ec40396da756463f086ffa290
+    checksums           rmd160 260c814e0ed4aa5ea90a8ac1f9100e7b9452ae21 \
+                        sha256 014bf55f653e0d8bcc582705ef4fbd61e0859a36e959ab46d8fa060cdf0b5e27
 
     patchfiles          patch-siputils.py.diff \
                         patch-specs_macx-g++.diff \
                         patch-configure.py.diff
 
+    # temporary patch to fix struct variable name generation
+    patchfiles-append   patch-sipgen_gencode.c.diff
+
     use_configure       yes
     pre-configure {
         # Ensure correct compilers are used
diff --git a/python/py-sip/files/patch-configure.py.diff b/python/py-sip/files/patch-configure.py.diff
index 572bb48..a108c47 100644
--- a/python/py-sip/files/patch-configure.py.diff
+++ b/python/py-sip/files/patch-configure.py.diff
@@ -1,6 +1,6 @@
 --- configure.py.orig
 +++ configure.py
-@@ -921,7 +921,6 @@
+@@ -922,7 +922,6 @@
          raise
      except:
          sys.stderr.write(
diff --git a/python/py-sip/files/patch-sipgen_gencode.c.diff b/python/py-sip/files/patch-sipgen_gencode.c.diff
new file mode 100644
index 0000000..522548a
--- /dev/null
+++ b/python/py-sip/files/patch-sipgen_gencode.c.diff
@@ -0,0 +1,47 @@
+--- sipgen/gencode.c.orig
++++ sipgen/gencode.c
+@@ -716,7 +716,7 @@
+ "#define sipSaveSlot                 sipAPI_%s->api_save_slot\n"
+ "#define sipClearAnySlotReference    sipAPI_%s->api_clear_any_slot_reference\n"
+ "#define sipVisitSlot                sipAPI_%s->api_visit_slot\n"
+-"#define sipWrappedTypeName(wt)      ((wt)->type->td_cname)\n"
++"#define sipWrappedTypeName(wt)      ((wt)->wt_td->td_cname)\n"
+ "#define sipDeprecated               sipAPI_%s->api_deprecated\n"
+ "#define sipGetReference             sipAPI_%s->api_get_reference\n"
+ "#define sipKeepReference            sipAPI_%s->api_keep_reference\n"
+@@ -768,19 +768,19 @@
+ "#define sipConvertToArray           sipAPI_%s->api_convert_to_array\n"
+ "#define sipConvertToTypedArray      sipAPI_%s->api_convert_to_typed_array\n"
+ "#define sipWrapper_Check(w)         PyObject_TypeCheck((w), sipAPI_%s->api_wrapper_type)\n"
+-"#define sipGetWrapper(p, wt)        sipGetPyObject((p), (wt)->type)\n"
+-"#define sipReleaseInstance(p, wt, s)    sipReleaseType((p), (wt)->type, (s))\n"
++"#define sipGetWrapper(p, wt)        sipGetPyObject((p), (wt)->wt_td)\n"
++"#define sipReleaseInstance(p, wt, s)    sipReleaseType((p), (wt)->wt_td, (s))\n"
+ "#define sipReleaseMappedType        sipReleaseType\n"
+-"#define sipCanConvertToInstance(o, wt, f)   sipCanConvertToType((o), (wt)->type, (f))\n"
++"#define sipCanConvertToInstance(o, wt, f)   sipCanConvertToType((o), (wt)->wt_td, (f))\n"
+ "#define sipCanConvertToMappedType   sipCanConvertToType\n"
+-"#define sipConvertToInstance(o, wt, t, f, s, e)     sipConvertToType((o), (wt)->type, (t), (f), (s), (e))\n"
++"#define sipConvertToInstance(o, wt, t, f, s, e)     sipConvertToType((o), (wt)->wt_td, (t), (f), (s), (e))\n"
+ "#define sipConvertToMappedType      sipConvertToType\n"
+-"#define sipForceConvertToInstance(o, wt, t, f, s, e)    sipForceConvertToType((o), (wt)->type, (t), (f), (s), (e))\n"
++"#define sipForceConvertToInstance(o, wt, t, f, s, e)    sipForceConvertToType((o), (wt)->wt_td, (t), (f), (s), (e))\n"
+ "#define sipForceConvertToMappedType sipForceConvertToType\n"
+-"#define sipConvertFromInstance(p, wt, t)    sipConvertFromType((p), (wt)->type, (t))\n"
++"#define sipConvertFromInstance(p, wt, t)    sipConvertFromType((p), (wt)->wt_td, (t))\n"
+ "#define sipConvertFromMappedType    sipConvertFromType\n"
+ "#define sipConvertFromNamedEnum(v, pt)  sipConvertFromEnum((v), ((sipEnumTypeObject *)(pt))->type)\n"
+-"#define sipConvertFromNewInstance(p, wt, t) sipConvertFromNewType((p), (wt)->type, (t))\n"
++"#define sipConvertFromNewInstance(p, wt, t) sipConvertFromNewType((p), (wt)->wt_td, (t))\n"
+         ,mname
+         ,mname
+         ,mname
+@@ -2885,7 +2885,7 @@
+         if (needs_sipClass)
+             prcode(fp,
+ "\n"
+-"    return (sipClass ? sipClass->type : 0);\n"
++"    return (sipClass ? sipClass->wt_td : 0);\n"
+ "}\n"
+                 );
+         else
-- 
2.10.2

