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


Python utils.die函数代码示例

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


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

示例1: kdeConfigureInternal

    def kdeConfigureInternal( self, buildType, kdeCustomDefines ):
        """Using cmake"""
        builddir = "%s" % ( self.COMPILER )

        if( not buildType == None ):
            buildtype = "-DCMAKE_BUILD_TYPE=%s" % buildType
            builddir = "%s-%s" % ( builddir, buildType )

        if( not self.buildNameExt == None ):
            builddir = "%s-%s" % ( builddir, self.buildNameExt )

        os.chdir( self.workdir )
        if ( not os.path.exists( builddir) ):
            os.mkdir( builddir )

        if not self.noClean:
            utils.cleanDirectory( builddir )
        os.chdir( builddir )

        command = r"""cmake -G "%s" %s %s %s""" % \
              ( self.cmakeMakefileGenerator, \
                self.kdeDefaultDefines(), \
                kdeCustomDefines, \
                buildtype )

        if utils.verbose() > 0:
            print "configuration command: %s" % command
        if not utils.system(command):
            utils.die( "while CMake'ing. cmd: %s" % command )
        return True
开发者ID:KDE,项目名称:emerge-history,代码行数:30,代码来源:kde_build.py

示例2: __init__

    def __init__(self, *args, **kwargs):
        self.project = kwargs['project']
        if not self.project:
            die('consistency error: each feature must have a related project')

        self.args = []

        # we can keep track of feature args in two ways:
        # - project args parsed from project description file
        #                               -> self.args
        # - fargs argument (used in creation process, retrieved from
        #       comma-separated args)   -> self.cargs
        #
        #   XXX: self.cargs - used by create(),
        #        self.args  - used by everything else

        if self.fid in self.project.args:
            self.args = self.project.args[self.fid]

        if 'fargs' in kwargs and kwargs['fargs'] != None: #and len(kwargs['fargs']) > 0:
            self.cargs = kwargs['fargs']
            self.cargs

        self.project.tree.update(self.tree)

        self.configs = {}

        self.nodeploy = kwargs.get('nodeploy', False)
        if self.nodeploy:
            self.deploy = lambda *args: None
            self.unlink = lambda *args: None
开发者ID:proger,项目名称:project,代码行数:31,代码来源:__init__.py

示例3: msysCompile

    def msysCompile( self, bOutOfSource = True ):
        """run configure and make for Autotools based stuff"""
        config = os.path.join( self.workdir, self.instsrcdir, "configure" )
        build  = os.path.join( self.workdir )
        if( bOutOfSource ):
            # otherwise $srcdir is very long and a conftest may fail (like it's the
            # case in libgmp-4.2.4)
            config = os.path.join( "..", self.instsrcdir, "configure" )
            build  = os.path.join( build, self.instsrcdir + "-build" )
            utils.cleanDirectory( build )
        else:
            build  = os.path.join( build, self.instsrcdir )

        sh = os.path.join( self.msysdir, "bin", "sh.exe" )

        # todo use msysexecute
        cmd = "%s --login -c \"cd %s && %s %s && make -j2" % \
              ( sh, self.__toMSysPath( build ), self.__toMSysPath( config ), \
                self.msysConfigureFlags() )
        if utils.verbose() > 1:
            cmd += " VERBOSE=1"
        cmd += "\""
        if utils.verbose() > 0:
            print "msys compile: %s" % cmd
        if not utils.system(cmd):
            utils.die( "msys compile failed. cmd: %s" % cmd )
        return True
开发者ID:KDE,项目名称:emerge-history,代码行数:27,代码来源:msys_build.py

示例4: _install_app_from_ostree_ref

def _install_app_from_ostree_ref(installation, source_repo_path, ostree_ref, remote_name):
    def _progress_callback(status, progress, estimating, user_data):
        # We rely on the progress status message from flatpak
        # here, no need to worry about the other parameters.
        print("Progress: {}".format(status), end='\r')

    # Install the app from the temporary repository.
    target_ref_parts = ostree_ref.split('/')
    if len(target_ref_parts) < 4:
        die("Could not determine branch of {} app".format(app_id))

    app_id = target_ref_parts[1]
    app_arch = target_ref_parts[2]
    app_branch = target_ref_parts[3]
    logging.debug("App ID: {} / Arch: {} / Branch: {}".format(app_id, app_arch, app_branch))

    try:
        print("Restoring {} app from {}...".format(app_id, source_repo_path))
        installation.install(remote_name,
                             Flatpak.RefKind.APP,
                             app_id, app_arch, app_branch,
                             _progress_callback,
                             None,
                             None)
        print("\nFinished restoring {}".format(app_id))
    except GLib.Error as e:
        die("Could not restore {} app': {}".format(app_id, e.message))
