Diff of /qt/ScintillaEditPy/sepbuild.py [c6dcd1] .. [4774b4] Maximize Restore

  Switch to side-by-side view

--- a/qt/ScintillaEditPy/sepbuild.py
+++ b/qt/ScintillaEditPy/sepbuild.py
@@ -36,7 +36,10 @@
 	return (mod_time1 > mod_time2)
 
 def textFromRun(args):
-	(stdoutdata, stderrdata) = subprocess.Popen(args, shell=True, stdout=subprocess.PIPE).communicate()
+	proc = subprocess.Popen(args, shell=isinstance(args, str), stdout=subprocess.PIPE)
+	(stdoutdata, stderrdata) = proc.communicate()
+	if proc.returncode:
+		raise OSError(proc.returncode)
 	return stdoutdata
 
 def runProgram(args, exitOnFailure):
@@ -171,22 +174,25 @@
 	def _setPySideBase(self, base):
 		
 		self.PySideBase = base
-		if PLAT_LINUX:
-			self.PySideTypeSystem = textFromRun("pkg-config --variable=typesystemdir pyside").rstrip()
-			self.PySideIncludeBase = textFromRun("pkg-config --variable=includedir pyside").rstrip()
-			self.ShibokenIncludeBase = textFromRun("pkg-config --variable=includedir shiboken").rstrip()
-		else:
-			self.PySideTypeSystem = os.path.join(self.PySideBase, "share", "PySide", "typesystems")
-			self.ShibokenIncludeBase = os.path.join(self.PySideBase, "include", "shiboken")
-			self.PySideIncludeBase = os.path.join(self.PySideBase, "include", "PySide")
-
+		def _try_pkgconfig(var, package, *relpath):
+			try:
+				return textFromRun(["pkg-config", "--variable=" + var, package]).rstrip()
+			except OSError:
+				return os.path.join(self.PySideBase, *relpath)
+		self.PySideTypeSystem = _try_pkgconfig("typesystemdir", "pyside",
+		                                       "share", "PySide", "typesystems")
+		self.PySideIncludeBase = _try_pkgconfig("includedir", "pyside",
+		                                        "include", "PySide")
+		self.ShibokenIncludeBase = _try_pkgconfig("includedir", "shiboken",
+		                                          "include", "shiboken")
 		self.PySideIncludes = [
 			self.ShibokenIncludeBase,
 			self.PySideIncludeBase,
 			os.path.join(self.PySideIncludeBase, "QtCore"),
 			os.path.join(self.PySideIncludeBase, "QtGui")]
 
-		self.PySideLibDir = os.path.join(self.PySideBase, "lib")
+		self.PySideLibDir = _try_pkgconfig("libdir", "pyside", "lib")
+		self.ShibokenLibDir = _try_pkgconfig("libdir", "shiboken", "lib")
 		self.AllIncludes = os.pathsep.join(self.QtIncludes + self.ScintillaEditIncludes + self.PySideIncludes)
 
 		self.ShibokenGenerator = "shiboken"
@@ -244,6 +250,7 @@
 			f.write("PYSIDE_INCLUDES=" + doubleBackSlashes(self.PySideIncludeBase) + "\n")
 			f.write("PYSIDE_LIB=" + doubleBackSlashes(self.PySideLibDir) + "\n")
 			f.write("SHIBOKEN_INCLUDES=" + doubleBackSlashes(self.ShibokenIncludeBase) + "\n")
+			f.write("SHIBOKEN_LIB=" + doubleBackSlashes(self.ShibokenLibDir) + "\n")
 			if self.DebugBuild:
 				f.write("CONFIG += debug\n")
 			else: