Revision: 762ff261f020
Author: Devin Anderson <
surface...@gmail.com>
Date: Sun Dec 30 16:43:13 2012
Log: Issue 1: Make sure a compatible version of rtmidi is available
during configure. Also make sure qmake is available.
http://code.google.com/p/midisnoop/source/detail?r=762ff261f020
Modified:
/configure
/install/util.py
=======================================
--- /configure Sun Dec 30 01:18:51 2012
+++ /configure Sun Dec 30 16:43:13 2012
@@ -3,7 +3,7 @@
from optparse import OptionParser
from os.path import abspath, dirname, join
from subprocess import call
-from sys import argv, stdout
+from sys import argv, stderr, stdout
from install.util import (
MAJOR_VERSION,
@@ -12,6 +12,7 @@
PLATFORM_UNIX,
PLATFORM_WIN32,
REVISION,
+ findExecutable,
getPlatform
)
@@ -37,6 +38,17 @@
help="Install prefix")
options, args = parser.parse_args()
+ pkgConfigPath = findExecutable("pkg-config")
+ if pkgConfigPath is None:
+ stderr.write("Warning: pkg-config not found\n")
+ elif call([pkgConfigPath, "--exists", "rtmidi"]) or \
+ call([pkgConfigPath, "--atleast-version=2.0.1", "rtmidi"]):
+ exit("Error: rtmidi version >= 2.0.1 is required for compilation")
+
+ qmakePath = findExecutable("qmake")
+ if qmakePath is None:
+ exit("Error: qmake is required for build configuration")
+
platform = getPlatform()
platformArgs = []
if platform == PLATFORM_MACX:
@@ -88,7 +100,7 @@
dataDir = abspath(join(prefix, dataDir))
# Run `qmake`
- qmakeArgs = ["qmake", "-recursive"] + platformArgs + args + \
+ qmakeArgs = [qmakePath, "-recursive"] + platformArgs + args + \
["MAJOR_VERSION=%d" % MAJOR_VERSION, "MINOR_VERSION=%d" %
MINOR_VERSION,
"REVISION=%d" % REVISION, "BUILDDIR=%s" % buildDir,
"MAKEDIR=%s" % makeDir, "PREFIX=%s" % prefix,
=======================================
--- /install/util.py Sun Dec 30 01:18:51 2012
+++ /install/util.py Sun Dec 30 16:43:13 2012
@@ -1,6 +1,16 @@
from gzip import open
-from os import chdir, getcwd, makedirs, pardir, sep
-from os.path import abspath, dirname, isdir, join
+from os import (
+ X_OK,
+ access,
+ chdir,
+ environ,
+ getcwd,
+ makedirs,
+ pardir,
+ pathsep,
+ sep
+)
+from os.path import abspath, dirname, isabs, isdir, isfile, join
from platform import mac_ver, win32_ver
from string import Template
from subprocess import PIPE, Popen
@@ -42,6 +52,19 @@
finally:
gzipStream.close()
+def findExecutable(command):
+ if not isabs(command):
+ path = environ.get("PATH")
+ if path is not None:
+ for path in path.split(pathsep):
+ commandPath = abspath(join(path.strip('\"'), command))
+ if isfile(commandPath) and access(commandPath, X_OK):
+ return commandPath
+ commandPath = abspath(command)
+ if isfile(commandPath) and access(commandPath, X_OK):
+ return commandPath
+ return None
+
def getPlatform():
return _PLATFORM