开发者ID:endlessm,项目名称:eos-kalite-system-helper,代码行数:27,代码来源:flatpakutils.py

示例5: __init__

    def __init__( self, **args ):
        self.subinfo = subinfo()
        CMakePackageBase.__init__(self)
        # jom reports missing moc_translator.xxx
        self.subinfo.options.make.supportsMultijob = False
        # add support for other location based on pythonpath
        localPythonPath = os.path.join(self.rootdir, 'emerge', 'python')
        haveLocalPython = os.path.exists(localPythonPath)

        if compiler.isMSVC2008():
            specName = "win32-msvc2008"
        elif compiler.isMSVC2010():
            specName = "win32-msvc2010"
        elif compiler.isMinGW():
            specName = "win32-g++"
        else:
            utils.die("compiler %s not supported for PyQt4" % compiler.COMPILER)
        if haveLocalPython:
           specDir = self.mergeDestinationDir()
        else:
           specDir = self.rootdir

        os.putenv("QMAKESPEC", os.path.join(specDir, "mkspecs", specName))

        if haveLocalPython:
            self.subinfo.options.merge.destinationPath = "emerge/python"
        self.subinfo.options.configure.defines = " --confirm-license --verbose"

        if self.buildType() == "Debug":
            self.subinfo.options.configure.defines += " -u"
开发者ID:matlinuxer2,项目名称:kde-windows-emerge,代码行数:30,代码来源:pyqt-4.8.5.py

示例6: replicate_data

    def replicate_data(self):

        # distros
        self.logger.info("Copying Distros")
        local_distros = self.api.distros()
        try:
            remote_distros = self.remote.get_distros()
        except:
            utils.die(self.logger, "Failed to contact remote server")

        if self.sync_all or self.sync_trees:
            self.logger.info("Rsyncing Distribution Trees")
            self.rsync_it(os.path.join(self.settings.webdir, "ks_mirror"), self.settings.webdir)

        for distro in remote_distros:
            self.logger.info("Importing remote distro %s." % distro["name"])
            if os.path.exists(distro["kernel"]):
                remote_mtime = distro["mtime"]
                if self.should_add_or_replace(distro, "distros"):
                    new_distro = self.api.new_distro()
                    new_distro.from_datastruct(distro)
                    try:
                        self.api.add_distro(new_distro)
                        self.logger.info("Copied distro %s." % distro["name"])
                    except Exception, e:
                        utils.log_exc(self.logger)
                        self.logger.error("Failed to copy distro %s" % distro["name"])
                else:
                    # FIXME: force logic
                    self.logger.info("Not copying distro %s, sufficiently new mtime" % distro["name"])
            else:
                self.logger.error("Failed to copy distro %s, content not here yet." % distro["name"])
开发者ID:imeyer,项目名称:cobbler,代码行数:32,代码来源:action_replicate.py

示例7: run_remote

def run_remote(cmd):
    r = remote.Remote()
    handlers = {
            'set_url': r.set_url,
            'run': r.run,
            'script': r.run_script,
            'sftp': r.sftp,
            'pull': r.pull,
            'push': r.push,
            'rsync': r.rsync,
            'git': r.git,
            'hg': r.hg,
            'upload': r.upload,
            'confirm': local.confirm,
            'call': lambda x: run_command(x, True),
            'echo': lambda x: sys.stdout.write('{0}\n'.format(x)),
            'echo_error': lambda x: sys.stderr.write('{0}\n'.format(x)),
            'set_verbose': r.set_verbose,
            'key': r.key
            }
    for args in cmd:
        c = args[0]
        if c not in handlers:
            # Ignore unsupported commands
            return
        if len(args) > 1:
            args = tuple(args[1:])
            ret = handlers[c](*args)
        else:
            ret = handlers[c]()
        if isinstance(ret, int):
            if ret != 0:
                utils.die('Abort.')
开发者ID:Surgo,项目名称:DotCloudWin,代码行数:33,代码来源:cli.py

示例8: run

    def run(self, cobbler_master=None, distro_patterns=None, profile_patterns=None, system_patterns=None, repo_patterns=None, image_patterns=None, 
            mgmtclass_patterns=None, package_patterns=None, file_patterns=None, prune=False, omit_data=False, sync_all=False, use_ssl=False):
        """
        Get remote profiles and distros and sync them locally
        """

        self.distro_patterns     = distro_patterns.split()
        self.profile_patterns    = profile_patterns.split()
        self.system_patterns     = system_patterns.split()
        self.repo_patterns       = repo_patterns.split()
        self.image_patterns      = image_patterns.split()
        self.mgmtclass_patterns  = mgmtclass_patterns.split()
        self.package_patterns    = package_patterns.split()
        self.file_patterns       = file_patterns.split()
        self.omit_data           = omit_data
        self.prune               = prune
        self.sync_all            = sync_all
        self.use_ssl             = use_ssl

        if self.use_ssl:
            protocol = 'https'
        else:
            protocol = 'http'

        if cobbler_master is not None:
            self.master = cobbler_master
        elif len(self.settings.cobbler_master) > 0:
            self.master = self.settings.cobbler_master
        else:
            utils.die('No cobbler master specified, try --master.')

        self.uri = '%s://%s/cobbler_api' % (protocol,self.master)

        self.logger.info("cobbler_master      = %s" % cobbler_master)
        self.logger.info("distro_patterns     = %s" % self.distro_patterns)
        self.logger.info("profile_patterns    = %s" % self.profile_patterns)
        self.logger.info("system_patterns     = %s" % self.system_patterns)
        self.logger.info("repo_patterns       = %s" % self.repo_patterns)
        self.logger.info("image_patterns      = %s" % self.image_patterns)
        self.logger.info("mgmtclass_patterns  = %s" % self.mgmtclass_patterns)
        self.logger.info("package_patterns    = %s" % self.package_patterns)
        self.logger.info("file_patterns       = %s" % self.file_patterns)
        self.logger.info("omit_data           = %s" % self.omit_data)
        self.logger.info("sync_all            = %s" % self.sync_all)
        self.logger.info("use_ssl             = %s" % self.use_ssl)

        self.logger.info("XMLRPC endpoint: %s" % self.uri)
        self.logger.debug("test ALPHA")
        self.remote = xmlrpclib.Server(self.uri)
        self.logger.debug("test BETA")
        self.remote.ping()
        self.local = xmlrpclib.Server("http://127.0.0.1/cobbler_api")
        self.local.ping()

        self.replicate_data()
        self.link_distros()
        self.logger.info("Syncing")
        self.api.sync(logger=self.logger)
        self.logger.info("Done")
        return True
开发者ID:dyau79,项目名称:cobbler,代码行数:60,代码来源:action_replicate.py

示例9: import_factory

def import_factory(kerneldir,path,cli_breed,logger):
    """
    Given a directory containing a kernel, return an instance of an Importer
    that can be used to complete the import.
    """

    breed , rootdir, pkgdir = guess_breed(kerneldir,path,cli_breed,logger)
    # NOTE : The guess_breed code should be included in the factory, in order to make 
    # the real root directory available, so allowing kernels at different levels within 
    # the same tree (removing the isolinux rejection from distro_adder) -- JP

    if rootdir[1]:
        logger.info("found content (breed=%s) at %s" % (breed,os.path.join( rootdir[0] , rootdir[1])))
    else:
        logger.info("found content (breed=%s) at %s" % (breed,rootdir[0]))
    if cli_breed:
        if cli_breed != breed:
            utils.die(logger, "Requested breed (%s); breed found is %s" % ( cli_breed , breed ) )
        breed = cli_breed

    if breed == "redhat":
        return RedHatImporter(logger,rootdir,pkgdir)
    # disabled for 2.0
    #elif breed == "debian":
    #    return DebianImporter(logger,rootdir,pkgdir)
    #elif breed == "ubuntu":
    #    return UbuntuImporter(logger,rootdir,pkgdir)
    elif breed:
        utils.die(logger, "Unsupported OS breed %s" % breed)
开发者ID:elsonrodriguez,项目名称:madhatter,代码行数:29,代码来源:action_import.py

示例10: make

    def make( self ):
        """implements the make step for cmake projects"""

        self.enterBuildDir()
        utils.prependPath(self.rootdir, self.envPath)

        if self.subinfo.options.cmake.openIDE:
            if compiler.isMSVC2008():
                command = "start %s" % self.__slnFileName()
            elif compiler.isMSVC2010():
                command = "start vcexpress %s" % self.__slnFileName()
        elif self.subinfo.options.cmake.useIDE:
            if compiler.isMSVC2008():
                if self.isTargetBuild():
                    command = "vcbuild /M1 %s \"%s|Windows Mobile 6 Professional SDK (ARMV4I)\"" % (self.__slnFileName(), self.buildType())
                else:
                    command = "vcbuild /M1 %s \"%s|WIN32\"" % (self.__slnFileName(), self.buildType())
            elif compiler.isMSVC2010():
                utils.die("has to be implemented");
        elif self.subinfo.options.cmake.useCTest:
            # first make clean
            self.system( self.makeProgramm + " clean", "make clean" )
            command = "ctest -M " + "Nightly" + " -T Start -T Update -T Configure -T Build -T Submit"
        else:
            command = ' '.join([self.makeProgramm, self.makeOptions()])

        if self.isTargetBuild():
            self.setupTargetToolchain()

        return self.system( command, "make" )
开发者ID:heiko134470,项目名称:Smart-Tree,代码行数:30,代码来源:CMakeBuildSystem.py

示例11: run

    def run(self, path, name, network_root=None, autoinstall_file=None, arch=None, breed=None, os_version=None):
        """
        path: the directory we are scanning for files
        name: the base name of the distro
        network_root: the remote path (nfs/http/ftp) for the distro files
        autoinstall_file: user-specified response file, which will override the default
        arch: user-specified architecture
        breed: user-specified breed
        os_version: user-specified OS version
        """
        self.name = name
        self.network_root = network_root
        self.autoinstall_file = autoinstall_file
        self.arch = arch
        self.breed = breed
        self.os_version = os_version

        self.path = path
        self.rootdir = path
        self.pkgdir = path

        # some fixups for the XMLRPC interface, which does not use "None"
        if self.arch == "":
            self.arch = None

        if self.name == "":
            self.name = None

        if self.autoinstall_file == "":
            self.autoinstall_file = None

        if self.os_version == "":
            self.os_version = None

        if self.network_root == "":
            self.network_root = None

        if self.os_version and not self.breed:
            utils.die(self.logger, "OS version can only be specified when a specific breed is selected")

        self.signature = self.scan_signatures()
        if not self.signature:
            error_msg = "No signature matched in %s" % path
            self.logger.error(error_msg)
            raise CX(error_msg)

        # now walk the filesystem looking for distributions that match certain patterns
        self.logger.info("Adding distros from path %s:" % self.path)
        distros_added = []
        os.path.walk(self.path, self.distro_adder, distros_added)

        if len(distros_added) == 0:
            self.logger.warning("No distros imported, bailing out")
            return

        # find out if we can auto-create any repository records from the install tree
        if self.network_root is None:
            self.logger.info("associating repos")
            # FIXME: this automagic is not possible (yet) without mirroring
            self.repo_finder(distros_added)
开发者ID:sdherr,项目名称:cobbler,代码行数:60,代码来源:manage_import_signatures.py

示例12: install

    def install( self ):
        """Using *make install"""

        with utils.LockFile(utils.LockFileName("MSYS")):
            if self.buildInSource:
                self.enterSourceDir()
            else:
                self.enterBuildDir()

            command = self.makeProgram
            args = "install"

            if self.subinfo.options.install.useDestDir == True:
                args += " DESTDIR=%s prefix=" % self.shell.toNativePath( self.installDir() )

            if self.subinfo.options.make.ignoreErrors:
                args += " -i"

            if self.subinfo.options.make.makeOptions:
                args += " %s" % self.subinfo.options.make.makeOptions
            if self.buildInSource:
                self.shell.execute(self.sourceDir(), command, args) or utils.die( "while installing. cmd: %s %s" % (command, args) )
            else:
                self.shell.execute(self.buildDir(), command, args) or utils.die( "while installing. cmd: %s %s" % (command, args) )
            if os.path.exists(os.path.join(self.imageDir(),"lib")):
                return self.shell.execute(os.path.join(self.imageDir(),"lib"), "rm", " -Rf *.la")
            else:
                return True
开发者ID:heiko134470,项目名称:Smart-Tree,代码行数:28,代码来源:AutoToolsBuildSystem.py

示例13: __init__

	def __init__(self, *args, **kwargs):
		self.init('make', **kwargs)
		self.name = 'yasra'
		if not os.path.exists(os.path.join(self.cwd, 'Makefile')):
			utils.die("couldn't find YASRA Makefile in dir '%s'" % self.cwd)
		self.args += args
		self.run()
开发者ID:cypridina,项目名称:gloTK,代码行数:7,代码来源:wrappers_biolite.py

示例14: configure

    def configure( self, configureDefines="" ):
        """inplements configure step for Qt projects"""

        self.enterBuildDir()

        # here follows some automatic configure tool detection
        # 1. search for configure.exe in the order
        #      a. provided by method call
        #      b. in source directory
        # 2. if qmake is available search for a pro-file named as the package
        # 3. if a pro-file is available through configureOptions, run it with qmake
        # 4. otherwise run qmake without any pro file given
        configTool = os.path.join(self.configureSourceDir(), "configure.exe")
        qmakeTool = os.path.join(self.mergeDestinationDir(), "bin", "qmake.exe")
        topLevelProFilesFound = 0
        topLevelProFile = ""
        for fileListed in os.listdir(self.configureSourceDir()):
            if fileListed.endswith(".pro"):
                if topLevelProFilesFound == 0:
                    topLevelProFile = os.path.join(self.configureSourceDir(), fileListed)
                topLevelProFilesFound += 1
        if self.subinfo.options.configure.tool != None and self.subinfo.options.configure.tool != False:
            command = "%s %s" % (self.subinfo.options.configure.tool, self.configureOptions(configureDefines))
        elif os.path.exists(configTool):
            command = "%s %s" % (configTool, self.configureOptions(configureDefines))
        elif os.path.exists(qmakeTool) and os.path.exists(topLevelProFile) and topLevelProFilesFound == 1:
            command = "qmake -makefile %s %s" % (topLevelProFile, self.configureOptions(configureDefines))
        elif os.path.exists(qmakeTool):
            command = "qmake %s" % self.configureOptions(configureDefines)
        else:
            utils.die("could not find configure.exe or top level pro-file, please take a look into the source and setup the config process.")

        return self.system( command, "configure" )
开发者ID:KDE,项目名称:emerge-history,代码行数:33,代码来源:QMakeBuildSystem.py

示例15: rsync_sync

    def rsync_sync(self, repo):

        """
        Handle copying of rsync:// and rsync-over-ssh repos.
        """

        repo_mirror = repo.mirror

        if not repo.mirror_locally:
            utils.die(self.logger,"rsync:// urls must be mirrored locally, yum cannot access them directly")

        if repo.rpm_list != "" and repo.rpm_list != []:
            self.logger.warning("--rpm-list is not supported for rsync'd repositories")

        # FIXME: don't hardcode
        dest_path = os.path.join(self.settings.webdir+"/repo_mirror", repo.name)

        spacer = ""
        if not repo.mirror.startswith("rsync://") and not repo.mirror.startswith("/"):
            spacer = "-e ssh"
        if not repo.mirror.endswith("/"):
            repo.mirror = "%s/" % repo.mirror

        # FIXME: wrapper for subprocess that logs to logger
        cmd = "rsync -rltDv --copy-unsafe-links --delete-after %s --delete --exclude-from=/etc/cobbler/rsync.exclude %s %s" % (spacer, repo.mirror, dest_path)
        rc = utils.subprocess_call(self.logger, cmd)

        if rc !=0:
            utils.die(self.logger,"cobbler reposync failed")
        os.path.walk(dest_path, self.createrepo_walker, repo)
        self.create_local_file(dest_path, repo)
开发者ID:charlesrg,项目名称:cobbler,代码行数:31,代码来源:action_reposync.py


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