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


Python EmergeDebug类代码示例

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

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

示例1: unpack

 def unpack(self):
     EmergeDebug.trace("MultiSource unpack", 2)
     # pylint: disable=E1101
     # multiple inheritance: MultiSource is never the only
     # superclass, others define self.buildSystemType.
     self.source.buildSystemType = self.buildSystemType
     return self.source.unpack()
开发者ID:TheOneRing,项目名称:emerge,代码行数:7,代码来源:MultiSource.py


示例2: buildDir

 def buildDir(self):
     EmergeDebug.debug("EmergeBase.buildDir() called", 2)
     builddir = os.path.join(self.workDir(), self.workDirPattern())
     if self.subinfo.options.unpack.unpackIntoBuildDir and self.subinfo.hasTargetSourcePath():
         builddir = os.path.join(builddir, self.subinfo.targetSourcePath())
     EmergeDebug.debug("package builddir is: %s" % builddir, 2)
     return self.__adjustPath(builddir)
开发者ID:TheOneRing,项目名称:emerge,代码行数:7,代码来源:EmergeBase.py


示例3: cleanImage

 def cleanImage( self ):
     """cleanup before install to imagedir"""
     if ( os.path.exists( self.imageDir() ) ):
         EmergeDebug.debug("cleaning image dir: %s" % self.imageDir(), 1)
         utils.cleanDirectory( self.imageDir() )
         os.rmdir(self.imageDir())
     return True
开发者ID:pgquiles,项目名称:kdewindows-emerge,代码行数:7,代码来源:PackageBase.py


示例4: __getImageDirectories

    def __getImageDirectories( self ):
        """ return the image directories where the files are stored """
        imageDirs = []
        runtimeDependencies = portage.getDependencies(self.category, self.package)

        depList = []
        for ( category, package, _, _ ) in runtimeDependencies:
            # we only want runtime dependencies since we want to build a binary installer
            portage.solveDependencies(category, package, depList = depList,
                                      depType = DependencyType.Runtime, ignoredPackages = self.ignoredPackages)
        depList.reverse()

        # make sure current package is added to the list, too
        if not self.package.endswith("-package"):
            depList.append(DependencyPackage(self.category, self.package))

        for x in depList:
            if portage.PortageInstance.isVirtualPackage(x.category, x.package):
                EmergeDebug.debug("Ignoring package b/c it is virtual: %s/%s" % (x.category, x.package))
                continue

            _package = portage.getPackageInstance( x.category, x.package )

            imageDirs.append(( os.path.join( self.rootdir, "build", x.category, x.package,
                    self.__imageDirPattern( _package, _package.buildTarget )), _package.subinfo.options.merge.destinationPath , _package.subinfo.options.package.disableStriping ) )
            # this loop collects the files from all image directories
            EmergeDebug.debug("__getImageDirectories: category: %s, package: %s, version: %s, defaultTarget: %s" % (_package.category, x.package, _package.version, _package.buildTarget), 2)

        if emergeSettings.getboolean("QtSDK", "Enabled", "false"):
            imageDirs.append((os.path.join( emergeSettings.get("QtSDK", "Path") , emergeSettings.get("QtSDK", "Version"), emergeSettings.get("QtSDK", "Compiler")), None, False))

        return imageDirs
开发者ID:pgquiles,项目名称:kdewindows-emerge,代码行数:32,代码来源:CollectionPackagerBase.py


示例5: __init__

 def __init__(self):
     EmergeDebug.debug("SetupPackageBase.__init__ called", 2)
     PackageBase.__init__(self)
     MultiSource.__init__(self)
     BuildSystemBase.__init__(self)
     PackagerBase.__init__(self)
     self.subinfo.options.unpack.runInstaller = True
开发者ID:TheOneRing,项目名称:emerge,代码行数:7,代码来源:SetupPackageBase.py


示例6: renameDir

def renameDir(src, dest):
    """ rename a directory """
    EmergeDebug.debug("rename directory from %s to %s" % (src, dest), 2)
    if os.rename( src, dest ) == 0:
        return False
    else:
        return True
开发者ID:TheOneRing,项目名称:emerge,代码行数:7,代码来源:utils.py


示例7: getFile

def getFile( url, destdir , filename='' ):
    """download file from 'url' into 'destdir'"""
    EmergeDebug.debug("getFile called. url: %s" % url, 1)
    if url == "":
        EmergeDebug.error("fetch: no url given")
        return False

    if UtilsCache.findApplication("wget"):
        return wgetFile( url, destdir , filename )


    if not filename:
        _, _, path, _, _, _ = urllib.parse.urlparse( url )
        filename = os.path.basename( path )

    if os.path.exists(os.path.join( destdir, filename )):
        return True

    width, _ =  shutil.get_terminal_size((80,20))
    def dlProgress(count, blockSize, totalSize):
        percent = int(count * blockSize * 100 / totalSize)
        times = int((width - 20)/100 * percent)
        sys.stdout.write(("\r%s%3d%%" % ("#" * times, percent)))
        sys.stdout.flush()

    urllib.request.urlretrieve(url, filename =  os.path.join( destdir, filename ), reporthook= dlProgress if EmergeDebug.verbose() >= 0 else None )

    if EmergeDebug.verbose()>=0:
        sys.stdout.write("\n")
        sys.stdout.flush()
    return True
开发者ID:pgquiles,项目名称:kdewindows-emerge,代码行数:31,代码来源:utils.py


示例8: __makeFileGenerator

 def __makeFileGenerator(self):
     """return cmake related make file generator"""
     if self.supportsNinja and emergeSettings.getboolean("Compile","UseNinja", False):
         return "Ninja"
     if compiler.isMSVC2015():
         if self.subinfo.options.cmake.useIDE or self.subinfo.options.cmake.openIDE:
             return "Visual Studio 14 2015" + " Win64" if compiler.isX64() else ""
         else:
             return "NMake Makefiles"
     if compiler.isMSVC2010():
         if self.subinfo.options.cmake.useIDE or self.subinfo.options.cmake.openIDE:
             return "Visual Studio 10"
         else:
             return "NMake Makefiles"
     elif compiler.isMSVC2008():
         if self.subinfo.options.cmake.useIDE or self.subinfo.options.cmake.openIDE:
             return "Visual Studio 9 2008"
         else:
             return "NMake Makefiles"
     elif compiler.isMSVC() or compiler.isIntel():
         return "NMake Makefiles"
     elif compiler.isMinGW():
         return "MinGW Makefiles"
     else:
         EmergeDebug.die("unknown %s compiler" % self.compiler())
开发者ID:pgquiles,项目名称:kdewindows-emerge,代码行数:25,代码来源:CMakeBuildSystem.py


示例9: _fixCmakeImageDir

 def _fixCmakeImageDir(self, imagedir, rootdir ):
     """
     when using DESTDIR=foo under windows, it does not _replace_
     CMAKE_INSTALL_PREFIX with it, but prepends destdir to it.
     so when we want to be able to install imagedir into KDEROOT,
     we have to move things around...
     """
     EmergeDebug.debug("fixImageDir: %s %s" % (imagedir, rootdir), 1)
     # imagedir = e:\foo\thirdroot\tmp\dbus-0\image
     # rootdir  = e:\foo\thirdroot
     # files are installed to
     # e:\foo\thirdroot\tmp\dbus-0\image\foo\thirdroot
     _, rootpath = os.path.splitdrive( rootdir )
     #print "rp:", rootpath
     if ( rootpath.startswith( os.path.sep ) ):
         rootpath = rootpath[1:]
     # CMAKE_INSTALL_PREFIX = X:\
     # -> files are installed to
     # x:\build\foo\dbus\image\
     # --> all fine in this case
     #print("rp:", rootpath)
     if len(rootpath) == 0:
         return
     
     tmp = os.path.join( imagedir, rootpath )
     EmergeDebug.debug("tmp: %s" % tmp, 1)
     tmpdir = os.path.join( imagedir, "tMpDiR" )
     if ( not os.path.isdir( tmpdir ) ):
         os.mkdir( tmpdir )
     utils.moveEntries( tmp, tmpdir )
     os.chdir( imagedir )
     os.removedirs( rootpath )
     utils.moveEntries( tmpdir, imagedir )
     utils.cleanDirectory( tmpdir )
     os.rmdir( tmpdir )
开发者ID:pgquiles,项目名称:kdewindows-emerge,代码行数:35,代码来源:CMakeBuildSystem.py


示例10: getPackagesCategories

def getPackagesCategories(packageName, defaultCategory = None):
    EmergeDebug.trace("getPackagesCategories for package name %s" % packageName)
    if defaultCategory is None:
        defaultCategory = emergeSettings.get("General","EMERGE_DEFAULTCATEGORY","kde")

    packageList, categoryList = [], []
    if len( packageName.split( "/" ) ) == 1:
        if PortageInstance.isCategory( packageName ):
            EmergeDebug.debug("isCategory=True", 2)
            packageList = PortageInstance.getAllPackages( packageName )
            categoryList = [ packageName ] * len(packageList)
        else:
            EmergeDebug.debug("isCategory=False", 2)
            if PortageInstance.isCategory( defaultCategory ) and PortageInstance.isPackage( defaultCategory, packageName ):
                # prefer the default category
                packageList = [ packageName ]
                categoryList = [ defaultCategory ]
            else:
                if PortageInstance.getCategory( packageName ):
                    packageList = [ packageName ]
                    categoryList = [ PortageInstance.getCategory( packageName ) ]
    elif len( packageName.split( "/" ) ) == 2:
        [ cat, pac ] = packageName.split( "/" )
        if PortageInstance.isCategory( cat ):
            categoryList = [ cat ]
        else:
            return packageList, categoryList
        if len( categoryList ) > 0 and PortageInstance.isPackage( categoryList[0], pac ):
            packageList = [ pac ]
        if len( categoryList ) and len( packageList ):
            EmergeDebug.debug("added package %s/%s" % (categoryList[0], pac), 2)
    else:
        EmergeDebug.error("unknown packageName")

    return packageList, categoryList
开发者ID:pgquiles,项目名称:kdewindows-emerge,代码行数:35,代码来源:portage.py


示例11: 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():
                command = "vcbuild /M1 %s \"%s|WIN32\"" % (self.__slnFileName(), self.buildType())
            elif compiler.isMSVC2015():
                command = "msbuild /maxcpucount %s /t:ALL_BUILD /p:Configuration=\"%s\"" % (self.__slnFileName(), self.buildType())
            elif compiler.isMSVC2010():
                EmergeDebug.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()])


        return self.system( command, "make" )
开发者ID:pgquiles,项目名称:kdewindows-emerge,代码行数:27,代码来源:CMakeBuildSystem.py


示例12: getDependencies

def getDependencies( category, package, runtimeOnly = False ):
    """returns the dependencies of this package as list of strings:
    category/package"""

    subpackage, package = getSubPackage( category, package )
    if subpackage:
        EmergeDebug.debug("solving package %s/%s/%s %s" % (category, subpackage, package,
                                                           getFilename( category, package )))
    else:
        EmergeDebug.debug("solving package %s/%s %s" % (category, package, getFilename(category, package)))
        subpackage = package

    deps = []
    for pkg in [ subpackage ]:
        info = _getSubinfo(category, pkg)
        if not info is None:
            depDict = info.dependencies
            depDict.update( info.runtimeDependencies )
            if not runtimeOnly:
                depDict.update( info.buildDependencies )

            for line in list(depDict.keys()):
                (category, package) = line.split( "/" )
                version = PortageInstance.getNewestVersion( category, package )
                deps.append( [ category, package, version, depDict[ line ] ] )
    return deps
开发者ID:pgquiles,项目名称:kdewindows-emerge,代码行数:26,代码来源:portage.py


示例13: getPackageInstance

 def getPackageInstance(self, category, package):
     """return instance of class Package from package file"""
     fileName =  getFilename( category, package )
     pack = None
     mod = None
     if fileName.endswith(".py") and os.path.isfile(fileName):
         if not fileName in self._packageDict:
             EmergeDebug.debug("module to import: %s" % fileName, 2)
             if not os.path.isfile( fileName ):
                 try:
                     mod = builtins.__import__( fileName )
                 except ImportError as e:
                     EmergeDebug.warning('import failed for module %s: %s' % (fileName, str(e)))
                     mod =  None
             else:
                 modulename = os.path.basename( fileName )[:-3].replace('.', '_')
                 loader = importlib.machinery.SourceFileLoader(modulename, fileName)
                 try:
                     mod = loader.load_module()
                 except Exception as e:
                     raise PortageException("Failed to load file %s" % fileName, category, package, e)
             if not mod is None:
                 subpackage, package = getSubPackage( category, package )
                 self._CURRENT_MODULE  = ( fileName, category,subpackage, package, mod )
                 pack = mod.Package( )
                 self._packageDict[ fileName ] = pack
             else:
                 raise PortageException("Failed to find package", category, package)
         else:
             pack = self._packageDict[ fileName ]
         return pack
