当前位置: 首页>>代码示例>>Python>>正文


Python GPS.pwd方法代码示例

本文整理汇总了Python中GPS.pwd方法的典型用法代码示例。如果您正苦于以下问题:Python GPS.pwd方法的具体用法?Python GPS.pwd怎么用?Python GPS.pwd使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在GPS的用法示例。


在下文中一共展示了GPS.pwd方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: internalSpawn

# 需要导入模块: import GPS [as 别名]
# 或者: from GPS import pwd [as 别名]
    def internalSpawn(self, filestr, project, recursive=False):
        if GPS.Preference('General-Auto-Save').get():
            # Force, since otherwise we get a modal dialog while within
            # a GPS action, which gtk+ doesn't like
            modified = GPS.Project.root().is_modified(recursive=True)
            GPS.MDI.save_all(force=True)
            if modified:
                GPS.Project.root().recompute()

        self.full_output = ""
        opts_project = project
        opts = opts_project.get_attribute_as_list(
            "switches", package="check", index="ada")
        if len(opts) == 0:
            opts = opts_project.get_attribute_as_list(
                "default_switches", package="check", index="ada")
        if len(opts) == 0:
            opts_project = GPS.Project.root()
            opts = opts_project.get_attribute_as_list(
                "switches", package="check", index="ada")
        if len(opts) == 0:
            opts = opts_project.get_attribute_as_list(
                "default_switches", package="check", index="ada")

        # We need a rules file if none was specified in the project.
        need_rules_file = True
        if len(opts) != 0:
            for opt in opts:
                res = re.split("^\-from\=(.*)$", opt)
                if len(res) > 1:
                    # we cd to the project's dir before creating the file,
                    # as this will then correctly resolve if the file is
                    # relative to the project's dir
                    olddir = GPS.pwd()
                    GPS.cd(opts_project.file().directory())
                    self.rules_file = GPS.File(res[1])
                    GPS.cd(olddir)
                    need_rules_file = False

        if need_rules_file:
            # Display a dialog, but without using run(), since we are
            # running a GPS action in the task manager and that would
            # crash GPS on some platforms

            selector = rulesSelector(project.name(), self.rules_file)

            def on_response(dialog, response_id):
                if response_id == Gtk.ResponseType.OK:
                    self.rules_file = selector.get_file()
                    dialog.destroy()
                    self.on_spawn(filestr, project, recursive)
                else:
                    dialog.destroy()

            selector.connect('response', on_response)
            selector.show_all()
        else:
            self.on_spawn(filestr, project, recursive)
开发者ID:MichelKramer31,项目名称:gps,代码行数:60,代码来源:gnatcheck.py

示例2: __show_error

# 需要导入模块: import GPS [as 别名]
# 或者: from GPS import pwd [as 别名]
def __show_error(msg, quiet=False):
    """
    Display the error message on stdout, and possibly add the backtrace.
    :param bool quiet: whether to show a traceback
    """
    global exit_status
    exit_status = FAILURE

    if not quiet:
        msg += '\n'
        for s in inspect.stack():
            msg += '\n  at %s:%s:%s' % (s[1], s[2], s[3])
        msg += '\n in directory ' + GPS.pwd()

    GPS.Logger('TESTSUITE').log(msg)
开发者ID:MichelKramer31,项目名称:gps,代码行数:17,代码来源:asserts.py

示例3: status_from_commit

# 需要导入模块: import GPS [as 别名]
# 或者: from GPS import pwd [as 别名]
def status_from_commit (filename):
    file = open(filename)
    lines = file.readlines()
    file.close()

    files=[]
    version=""
    for l in lines:
        if len(l)>18 and l[0:18] == 'Committed revision':
            version=string.split(l)[2].replace('.','')
        elif len(l)>7 and l[0:7]=='Sending':
            files.append(string.split(l)[1])
        elif len(l)>6 and l[0:6]=='Adding':
            files.append(string.split(l)[1])

    status=""
    for f in files:
        line = "          " + version + "    " + version + " nobody " + f + "\n"
        status = status + line

    GPS.VCS.status_parse ("Subversion", status, True, True, GPS.pwd())
开发者ID:flyx,项目名称:gps-osx,代码行数:23,代码来源:subversion.py

示例4: internalSpawn

# 需要导入模块: import GPS [as 别名]
# 或者: from GPS import pwd [as 别名]
    def internalSpawn(self, filestr, project, recursive=False):
        self.full_output = ""
        need_rules_file = False
        opts = project.get_attribute_as_list("default_switches", package="check", index="ada")
        if len(opts) == 0:
            need_rules_file = True
            opts = GPS.Project.root().get_attribute_as_list("default_switches", package="check", index="ada")
            for opt in opts:
                res = re.split("^\-from\=(.*)$", opt)
                if len(res) > 1:
                    # we cd to the root project's dir before creating the file, as
                    # this will then correctly resolve if the file is relative to the
                    # project's dir
                    olddir = GPS.pwd()
                    rootdir = GPS.Project.root().file().directory()
                    GPS.cd(rootdir)
                    self.rules_file = GPS.File(res[1])
                    GPS.cd(olddir)

        if need_rules_file:
            selector = rulesSelector(project.name(), self.rules_file)

            if selector.run() == gtk.RESPONSE_OK:
                self.rules_file = selector.get_file()
                selector.destroy()
            else:
                selector.destroy()
                return

        self.updateGnatCmd()

        if self.gnatCmd == "":
            GPS.Console("Messages").write("Error: could not find gnatcheck")
            return
        # launch gnat check with current project
        cmd = self.gnatCmd + ' check -P """' + project.file().name("Tools_Server") + '"""'
        # also analyse subprojects ?
        if recursive:
            cmd += " -U"
        # define the scenario variables
        scenario = GPS.Project.scenario_variables()
        if scenario != None:
            for i, j in scenario.iteritems():
                cmd += ' """-X' + i + "=" + j + '"""'
        # use progress
        cmd += " -dd"

        # now specify the files to check
        cmd += " " + filestr

        if need_rules_file:
            cmd += ' -rules """-from=' + self.rules_file.name("Tools_Server") + '"""'

        # clear the Checks category in the Locations view
        if GPS.Locations.list_categories().count(self.locations_string) > 0:
            GPS.Locations.remove_category(self.locations_string)

        self.msg = ""
        process = GPS.Process(
            cmd,
            "^.+$",
            on_match=self.on_match,
            on_exit=self.on_exit,
            progress_regexp="^ *completed (\d*) out of (\d*) .*$",
            progress_current=1,
            progress_total=2,
            remote_server="Tools_Server",
            show_command=True,
        )
开发者ID:kjseefried,项目名称:gps-osx,代码行数:71,代码来源:gnatcheck.py


注:本文中的GPS.pwd方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。