Example #1
0
    def _runImpl(self):
        """Doc..."""
        if self._check:
            return self._runCheck()

        testStr  = u'Test' if self._test else u''
        typeStr  = u'Installer' if self._install else u'Uninstaller'
        labelStr = u' '.join([testStr, typeStr]).strip()

        self._verboseLog(u'<h1>Running %s...</h1>' % labelStr)

        envFiles = MayaEnvUtils.locateMayaEnvFiles()
        if not envFiles:
            self._verboseLog(u"""\
            <p style="color:#FF6666;">Operation failed. Unable to locate a maya installation.\
            Make sure you have opened Maya at least once after installing it.</p>""")
            return 0

        for envFile in envFiles:
            self._verboseLog(
                u'<p><span style="font-weight:bold;">%s:</span> %s' % (labelStr, envFile))

            result = MayaEnvUtils.modifyEnvFile(
                envFile,
                test=self._test,
                install=self._install,
                otherPaths=[self._cadenceEntry, self._elixirEntry])

            if result is None:
                self._verboseLog(
                    u'<p style="color:#FF6666;">ERROR: %s attempt failed.</p>' % labelStr)
            else:
                for item in result.removed:
                    self._verboseLog(
                        u'<p><span style="font-weight:bold;">REMOVED:</span> %s</p>' % item.rootName)

                for item in result.added:
                    self._verboseLog(
                        u'<p><span style="font-weight:bold;">ADDED:</span> %s</p>' % item.rootName)

                self._verboseLog(
                    u'<p style="color:#33CC33;">SUCCESS: %s complete.</p>' % labelStr)

        self._verboseLog(u'<h2>Operation Complete</h2>')
        return 0
Example #2
0
    def _runCheck(self):
        self._verboseLog(u'<h1>Running Check...</h1>')
        envFiles = MayaEnvUtils.locateMayaEnvFiles()

        if not envFiles:
            self._verboseLog(u"""\
            <p style="color:#FF6666;">Operation failed. Unable to locate a maya installation.\
            Make sure you have opened Maya at least once after installing it.</p>""")
            self._output['success'] = False
            return 0

        for env in envFiles:
            if MayaEnvUtils.checkEnvFile(env, otherPaths=[self._cadenceEntry, self._elixirEntry]):
                self._output['success'] = True
                return 0

        self._output['success'] = False
        return 0