diff options
-rw-r--r-- | qtinfo.py | 11 | ||||
-rw-r--r-- | setup.py | 7 |
2 files changed, 16 insertions, 2 deletions
@@ -8,6 +8,10 @@ class QtInfo(object): self._qmake_command = qmake_command else: self._qmake_command = [find_executable("qmake"),] + self._dict = {} + # bind all variables early at __init__ time. + for thing in self.__class__.__dict__: + getattr(self, thing) def getQMakeCommand(self): qmake_command_string = self._qmake_command[0] @@ -39,7 +43,7 @@ class QtInfo(object): def getDocsPath(self): return self.getProperty("QT_INSTALL_DOCS") - def getProperty(self, prop_name): + def _getProperty(self, prop_name): cmd = self._qmake_command + ["-query", prop_name] proc = subprocess.Popen(cmd, stdout = subprocess.PIPE, shell=False) prop = proc.communicate()[0] @@ -50,6 +54,11 @@ class QtInfo(object): return str(prop, 'ascii').strip() return prop.strip() + def getProperty(self, prop_name): + if prop_name not in self._dict: + self._dict[prop_name] = self._getProperty(prop_name) + return self._dict[prop_name] + version = property(getVersion) bins_dir = property(getBinsPath) libs_dir = property(getLibsPath) @@ -233,6 +233,12 @@ if OPTION_QMAKE is None: if OPTION_QMAKE is None: OPTION_QMAKE = find_executable("qmake") +# make qtinfo.py independent of relative paths. +if OPTION_QMAKE is not None and os.path.exists(OPTION_QMAKE): + OPTION_QMAKE = os.path.abspath(OPTION_QMAKE) +if OPTION_CMAKE is not None and os.path.exists(OPTION_CMAKE): + OPTION_CMAKE = os.path.abspath(OPTION_CMAKE) + QMAKE_COMMAND = None if OPTION_QMAKE is not None and os.path.exists(OPTION_QMAKE): # Checking whether qmake executable exists if os.path.islink(OPTION_QMAKE) and os.path.lexists(OPTION_QMAKE): # Looking whether qmake path is a link and whether the link exists @@ -247,7 +253,6 @@ if len(QMAKE_COMMAND) == 0 or QMAKE_COMMAND[0] is None: if not os.path.exists(QMAKE_COMMAND[0]): print("'%s' does not exist." % QMAKE_COMMAND[0]) sys.exit(1) - if OPTION_CMAKE is None: OPTION_CMAKE = find_executable("cmake") |