Пример #1
0
    def run(self, project, platform, requestId, param1, param2, param3):
        self._log.debug("Started EditorApi with arguments: {0}".format(
            " ".join(sys.argv[1:])))

        self._project = project
        self._platform = platform
        self._requestId = requestId
        self._param1 = param1
        self._param2 = param2
        self._param3 = param3

        succeeded = True

        # This is repeated in __main__ but this is better because
        # it will properly log detailed errors to the file log instead of to the console
        try:
            self._runInternal()
        except Exception as e:
            sys.stderr.write(str(e))
            self._log.error(str(e))

            if not MiscUtil.isRunningAsExe():
                self._log.error('\n' + traceback.format_exc())

            succeeded = False

        if not succeeded:
            sys.exit(1)
Пример #2
0
def _getProjenyDir():

    if not MiscUtil.isRunningAsExe():
        scriptDir = os.path.dirname(os.path.realpath(__file__))
        return os.path.join(scriptDir, '../../..')

    return os.path.join(MiscUtil.getExecDirectory(), '../..')
Пример #3
0
    def runWrapper(self, runner):
        startTime = datetime.now()

        succeeded = False

        try:
            runner()
            succeeded = True

        except KeyboardInterrupt as e:
            self._log.error('Operation aborted by user by hitting CTRL+C')

        except Exception as e:
            self._log.error(str(e))

            # Only print stack trace if it's a build-script error
            if not isinstance(e, ProcessErrorCodeException) and not isinstance(e, ProcessTimeoutException):
                if MiscUtil.isRunningAsExe():
                    self._log.noise('\n' + traceback.format_exc())
                else:
                    self._log.debug('\n' + traceback.format_exc())

        totalSeconds = (datetime.now()-startTime).total_seconds()
        totalSecondsStr = Util.formatTimeDelta(totalSeconds)

        if succeeded:
            self._log.good('Operation completed successfully.  Took ' + totalSecondsStr + '.\n')
        else:
            self._log.info('Operation completed with errors.  Took ' + totalSecondsStr + '.\n')

        return succeeded
Пример #4
0
    def run(self, project, platform, requestId, param1, param2, param3):
        self._log.debug("Started EditorApi with arguments: {0}".format(" ".join(sys.argv[1:])))

        self._project = project
        self._platform = platform
        self._requestId = requestId
        self._param1 = param1
        self._param2 = param2
        self._param3 = param3

        succeeded = True

        # This is repeated in __main__ but this is better because
        # it will properly log detailed errors to the file log instead of to the console
        try:
            self._runInternal()
        except Exception as e:
            sys.stderr.write(str(e))
            self._log.error(str(e))

            if not MiscUtil.isRunningAsExe():
                self._log.error('\n' + traceback.format_exc())

            succeeded = False

        if not succeeded:
            sys.exit(1)
Пример #5
0
def _getProjenyDir():

    if not MiscUtil.isRunningAsExe():
        scriptDir = os.path.dirname(os.path.realpath(__file__))
        return os.path.join(scriptDir, '../../..')

    # This works for both exe builds (Bin/Prj/Data/Prj.exe) and running from source (Source/prj/_main/Prj.py) by coincidence
    return os.path.join(MiscUtil.getExecDirectory(), '../../..')
Пример #6
0
def _getProjenyDir():

    if not MiscUtil.isRunningAsExe():
        scriptDir = os.path.dirname(os.path.realpath(__file__))
        return os.path.join(scriptDir, '../../..')

    # This works for both exe builds (Bin/Prj/Data/Prj.exe) and running from source (Source/prj/_main/Prj.py) by coincidence
    return os.path.join(MiscUtil.getExecDirectory(), '../../..')
Пример #7
0
def installPlugins():
    if MiscUtil.isRunningAsExe():
        # Must be running from source for plugins
        return

    import importlib

    pluginDir = _getPluginDirPath()

    for filePath in _findFilesByPattern(pluginDir, '*.py'):
        basePath = filePath[len(pluginDir) + 1:]
        basePath = os.path.splitext(basePath)[0]
        basePath = basePath.replace('\\', '.')
        importlib.import_module('prj.plugins.' + basePath)
Пример #8
0
def installPlugins():
    if MiscUtil.isRunningAsExe():
        # Must be running from source for plugins
        return

    import importlib

    pluginDir = _getPluginDirPath()

    for filePath in _findFilesByPattern(pluginDir, '*.py'):
        basePath = filePath[len(pluginDir) + 1:]
        basePath = os.path.splitext(basePath)[0]
        basePath = basePath.replace('\\', '.')
        importlib.import_module('prj.plugins.' + basePath)
Пример #9
0
def installBindings(mainConfigPath):

    assertIsNotNone(mainConfigPath)
    assertThat(os.path.isfile(mainConfigPath))

    projenyDir = _getProjenyDir()
    projenyConfigPath = os.path.join(projenyDir, ConfigFileName)

    # Put the standard config first so it can be over-ridden by user settings
    configPaths = [projenyConfigPath, mainConfigPath]
    configPaths += _getExtraUserConfigPaths()

    Container.bind('Config').toSingle(Config,
                                      loadYamlFilesThatExist(*configPaths))

    initialVars = {
        'ProjenyDir': projenyDir,
    }

    initialVars['ConfigDir'] = os.path.dirname(mainConfigPath)

    if not MiscUtil.isRunningAsExe():
        initialVars['PythonPluginDir'] = _getPluginDirPath()

    Container.bind('VarManager').toSingle(VarManager, initialVars)
    Container.bind('SystemHelper').toSingle(SystemHelper)
    Container.bind('Logger').toSingle(Logger)
    Container.bind('UnityHelper').toSingle(UnityHelper)
    Container.bind('ScriptRunner').toSingle(ScriptRunner)
    Container.bind('PackageManager').toSingle(PackageManager)
    Container.bind('ProcessRunner').toSingle(ProcessRunner)
    Container.bind('JunctionHelper').toSingle(JunctionHelper)
    Container.bind('VisualStudioSolutionGenerator').toSingle(
        VisualStudioSolutionGenerator)
    Container.bind('VisualStudioHelper').toSingle(VisualStudioHelper)
    Container.bind('ProjenyVisualStudioHelper').toSingle(
        ProjenyVisualStudioHelper)
    Container.bind('ProjectSchemaLoader').toSingle(ProjectSchemaLoader)
    Container.bind('CommonSettings').toSingle(CommonSettings)
    Container.bind('UnityPackageExtractor').toSingle(UnityPackageExtractor)
    Container.bind('ZipHelper').toSingle(ZipHelper)
    Container.bind('UnityPackageAnalyzer').toSingle(UnityPackageAnalyzer)
    Container.bind('ProjectConfigChanger').toSingle(ProjectConfigChanger)
    Container.bind('PrjRunner').toSingle(PrjRunner)
    Container.bind('UnityEditorMenuGenerator').toSingle(
        UnityEditorMenuGenerator)

    Container.bind('ReleaseSourceManager').toSingle(ReleaseSourceManager)
Пример #10
0
def installBindings(mainConfigPath):

    assertIsNotNone(mainConfigPath)
    assertThat(os.path.isfile(mainConfigPath))

    projenyDir = _getProjenyDir()
    projenyConfigPath = os.path.join(projenyDir, ConfigFileName)

    # Put the standard config first so it can be over-ridden by user settings
    configPaths = [projenyConfigPath, mainConfigPath]
    configPaths += _getExtraUserConfigPaths()

    Container.bind('Config').toSingle(Config, loadYamlFilesThatExist(*configPaths))

    initialVars = { 'ProjenyDir': projenyDir, }

    initialVars['ConfigDir'] = os.path.dirname(mainConfigPath)

    if not MiscUtil.isRunningAsExe():
        initialVars['PythonPluginDir'] = _getPluginDirPath()

    Container.bind('VarManager').toSingle(VarManager, initialVars)
    Container.bind('SystemHelper').toSingle(SystemHelper)
    Container.bind('Logger').toSingle(Logger)
    Container.bind('UnityHelper').toSingle(UnityHelper)
    Container.bind('ScriptRunner').toSingle(ScriptRunner)
    Container.bind('PackageManager').toSingle(PackageManager)
    Container.bind('ProcessRunner').toSingle(ProcessRunner)
    Container.bind('JunctionHelper').toSingle(JunctionHelper)
    Container.bind('VisualStudioSolutionGenerator').toSingle(VisualStudioSolutionGenerator)
    Container.bind('VisualStudioHelper').toSingle(VisualStudioHelper)
    Container.bind('ProjenyVisualStudioHelper').toSingle(ProjenyVisualStudioHelper)
    Container.bind('ProjectSchemaLoader').toSingle(ProjectSchemaLoader)
    Container.bind('CommonSettings').toSingle(CommonSettings)
    Container.bind('UnityPackageExtractor').toSingle(UnityPackageExtractor)
    Container.bind('ZipHelper').toSingle(ZipHelper)
    Container.bind('UnityPackageAnalyzer').toSingle(UnityPackageAnalyzer)
    Container.bind('ProjectConfigChanger').toSingle(ProjectConfigChanger)
    Container.bind('PrjRunner').toSingle(PrjRunner)

    Container.bind('ReleaseSourceManager').toSingle(ReleaseSourceManager)
Пример #11
0
        installPlugins()

        Container.resolve('PrjRunner').run(args)


if __name__ == '__main__':

    if (sys.version_info < (3, 0)):
        print('Wrong version of python!  Install python 3 and try again')
        sys.exit(2)

    succeeded = True

    try:
        _main()

    except KeyboardInterrupt as e:
        print('Operation aborted by user by hitting CTRL+C')
        succeeded = False

    except Exception as e:
        sys.stderr.write(str(e) + '\n')

        if "-vv" in sys.argv and not MiscUtil.isRunningAsExe():
            sys.stderr.write('\n' + traceback.format_exc())

        succeeded = False

    if not succeeded:
        sys.exit(1)
Пример #12
0
    installBindings(args)

    Runner().run(args)

if __name__ == '__main__':
    if (sys.version_info < (3, 0)):
        print('Wrong version of python!  Install python 3 and try again')
        sys.exit(2)

    succeeded = True

    try:
        _main()

    except KeyboardInterrupt as e:
        print('Operation aborted by user by hitting CTRL+C')
        succeeded = False

    except Exception as e:
        sys.stderr.write(str(e) + '\n')

        if not MiscUtil.isRunningAsExe():
            sys.stderr.write('\n' + traceback.format_exc())

        succeeded = False

    if not succeeded:
        sys.exit(1)


Пример #13
0
        installPlugins()

        Container.resolve('PrjRunner').run(args)

if __name__ == '__main__':

    if (sys.version_info < (3, 0)):
        print('Wrong version of python!  Install python 3 and try again')
        sys.exit(2)

    succeeded = True

    try:
        _main()

    except KeyboardInterrupt as e:
        print('Operation aborted by user by hitting CTRL+C')
        succeeded = False

    except Exception as e:
        sys.stderr.write(str(e) + '\n')

        if "-vv" in sys.argv and not MiscUtil.isRunningAsExe():
            sys.stderr.write('\n' + traceback.format_exc())

        succeeded = False

    if not succeeded:
        sys.exit(1)