• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python util.cd函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中myppy.util.cd函数的典型用法代码示例。如果您正苦于以下问题:Python cd函数的具体用法?Python cd怎么用?Python cd使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: install

 def install(self):
     updir = self._unpack()
     for nm in os.listdir(updir):
         if nm.endswith(".rpm"):
             fpath = os.path.join(updir, nm)
             with open(fpath+".cpio", "w+") as stdout:
                 self.target.do("rpm2cpio", fpath, stdout=stdout)
                 stdout.seek(0)
                 with cd(self.INSTALL_PREFIX):
                     self.target.do("cpio", "-duvi", stdin=stdout)
     def hackily_define_TIOCSWINSZ(lines):
         for ln in lines:
             yield ln
             if ln.strip().startswith("#define TIOCGWINSZ"):
                 yield "#define TIOCSWINSZ    0x5414\n"
     ioctl_header = os.path.join(self.INSTALL_PREFIX,
                                 "opt/lsb/include/sys/ioctl.h")
     self._patch_file(ioctl_header, hackily_define_TIOCSWINSZ)
     # Check if we can actually compile something
     with tempdir() as workdir:
         with open(os.path.join(workdir, "test.c"), "w") as f:
             f.write("""
                 #include <stdio.h>
                 int main(void) { printf("hello world"); return 0; }
             """)
         with cd(workdir):
             try:
                 self.target.do("lsbcc", "-m32", "-o", "test", "test.c")
                 self.target.do("./test")
             except Exception, e:
                 msg = "Failed to compile a test executable:\n"
                 msg += "    " + str(e) + "\n"
                 msg += "Please make sure you can compile 32-bit "
                 msg += "LSB applications on your system"
                 raise RuntimeError(msg)
开发者ID:benjixx,项目名称:myppy,代码行数:35,代码来源:linux.py


示例2: _generic_cmake

 def _generic_cmake(self,relpath=".",args=[],env={}):
     """Do a generic "cmake" on the given source tarball."""
     archflags = " ".join("-arch "+arch for arch in self.TARGET_ARCHS)
     workdir = self._get_builddir()
     cmd = ["cmake"]
     cmd.append("-DCMAKE_INSTALL_PREFIX=%s" % (self.PREFIX,))
     cmd.append("-DCMAKE_VERBOSE_MAKEFILE=ON")
     cmd.append("-DCMAKE_OSX_SYSROOT="+self.MACOSX_SYSROOT)
     cmd.append("-DCMAKE_OSX_ARCHITECTURES="+";".join(self.TARGET_ARCHS))
     cmd.append("-DBUILD_TESTS=False")
     cmd.append("-DCMAKE_BUILD_TYPE=MinSizeRel")
     for arg in args:
         cmd.append(arg)
     libdir = os.path.join(self.PREFIX,"lib")
     incdir = os.path.join(self.PREFIX,"include")
     env = env.copy()
     env.setdefault("LDFLAGS",self.LDFLAGS)
     env.setdefault("CFLAGS","-Os %s %s -mmacosx-version-min=%s -isysroot %s" % (archflags,self.INCFLAGS,self.MACOSX_DEPLOYMENT_TARGET,self.MACOSX_SYSROOT,))
     env.setdefault("CXXFLAGS","-Os %s %s -mmacosx-version-min=%s -isysroot %s" % (archflags,self.INCFLAGS,self.MACOSX_DEPLOYMENT_TARGET,self.MACOSX_SYSROOT,))
     # Do an out-of-source build, required by some recipes.
     builddir = os.path.join(self._get_builddir(), "MYPPY-BUILD")
     if not os.path.exists(builddir):
         os.makedirs(builddir)
     cmd.append("..")
     with cd(builddir):
         self.target.do(*cmd,env=env)
开发者ID:andolivieri,项目名称:myppy,代码行数:26,代码来源:macosx.py


示例3: build

 def build(self, relpath="", args=[], env={}):
     super(py_m2crypto, self).build()
     workdir = self._get_builddir()
     cmd = [self.target.PYTHON_EXECUTABLE, "setup.py", "build", "build_ext", "--openssl=%s" % self.target.PREFIX]
     cmd.extend(args)
     with cd(os.path.join(workdir, relpath)):
         self.target.do(*cmd, env=env)
开发者ID:cloudmatrix,项目名称:myppy,代码行数:7,代码来源:base.py