开发者ID:pgquiles,项目名称:kdewindows-emerge,代码行数:31,代码来源:portage.py


示例14: fetch

    def fetch( self, repopath=None ):
        """try to clone or update the repository"""
        EmergeDebug.trace("HgSource.fetch called", 2)

        # get the path where the repositories should be stored to
        if repopath == None:
            repopath = self.repositoryUrl()

        # in case you need to move from a read only Url to a writeable one, here it gets replaced
#        repoString = utils.replaceVCSUrl( repopath )
        repopath = repopath.replace("[hg]", "")
        repoUrl, repoBranch, _ = utils.splitVCSUrl( repopath )
        ret = True

        # only run if wanted (e.g. no --offline is given on the commandline) or no hg support is given by the python installation
        if ( not self.noFetch and self.enableHg ):
            # question whether mercurial stuff uses these proxies
            self.setProxy()
            checkoutDir = self.checkoutDir()

            # check corrupted checkout dir
            if os.path.exists( checkoutDir ) and not os.path.exists( checkoutDir + "\.hg" ):
                os.rmdir( checkoutDir )
            
            if not os.path.exists( checkoutDir ):
                os.makedirs( checkoutDir )
                os.chdir( checkoutDir )
                ret = self.system( "%s clone %s ." % ( self.hgExecutable, repoUrl ) ) # TODO: check return code for success
            
            if os.path.exists( checkoutDir ):
                os.chdir( checkoutDir )
                ret = self.system( "%s update %s" % ( self.hgExecutable, repoBranch ) ) # TODO: check return code for success
        else:
            EmergeDebug.debug("skipping hg fetch (--offline)")
        return ret
开发者ID:TheOneRing,项目名称:emerge,代码行数:35,代码来源:HgSource.py


示例15: SourceFactory

def SourceFactory(settings):
    """ return sourceBase derived instance for recent settings"""
    EmergeDebug.trace("SourceFactory called", 1)
    source = None

    if settings.hasTarget():
        if settings.hasMultipleTargets():
            url = settings.targetAt(0)
        else:
            url = settings.target()
        source = ArchiveSource(settings)

    ## \todo move settings access into info class
    if settings.hasSvnTarget():
        url = settings.svnTarget()
        sourceType = utils.getVCSType( url )
        if sourceType == "svn":
            source = SvnSource(settings)
        elif sourceType == "hg":
            source = HgSource(settings)
        elif sourceType == "git":
            source = GitSource(settings)

    if source == None:
        EmergeDebug.die("none or unsupported source system set")
    if not source.subinfo:
        source.subinfo = settings
    source.url = url
    return source
开发者ID:TheOneRing,项目名称:emerge,代码行数:29,代码来源:SourceFactory.py


示例16: _defaulVersions

    def _defaulVersions( self ):
        if self.__defaulVersions is None:
            name = self.subinfo.parent.filename
            if name in VersionInfo._VERSION_INFOS_HINTS:
                if VersionInfo._VERSION_INFOS_HINTS[ name ] == None:
                    return None
                else:
                    #utils.debug("Using cached version info for %s in %s" % (name, _VERSION_INFOS_HINTS[ name ]))
                    return VersionInfo._VERSION_INFOS[ VersionInfo._VERSION_INFOS_HINTS[ name ] ]
            root = os.path.dirname( name )

            if self._fileName is None:
                possibleInis= [ os.path.join( root, "version.ini" ), os.path.join( root, "..", "version.ini" ),
                         os.path.join( root, "..", "..", "version.ini" ) ]
            else:
                possibleInis = [self._fileName]

            for iniPath in possibleInis:
                iniPath = os.path.abspath( iniPath )
                if iniPath in VersionInfo._VERSION_INFOS.keys( ):
                    VersionInfo._VERSION_INFOS_HINTS[ name ] = iniPath
                    EmergeDebug.debug("Found a version info for %s in cache" % name, 2)
                    return VersionInfo._VERSION_INFOS[ iniPath ]
                elif os.path.exists( iniPath ):
                    config = configparser.ConfigParser( )
                    config.read( iniPath )
                    VersionInfo._VERSION_INFOS[ iniPath ] = config
                    VersionInfo._VERSION_INFOS_HINTS[ name ] = iniPath
                    EmergeDebug.debug("Found a version info for %s in %s" % (name, iniPath), 2)
                    return config
            VersionInfo._VERSION_INFOS_HINTS[ name ] = None
        return self.__defaulVersions
开发者ID:TheOneRing,项目名称:emerge,代码行数:32,代码来源:VersionInfo.py


示例17: getHttpFile

def getHttpFile( host, path, destdir, filename ):
    """download file from a http host specified by 'host' and 'path' into 'destdir' using 'filename' as file name"""
    # FIXME check return values here (implement useful error handling)...
    EmergeDebug.debug("getHttpFile called. %s %s" % (host, path), 1)

    conn = http.client.HTTPConnection( host )
    conn.request( "GET", path )
    r1 = conn.getresponse()
    EmergeDebug.debug("status: %s; reason: %s" % (str(r1.status), str(r1.reason)))

    count = 0
    while r1.status == 302:
        if count > 10:
            EmergeDebug.debug("Redirect loop")
            return False
        count += 1
        _, host, path, _, _, _ = urllib.parse.urlparse( r1.getheader( "Location" ) )
        EmergeDebug.debug("Redirection: %s %s" % (host, path), 1)
        conn = http.client.HTTPConnection( host )
        conn.request( "GET", path )
        r1 = conn.getresponse()
        EmergeDebug.debug("status: %s; reason: %s" % (str(r1.status), str(r1.reason)))


    data = r1.read()

    with open( os.path.join( destdir, filename ), "wb" ) as f:
        f.write( data )
    return True
开发者ID:TheOneRing,项目名称:emerge,代码行数:29,代码来源:utils.py


示例18: PackagerFactory

def PackagerFactory(parent, packagerType):
    """provides multi packager type api
    return PackagerBase derived instance for recent settings"""
    EmergeDebug.debug("PackagerFactory called", 2)
    packagers = []

    if packagerType:
        for packagerClass in packagerType:
            if not issubclass(packagerClass, PackagerBase):
                EmergeDebug.die("PackagerFactory: unsupported packager %s" % packagerClass)
            else:
                packager = packagerClass()
                init(packager, parent)
                packagers.append(packager)
    else:
        # automatic detection
        packager = InnoSetupPackager()
        init(packager, parent)

        if packager.configFile() != None:
            packagers.append(packager)

        # default packager
        if len(packagers) == 0:
            packager = KDEWinPackager()
            init(packager, parent)
            packagers.append(packager)
    return packagers
开发者ID:TheOneRing,项目名称:emerge,代码行数:28,代码来源:PackagerFactory.py


示例19: fetch

    def fetch( self, dummyRepopath = None ):
        """fetch normal tarballs"""
        EmergeDebug.debug("ArchiveSource.fetch called", 2)

        filenames = self.localFileNames()

        if ( self.noFetch ):
            EmergeDebug.debug("skipping fetch (--offline)")
            return True

        self.setProxy()
        if self.subinfo.hasTarget():
            if self.__checkFilesPresent(filenames):
                EmergeDebug.debug("files and digests available, no need to download files", 1)
                return True

            result = utils.getFiles( self.subinfo.target(), EmergeStandardDirs.downloadDir() , filenames = self.subinfo.archiveName() )
            if not result:
                EmergeDebug.debug("failed to download files", 1)
                return False
            if result and self.subinfo.hasTargetDigestUrls():
                if type(self.subinfo.targetDigestUrl()) == tuple:
                    url, alg = self.subinfo.targetDigestUrl()
                    return utils.getFiles(url, EmergeStandardDirs.downloadDir(),
                                          filenames = self.subinfo.archiveName()
                                                        + EmergeHash.HashAlgorithm.fileEndings().get(alg))
                else:
                    return utils.getFiles( self.subinfo.targetDigestUrl(), EmergeStandardDirs.downloadDir(), filenames = '' )
            else:
                EmergeDebug.debug("no digestUrls present", 2)
                return True
        else:
            return utils.getFiles( "", EmergeStandardDirs.downloadDir() )
开发者ID:TheOneRing,项目名称:emerge,代码行数:33,代码来源:ArchiveSource.py


示例20: cleanBuild

    def cleanBuild( self ):
        """cleanup currently used build dir"""
        if os.path.exists( self.buildDir() ):
            utils.cleanDirectory( self.buildDir() )
            EmergeDebug.debug("cleaning build dir: %s" % self.buildDir(), 1)

        return True
开发者ID:pgquiles,项目名称:kdewindows-emerge,代码行数:7,代码来源:PackageBase.py



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