當前位置: 首頁>>代碼示例>>Python>>正文


Python command.Command類代碼示例

本文整理匯總了Python中rpg.command.Command的典型用法代碼示例。如果您正苦於以下問題:Python Command類的具體用法?Python Command怎麽用?Python Command使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了Command類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: copy_dir

    def copy_dir(self, path, ex_dir):
        """ Copies directory tree and adds command to
            prep macro """

        prep = Command("cp -rf " + path + " " + ex_dir)
        prep.execute()
        self.prep.append(str(prep))
開發者ID:Shootervm,項目名稱:rpg,代碼行數:7,代碼來源:source_loader.py

示例2: patched

 def patched(self, project_dir, spec, sack):
     """ Finds dependencies via makedepend - This is not garanteed to be
         all of them. Makedepend uses macro preprocessor and if it throws
         and error makedepend didn't print deps. """
     out = Command([
         "find " + path_to_str(project_dir) + " -name " +
         " -o -name ".join(
             ["'*." + ex + "'" for ex in self.EXT_CPP]
         )
     ]).execute()
     cc_makedep = ""
     cc_included_files = []
     for _f in out.splitlines():
         try:
             cc_makedep = Command("makedepend -w 1000 " + str(_f) +
                                  " -f- 2>/dev/null").execute()
         except CalledProcessError as e:
             logging.warn(str(e.cmd) + "\n" + str(e.output))
             continue
         cc_included_files += [
             s for s in cc_makedep.split()
             if (s.startswith("/usr") or s.startswith("/include"))
             and str(project_dir) not in s]
     spec.required_files.update(cc_included_files)
     spec.build_required_files.update(cc_included_files)
開發者ID:PavolVican,項目名稱:rpg,代碼行數:25,代碼來源:c.py

示例3: test_command_concat

 def test_command_concat(self):
     cmd = Command("cd %s" % self.test_project_dir)
     cmd.append("cmake ..")
     cmd.append(["make", "make test"])
     self.assertRaises(TypeError, cmd.append, 4)
     expected = "cd %s\ncmake ..\nmake\nmake test" % self.test_project_dir
     self.assertEqual(expected, str(cmd))
開發者ID:regeciovad,項目名稱:rpg,代碼行數:7,代碼來源:test_command.py

示例4: patched

    def patched(self, project_dir, spec, sack):
        f = NamedTemporaryFile(delete=False, prefix="rpg_plugin_c_")
        file_name = f.name
        f.close()

        out = Command(["find " + str(project_dir)
                       + " -name *.c -o -name *.h"]).execute()

        files_list = [str(s) for s in out.splitlines()]

        makedepend = "makedepend -w10000 -f" + file_name + " -I" \
                     + str(project_dir) + " " + \
                     ' '.join(files_list) + " 2>/dev/null"
        Command(makedepend).execute()

        regex = compile(r'.*\.h')
        regex2 = compile(str(project_dir) + ".*")
        unlink(file_name + ".bak")
        with open(file_name, "r") as f:
            _ret_paths = set([path.dirname(s) for s in f.read().split()
                              if regex.match(s) and not regex2.match(s)])
        unlink(file_name)

        spec.required_files = spec.required_files.union(_ret_paths)
        spec.build_required_files = spec.build_required_files.union(_ret_paths)
開發者ID:FLuptak,項目名稱:rpg,代碼行數:25,代碼來源:c.py

示例5: create_archive

 def create_archive(self):
     """ Creates archive (archvie_path) from Source folder """
     self.spec.Source = self.spec.Name + "-" + self.spec.Version + ".tar.gz"
     _tar = Command("tar zcf " + str(self.archive_path) +
                    " -C " + str(self.extracted_dir) +
                    " . --transform='s/^\./" +
                    self.spec.Name + "-" + self.spec.Version + "/g'")
     _tar.execute()
     logging.debug(str(_tar))
開發者ID:FLuptak,項目名稱:rpg,代碼行數:9,代碼來源:__init__.py

示例6: patched

 def patched(self, project_dir, spec, sack):
     if (project_dir / "CMakeLists.txt").is_file():
         logging.debug('CMakeLists.txt found')
         build = Command()
         build.append_cmdlines("cmake " + str(project_dir))
         build.append_cmdlines("make")
         install = Command("make install DESTDIR=$RPM_BUILD_ROOT")
         spec.scripts["%build"] = build
         spec.scripts["%install"] = install
開發者ID:khuno,項目名稱:rpg,代碼行數:9,代碼來源:cmake.py

示例7: build_srpm

 def build_srpm(spec_file, tarball, output_dir):
     """ Builds source rpm from spec and tarball and moves it to the
         output directory """
     Command("rpmdev-setuptree").execute()
     Command("cp " + path_to_str(tarball) +
             ' $(rpm --eval "%{_topdir}")/SOURCES').execute()
     output = Command("rpmbuild -bs " + path_to_str(spec_file)).execute()
     Command("mv " + path_to_str(output.split()[-1]) +
             " " + path_to_str(output_dir)).execute()
開發者ID:LukasSlouka,項目名稱:rpg,代碼行數:9,代碼來源:package_builder.py

示例8: build_srpm

    def build_srpm(spec_file, tarball, output_dir):
        """builds RPM package with build_srpm and build_rpm"""

        # Build srpm pakcage from given spec_file and tarball
        Command("rpmdev-setuptree").execute()
        Command("cp " + path_to_str(tarball) +
                ' $(rpm --eval "%{_topdir}")/SOURCES').execute()
        output = Command("rpmbuild -bs " + path_to_str(spec_file)).execute()
        Command("mv " + path_to_str(output.split()[-1]) +
                " " + path_to_str(output_dir)).execute()
開發者ID:pan0007,項目名稱:test,代碼行數:10,代碼來源:package_builder.py

示例9: patched

 def patched(self, project_dir, spec, sack):
     if (project_dir / "CMakeLists.txt").is_file():
         spec.BuildRequires.add("cmake")
         logging.debug('CMakeLists.txt found')
         build = Command()
         build.append("cmake .")
         build.append("make")
         install = Command("make install DESTDIR=$RPM_BUILD_ROOT")
         spec.build = build
         spec.install = install
開發者ID:FLuptak,項目名稱:rpg,代碼行數:10,代碼來源:cmake.py

示例10: patched

 def patched(self, project_dir, spec, sack):
     """ Appends commands to build project with Autotools build system
         and appends dependencies """
     if (project_dir / "configure").is_file():
         logging.debug('configure found')
         spec.build.append(["%{configure}", "%{make_build}"])
         spec.install.append(['make install DESTDIR="$RPM_BUILD_ROOT"'])
     elif ((project_dir / "configure.ac").is_file() and
           (project_dir / "Makefile.am").is_file()):
         logging.debug('configure.ac and Makefile.am found')
         spec.BuildRequires.update(["autoconf", "automake", "libtool"])
         build = Command()
         if (project_dir / "autogen.sh").is_file():
             logging.debug('autogen.sh found')
             build.append("./autogen.sh")
         else:
             build.append("autoreconf --install --force")
         build.append("%{configure}")
         build.append("%{make_build}")
         spec.build = build
         spec.install = Command("make install DESTDIR=\"$RPM_BUILD_ROOT\"")
     elif (project_dir / "configure.ac").is_file():
         logging.warning('configure.ac found, Makefile.am missing')
     elif (project_dir / "Makefile.am").is_file():
         logging.warning('Makefile.am found, configure.ac missing')
開發者ID:LukasSlouka,項目名稱:rpg,代碼行數:25,代碼來源:autotools.py

示例11: patched

 def patched(self, project_dir, spec, sack):
     """ Appends commands to build Project with CMake build system """
     if (project_dir / "CMakeLists.txt").is_file():
         spec.BuildRequires.add("cmake")
         logging.debug("CMakeLists.txt found")
         build = Command()
         build.append("cmake .")
         build.append("%{make_build}")
         install = Command('make install DESTDIR="$RPM_BUILD_ROOT"')
         _parse(project_dir, spec)
         spec.build = build
         spec.install = install
開發者ID:jsilhan,項目名稱:rpg,代碼行數:12,代碼來源:cmake.py

示例12: test_command_execute_from

    def test_command_execute_from(self):
        cmd = Command("pwd\ncd c\npwd")
        output = cmd.execute_from(self.test_project_dir)
        path = self.test_project_dir.resolve()
        expected = "%s\n%s/c\n" % (path, path)
        self.assertEqual(expected, output)

        # doesn't add 'cd work_dir' during execute to command lines
        cur_dir = Path('.')
        with self.assertRaises(subprocess.CalledProcessError) as ctx:
            cmd.execute_from(cur_dir)
        expected = "Command '['/bin/sh', '-c', 'cd %s && pwd && cd c && pwd" \
            "']' returned non-zero exit status 1" % cur_dir.resolve()
        self.assertEqual(expected, str(ctx.exception))
開發者ID:khuno,項目名稱:rpg,代碼行數:14,代碼來源:test_command.py

示例13: patched

 def patched(self, project_dir, spec, sack):
     if (project_dir / "pom.xml").is_file():
         logging.debug('pom.xml found')
         spec.BuildRequires.add("maven-local")
         spec.build = Command('%mvn_build -f')
         install = Command()
         install.append('xmvn-install -R .xmvn-reactor -n ' +
                        spec.Name + ' -d "$RPM_BUILD_ROOT"')
         install.append('jdir=target/site/apidocs; [ -d .xmvn/apidocs ] '
                        '&& jdir=.xmvn/apidocs; '
                        'if [ -d "${jdir}" ]; then '
                        'install -dm755 "$RPM_BUILD_ROOT"/usr/share/'
                        'javadoc/' + spec.Name + '; '
                        'cp -pr "${jdir}"/* "$RPM_BUILD_ROOT"/usr/share/'
                        'javadoc/' + spec.Name + '; '
                        'echo \'/usr/share/javadoc/' + spec.Name +
                        '\' >>.mfiles-javadoc; fi')
         spec.install = install
開發者ID:timhughes,項目名稱:rpg,代碼行數:18,代碼來源:maven.py

示例14: patched

 def patched(self, project_dir, spec, sack):
     out = Command([
         "find " + path_to_str(project_dir) + " -name " +
         " -o -name ".join(
             ["'*." + ex + "'" for ex in self.EXT_CPP]
         )
     ]).execute()
     cc_makedep = ""
     cc_included_files = []
     for _f in out.splitlines():
         try:
             cc_makedep = Command("makedepend -w 1000 " + str(_f) +
                                  " -f- 2>/dev/null").execute()
         except CalledProcessError as e:
             logging.warn(str(e.cmd) + "\n" + str(e.output))
             continue
         cc_included_files += [
             s for s in cc_makedep.split()
             if (s.startswith("/usr") or s.startswith("/include"))
             and str(project_dir) not in s]
     spec.required_files.update(cc_included_files)
     spec.build_required_files.update(cc_included_files)
開發者ID:pan0007,項目名稱:test,代碼行數:22,代碼來源:c.py

示例15: __init__

 def __init__(self):
     self.prep = Command()
開發者ID:Shootervm,項目名稱:rpg,代碼行數:2,代碼來源:source_loader.py


注:本文中的rpg.command.Command類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。