示例4: _nway_configure

 def _nway_configure(self,script=None,vars=None,args=None,env={}):
     """Do a "./configure" for each architecure in a separate dir."""
     workdir = self._get_builddir()
     #  Create work dir for each additional arch.
     archdirs = []
     for arch in self.TARGET_ARCHS:
         if arch == self.LOCAL_ARCH:
             archdirs.append((arch,workdir))
         else:
             archdir = os.path.join(os.path.dirname(workdir),arch)
             if os.path.exists(archdir):
                 shutil.rmtree(archdir)
             shutil.copytree(workdir,archdir)
             archdirs.append((arch,archdir))
     #  Now run the appropriate ./configure in each arch dir.
     for (arch,archdir) in archdirs:
         if os.path.exists(os.path.join(archdir,"Makefile")):
             with cd(archdir):
                 try:
                     self.target.do("make","clean")
                 except subprocess.CalledProcessError:
                     pass
         self.TARGET_ARCH = arch
         self.CONFIGURE_DIR = archdir
         self._generic_configure(script,vars,args,env)
     self.TARGET_ARCH = None
开发者ID:crasiak,项目名称:myppy,代码行数:26,代码来源:macosx.py


示例5: _generic_pyinstall

 def _generic_pyinstall(self,relpath="",args=[],env={}):
     """Do a generic "python setup.py install" for this recipe."""
     workdir = self._get_builddir()
     cmd = [self.target.PYTHON_EXECUTABLE,"setup.py","install"]
     cmd.extend(args)
     with cd(os.path.join(workdir,relpath)):
         self.target.do(*cmd,env=env)
开发者ID:mchristopher,项目名称:myppy,代码行数:7,代码来源:base.py


示例6: find_new_files

 def find_new_files(self):
     #  os.walk has a bad habit of choking on unicode errors, so
     #  we do it by hand and get it right.  Anything that can't
     #  be decoded properly gets deleted.
     todo = [self.rootdir]
     while todo:
         dirpath = todo.pop(0)
         try:
             names = os.listdir(dirpath)
         except OSError, e:
             if e.errno not in (errno.ENOENT,):
                 raise
             continue
         if not names:
             if not self._is_oldfile(dirpath + os.sep):
                 yield dirpath + os.sep
         else:
             for nm in names:
                 try:
                     fpath = os.path.join(dirpath,nm)
                 except UnicodeDecodeError:
                     with util.cd(dirpath):
                         if util.isrealdir(nm):
                             shutil.rmtree(nm)
                         else:
                             os.unlink(nm)
                 else:
                     if not self._is_tempfile(fpath):
                         if util.isrealdir(fpath):
                             todo.append(fpath)
                         else:
                             if not self._is_oldfile(fpath):
                                 yield fpath
开发者ID:andolivieri,项目名称:myppy,代码行数:33,代码来源:base.py


示例7: install

 def install(self, relpath="", args=[], env={}):
     workdir = self._get_builddir()
     # link statically with libmysqlclient_r.so
     cmd_conf = [
         self.target.PYTHON_EXECUTABLE,
         "setup.py",
         "setopt",
         "-c",
         "options",
         "-o",
         "static",
         "-s",
         "True",
         "-f",
         "site.cfg",
     ]
     cmd_conf2 = [
         self.target.PYTHON_EXECUTABLE,
         "setup.py",
         "setopt",
         "-c",
         "options",
         "-o",
         "mysql_config",
         "-s",
         os.path.join(self.target.PREFIX, "bin", "mysql_config"),
         "-f",
         "site.cfg",
     ]
     cmd = [self.target.PYTHON_EXECUTABLE, "setup.py", "install_lib"]
     cmd.extend(args)
     with cd(os.path.join(workdir, relpath)):
         self.target.do(*cmd_conf, env=env)
         self.target.do(*cmd_conf2, env=env)
         self.target.do(*cmd, env=env)
开发者ID:cloudmatrix,项目名称:myppy,代码行数:35,代码来源:base.py


示例8: install

 def install(self):
     updir = self._unpack()
     for nm in os.listdir(updir):
         if nm.endswith(".rpm"):
             fpath = os.path.join(updir, nm)
             with open(fpath+".cpio", "w+") as stdout:
                 self.target.do("rpm2cpio", fpath, stdout=stdout)
                 stdout.seek(0)
                 with cd(self.INSTALL_PREFIX):
                     self.target.do("cpio", "-duvi", stdin=stdout)
开发者ID:crasiak,项目名称:myppy,代码行数:10,代码来源:linux.py


示例9: install

 def install(self,relpath="",args=[],env={}):
     workdir = self._get_builddir()
     # link statically with libpg.so
     cmd = [self.target.PYTHON_EXECUTABLE,"setup.py","install_lib"]
     cmd.extend(args)
     with cd(os.path.join(workdir,relpath)):
         f = open('setup.cfg', 'w')
         f.write(self.SETUP_CFG % self.target.PREFIX)
         f.close()
         self.target.do(*cmd,env=env)
开发者ID:mchristopher,项目名称:myppy,代码行数:10,代码来源:base.py


示例10: _generic_cmake

 def _generic_cmake(self, relpath=".", args=[], env={}):
     cmd = ["cmake"]
     cmd.append("-DCMAKE_INSTALL_PREFIX=%s" % (self.INSTALL_PREFIX,))
     cmd.append("-DCMAKE_MODULE_PATH=%s" % (os.path.join(self.PREFIX, "share", "cmake"),))
     cmd.append("-DCMAKE_VERBOSE_MAKEFILE=ON")
     cmd.append("-DBUILD_TESTS=False")
     cmd.append("-DCMAKE_BUILD_TYPE=MinSizeRel")
     for arg in args:
         cmd.append(arg)
     with cd(self._get_builddir()):
         self.target.do(*cmd, env=env)
开发者ID:ronnix,项目名称:myppy,代码行数:11,代码来源:base.py


示例11: _generic_cmake

 def _generic_cmake(self,relpath=".",args=[],env={}):
     cmd = ["cmake"]
     cmd.append("-DCMAKE_INSTALL_PREFIX=%s" % (self.INSTALL_PREFIX,))
     cmd.append("-DCMAKE_MODULE_PATH=%s" % (os.path.join(self.PREFIX,"share","cmake"),))
     cmd.append("-DCMAKE_VERBOSE_MAKEFILE=ON")
     cmd.append("-DBUILD_TESTS=False")
     cmd.append("-DCMAKE_BUILD_TYPE=MinSizeRel")
     for arg in args:
         cmd.append(arg)
     # Do an out-of-source build, required by some recipes.
     builddir = os.path.join(self._get_builddir(), "MYPPY-BUILD")
     os.makedirs(builddir)
     cmd.append("..")
     with cd(builddir):
         self.target.do(*cmd,env=env)
开发者ID:mchristopher,项目名称:myppy,代码行数:15,代码来源:base.py


示例12: build

    def build(self):
        # fetch and upnpack source
        src = self.target.fetch(self.SOURCE_URL)
        self._unpack_tarball(src,self.target.builddir)
        self.workdir = os.path.join(self.target.builddir, 'p4python-2012.1.442152')
        # fetch P4API
        src = self.target.fetch(self.P4API_URL)
        self._unpack_tarball(src,self.workdir)
        p4api_dir = os.path.join(self.workdir, 'p4api-2012.1.442152')

        # Generate the setup.cfg file.
        with cd(self.workdir):
            f = open("setup.cfg", "w")
            f.write("[p4python_config]\n")
            f.write("p4_api=%s" % p4api_dir)
            f.close()
开发者ID:mchristopher,项目名称:myppy,代码行数:16,代码来源:base.py


示例13: install

 def install(self):
     updir = self._unpack()
     for nm in os.listdir(updir):
         if nm.endswith(".rpm"):
             fpath = os.path.join(updir, nm)
             with open(fpath+".cpio", "w+") as stdout:
                 self.target.do("rpm2cpio", fpath, stdout=stdout)
                 stdout.seek(0)
                 with cd(self.INSTALL_PREFIX):
                     self.target.do("cpio", "-duvi", stdin=stdout)
     def hackily_define_TIOCSWINSZ(lines):
         for ln in lines:
             yield ln
             if ln.strip().startswith("#define TIOCGWINSZ"):
                 yield "#define TIOCSWINSZ    0x5414\n"
     ioctl_header = os.path.join(self.INSTALL_PREFIX,
                                 "opt/lsb/include/sys/ioctl.h")
     self._patch_file(ioctl_header, hackily_define_TIOCSWINSZ)
开发者ID:andolivieri,项目名称:myppy,代码行数:18,代码来源:linux.py


示例14: _generic_configure

 def _generic_configure(self,script=None,vars=None,args=None,env={}):
     """Do a generic "./configure" for this recipe."""
     if script is None:
         script = self.CONFIGURE_SCRIPT
     if vars is None:
         vars = self.CONFIGURE_VARS
     if args is None:
         args = self.CONFIGURE_ARGS
     if isinstance(script,basestring):
         cmd = [script]
     else:
         cmd = list(script)
     cmd.append("--prefix=%s" % (self.INSTALL_PREFIX,))
     for arg in args:
         cmd.append(arg)
     if vars is not None:
         for var in vars:
             cmd.append(var)
     workdir = self._get_builddir()
     workdir = os.path.join(workdir,self.CONFIGURE_DIR)
     with cd(workdir):
         self.target.do(*cmd,env=env)
开发者ID:mchristopher,项目名称:myppy,代码行数:22,代码来源:base.py


示例15: _patch

 def _patch(self):
     workdir = self._get_builddir()
     patchfile = os.path.join(os.path.dirname(__file__),"_py2app.patch")
     with open(patchfile,"rb") as fin:
         with cd(os.path.join(workdir,"py2app")):
             self.target.do("patch",stdin=fin)
开发者ID:crasiak,项目名称:myppy,代码行数:6,代码来源:macosx.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python httpretty.register_uri函数代码示例发布时间:2022-05-27
下一篇:
Python mypdb.set_trace函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap