コード例 #1
0
    def app(self):
        """
        Gets the application path from the site configuration.

        If the path is not configured, attempts to guess the path
        from the sytem path environment variable.
        """

        try:
            app_path = getattr(self.settings, 'app')
        except AttributeError:
            app_path = self.executable_name

        # Honour the PATH environment variable.
        if app_path is not None and not os.path.isabs(app_path):
            app_path = discover_executable(app_path, self.site.sitepath)

        if app_path is None:
            raise HydeException(self.executable_not_found_message)
        app = File(app_path)

        if not app.exists:
            raise HydeException(self.executable_not_found_message)

        return app
コード例 #2
0
ファイル: plugin.py プロジェクト: jperry/hyde
    def app(self):
        """
        Gets the application path from the site configuration.

        If the path is not configured, attempts to guess the path
        from the sytem path environment variable.
        """

        try:
            app_path = getattr(self.settings, 'app')
        except AttributeError:
            app_path = self.executable_name

        # Honour the PATH environment variable.
        if app_path is not None and not os.path.isabs(app_path):
            app_path = discover_executable(app_path, self.site.sitepath)

        if app_path is None:
            raise self.template.exception_class(
                    self.executable_not_found_message)

        app = File(app_path)

        if not app.exists:
            raise self.template.exception_class(
                    self.executable_not_found_message)

        return app