[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-bindings
Subject:    Re: [Kde-bindings] Progress report on Py*5 binding generation
From:       Stephen Kelly <steveire () gmail ! com>
Date:       2016-04-22 7:29:44
Message-ID: 5719d2e9.522e1c0a.c40ae.ffff8960 () mx ! google ! com
[Download RAW message or body]

Hi Shaheed,

Shaheed Haque wrote:

> I think there are many of these. One example is this one:
> 
> sip/KIOCore/KIOCoremod.sip:%Import KIOCore/kio/kiomod.sip
> sip/KIOCore/kio/kiomod.sip:%Import KIOCore/KIOCoremod.sip

Where do those sip files come from and why do they depend on each other?

>> As the file might be generated by cmake, this might work, but it seems
>> easier to pass the include directories on the command line.  The includes
>> will be different on each platform.
>>
> 
> That is correct, but AFAIK, this is just a build time dependency. Once the
> modules are built, nobody will care. 

I think that depends on whether bindings are built when building a library 
(which I think makes most sense). In that case, we would want to install the 
sip files (somewhere in share/ perhaps) and they should not contain 
hardcoded paths on the filesystem. 

> For me, and for now at least, it is important to be able to run on a large
> body of code without generating anything by hand so generating xxxmod.sip
> files by hand (with or without the %Extract) is not practical. 

The files can still be generated, but without the hardcoded includes. What 
am I missing?

> so that you can then just say "from PyKF5 import KItemModels". You'll
> notice that in support of this, there is a temporary list of hardcoded
> libraries to link against (a quick hack just to get us going).

I tried this and it didn't work. Can you please try what I am doing as a 
sanity check? I have attached it as a patch.

Thanks,

Steve.

["0001-Try-running-the-binding-generator-for-a-single-libra.patch" (text/x-patch)]

From bb93366ea3888ce821c3cca9c2b70ba902195c32 Mon Sep 17 00:00:00 2001
From: Stephen Kelly <steveire@gmail.com>
Date: Fri, 22 Apr 2016 00:14:38 +0200
Subject: [PATCH] Try running the binding generator for a single library/file

---
 sip_generation/create_script.sh       |  5 +++++
 sip_generation/pythontest.py          |  7 +++++++
 sip_generation/sip/kitemmodelsmod.sip | 10 ++++++++++
 sip_generation/sip_compiler.py        | 21 ++++++++++++---------
 4 files changed, 34 insertions(+), 9 deletions(-)
 create mode 100755 sip_generation/create_script.sh
 create mode 100755 sip_generation/pythontest.py
 create mode 100644 sip_generation/sip/kitemmodelsmod.sip

diff --git a/sip_generation/create_script.sh b/sip_generation/create_script.sh
new file mode 100755
index 0000000..8dd4d51
--- /dev/null
+++ b/sip_generation/create_script.sh
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+./sip_generator.py   --includes \
"/usr/include/x86_64-linux-gnu/qt5,/usr/include/x86_64-linux-gnu/qt5/QtCore" \
/usr/include/KF5/KItemModels/kselectionproxymodel.h  > sip/kselectionproxymodel.sip \
+./sip_compiler.py -v --includes \
"/usr/include/x86_64-linux-gnu/qt5,/usr/include/x86_64-linux-gnu/qt5/QtCore" --select \
@kitemmodelsmod.sip sip cxx +./pythontest.py
diff --git a/sip_generation/pythontest.py b/sip_generation/pythontest.py
new file mode 100755
index 0000000..b97b7e2
--- /dev/null
+++ b/sip_generation/pythontest.py
@@ -0,0 +1,7 @@
+#!/usr/bin/env python
+
+from PyQt5 import QtCore
+
+print(QtCore)
+
+from PyKF5 import kitemmodels
diff --git a/sip_generation/sip/kitemmodelsmod.sip \
b/sip_generation/sip/kitemmodelsmod.sip new file mode 100644
index 0000000..ea1e735
--- /dev/null
+++ b/sip_generation/sip/kitemmodelsmod.sip
@@ -0,0 +1,10 @@
+
+%Module PyKDE5.kitemmodels
+
+%ModuleHeaderCode
+#pragma GCC visibility push(default)
+%End
+
+%Import QtCore/QtCoremod.sip
+
+%Include kselectionproxymodel.sip
diff --git a/sip_generation/sip_compiler.py b/sip_generation/sip_compiler.py
index fcc1b24..fb73803 100755
--- a/sip_generation/sip_compiler.py
+++ b/sip_generation/sip_compiler.py
@@ -112,6 +112,9 @@ class CxxDriver(object):
         # legacy header on filesystems with case-insensitive lookups (NTFS).
         #
         module_path = os.path.dirname(sip_file)
+        # the above results in an empty string, which errors later. Set it
+        # to what is probably intended here.
+        module_path = "kitemmodels"
         #
         # Write the header and the body.
         #
@@ -144,20 +147,19 @@ class CxxDriver(object):
                         if line.startswith("%Module"):
                             feature_list = os.path.join(self.input_dir, \
"modules.features")  tmp = set()
-                            with open(feature_list, "rU") as f:
-                                for feature in f:
-                                    if feature not in tmp:
-                                        tmp.add(feature)
-                                        o.write(feature)
+                            # with open(feature_list, "rU") as f:
+                            #     for feature in f:
+                            #         if feature not in tmp:
+                            #             tmp.add(feature)
+                            #             o.write(feature)
             logger.debug(modified_source)
             feature = sip_file.replace(os.path.sep, "_").replace(".", "_")
-            cmd = [self.sipconfig.sip_bin, "-c", full_output, "-b", build_file, \
                "-x", feature, "-X",
-                   INCLUDES_EXTRACT + ":" + module_includes] + self.pyqt_sip_flags + \
sip_roots + [modified_source] +            cmd = [self.sipconfig.sip_bin, "-c", \
full_output, "-b", build_file, "-x", feature] + self.pyqt_sip_flags + sip_roots + \
[modified_source]  self._run_command(cmd)
             #
             # Create the Makefile.
             #
-            module_includes = self.includes + open(module_includes, \
"rU").read().split("\n") +            module_includes = self.includes
             self.sipconfig._macros["INCDIR"] = " ".join(module_includes)
             makefile = sipconfig.SIPModuleMakefile(self.sipconfig, build_file, \
makefile=make_file)  #
@@ -167,8 +169,9 @@ class CxxDriver(object):
             #
             # TODO: replace this hardcoded list of libraries with some more \
apposite.  #
-            makefile.extra_libs = ["KF5DBusAddons", "KF5QuickAddons", \
"KF5ItemModels", "KF5Parts", "KF5People","KF5UnitConversion", "KF5Wallet", \
"KF5SonnetCore"] +            #makefile.extra_libs = ["KF5DBusAddons", \
"KF5QuickAddons", "KF5ItemModels", "KF5Parts", "KF5People","KF5UnitConversion", \
"KF5Wallet", "KF5SonnetCore"]  #
+            makefile.extra_libs = ["m /usr/lib/x86_64-linux-gnu/libQt5Core.so \
/usr/lib/x86_64-linux-gnu/libKF5ItemModels.so \
/usr/lib/x86_64-linux-gnu/libpython2.7.so"]  makefile.generate()
             self._run_command(["make", "-f", os.path.basename(make_file)], \
cwd=full_output)  #
-- 
2.5.0


[Attachment #4 (text/plain)]

_______________________________________________
Kde-bindings mailing list
Kde-bindings@kde.org
https://mail.kde.org/mailman/listinfo/kde-bindings


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic