FindSIP.py
Wolfgang Rohdewald
wolfgang at rohdewald.de
Thu Mar 24 02:08:29 CET 2011
On windows, compiling with Microsoft Visual Express 2010,
cmake passes the path C:\Python27\sip/PyKDE4 to the compiler
the compiler complains about the option P
the path C:\Python27\sip is generated by cmake/modules/FindSIP.py
this patch changes FindSIP.py such that it always outputs
paths as cmake uses them internally, C:/Python27/sip in this
case. cmake will then pass correct path names to the compiler
I found no cmake command which would convert this path.
is it OK if I commit this patch?
diff --git a/cmake/modules/FindSIP.py b/cmake/modules/FindSIP.py
index ecb734f..5b524f6 100644
--- a/cmake/modules/FindSIP.py
+++ b/cmake/modules/FindSIP.py
@@ -6,10 +6,23 @@
import sys
import sipconfig
+import posixpath
+import os
+
+def dos2posix(original):
+ if os.name != 'nt':
+ return original
+ drive, path = os.path.splitdrive(original)
+ splits = [drive]
+ pathsplits = list(os.path.split(path))
+ if pathsplits[0][0] == '\\':
+ pathsplits[0] = pathsplits[0][1:]
+ splits.extend(pathsplits)
+ return posixpath.join(*splits)
sipcfg = sipconfig.Configuration()
print("sip_version:%06.0x" % sipcfg.sip_version)
print("sip_version_str:%s" % sipcfg.sip_version_str)
-print("sip_bin:%s" % sipcfg.sip_bin)
-print("default_sip_dir:%s" % sipcfg.default_sip_dir)
-print("sip_inc_dir:%s" % sipcfg.sip_inc_dir)
+print("sip_bin:%s" % dos2posix(sipcfg.sip_bin))
+print("default_sip_dir:%s" % dos2posix(sipcfg.default_sip_dir))
+print("sip_inc_dir:%s" % dos2posix(sipcfg.sip_inc_dir))
--
Wolfgang
More information about the Kde-buildsystem
mailing list