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


Python EmergeDebug.verbose方法代码示例

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


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

示例1: stopTimer

# 需要导入模块: import EmergeDebug [as 别名]
# 或者: from EmergeDebug import verbose [as 别名]
def stopTimer(name):
    """stops a timer for meassurement"""
    if emergeSettings.getboolean( "EmergeDebug", "MeasureTime", False ):
        if not name in _TIMERS:
            EmergeDebug.debug("%s not in timers" % name)
            return
        startTime , level = _TIMERS[name]
        if EmergeDebug.verbose() > 0  and (level == 0 or EmergeDebug.verbose() > level):
            delta = datetime.datetime.now() - startTime
            print( "Task: %s stopped after: %s" % (name , delta) )
            sys.stdout.flush()
        del _TIMERS[name]
开发者ID:TheOneRing,项目名称:emerge,代码行数:14,代码来源:utils.py

示例2: make

# 需要导入模块: import EmergeDebug [as 别名]
# 或者: from EmergeDebug import verbose [as 别名]
 def make(self):
     if self.buildTarget == "1_55_0":
         cmd = "build.bat "
         if compiler.isClang():
             cmd += "clang"
         elif compiler.isMinGW():
             cmd += "gcc"
         else:
             if compiler.isMSVC2005():
                 cmd += "vc8"
             elif compiler.isMSVC2008():
                 cmd += "vc9"
             elif compiler.isMSVC2010():
                 cmd += "vc10"
         if EmergeDebug.verbose() >= 1:
             print(cmd)
         utils.system(
             cmd,
             cwd=os.path.join(
                 portage.getPackageInstance("win32libs", "boost-headers").sourceDir(),
                 "tools",
                 "build",
                 "v2",
                 "engine",
             ),
         ) or EmergeDebug.die("command: %s failed" % (cmd))
     else:
         cmd = "bootstrap.bat "
         if compiler.isMinGW():
             cmd += "mingw"
         else:
             if compiler.isMSVC2005():
                 cmd += "vc8"
             elif compiler.isMSVC2008():
                 cmd += "vc9"
             elif compiler.isMSVC2010():
                 cmd += "vc10"
             elif compiler.isMSVC2012():
                 cmd += "vc11"
             elif compiler.isMSVC2013():
                 cmd += "vc12"
             elif compiler.isMSVC2015():
                 cmd += "vc14"
         if EmergeDebug.verbose() >= 1:
             print(cmd)
         utils.system(
             cmd,
             cwd=os.path.join(
                 portage.getPackageInstance("win32libs", "boost-headers").sourceDir(), "tools", "build"
             ),
         ) or EmergeDebug.die("command: %s failed" % (cmd))
     return True
开发者ID:TheOneRing,项目名称:emerge,代码行数:54,代码来源:boost-bjam.py

示例3: getFile

# 需要导入模块: import EmergeDebug [as 别名]
# 或者: from EmergeDebug import verbose [as 别名]
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,代码行数:33,代码来源:utils.py

示例4: __checkout

# 需要导入模块: import EmergeDebug [as 别名]
# 或者: from EmergeDebug import verbose [as 别名]
    def __checkout( self, url, sourcedir, recursive=True ):
        """internal method for subversion checkout and update"""
        option = ""
        if not recursive:
            option = "--depth=files"

        if EmergeDebug.verbose() < 2 and not emergeSettings.getboolean("General", "KDESVNVERBOSE", True):
            option += " --quiet"

        self.setProxy()

        if self.options != None:
            option += self.options

        if self.subinfo.options.fetch.ignoreExternals:
            option += " --ignore-externals "

        url = utils.replaceVCSUrl( url )

        if os.path.exists( sourcedir ):
            cmd = "%s/svn update %s %s" % ( self.svnInstallDir, option, sourcedir )
        else:
            cmd = "%s/svn checkout %s %s %s" % (self.svnInstallDir, option, url, sourcedir )

        return utils.system( cmd )
开发者ID:TheOneRing,项目名称:emerge,代码行数:27,代码来源:SvnSource.py

示例5: systemWithoutShell

# 需要导入模块: import EmergeDebug [as 别名]
# 或者: from EmergeDebug import verbose [as 别名]
def systemWithoutShell(cmd, **kw):
    """execute cmd. All keywords are passed to Popen. stdout and stderr
    might be changed depending on the chosen logging options."""

    EmergeDebug.debug("executing command: %s" % cmd, 1)
    if EmergeDebug.verbose() == -1 and not 'stdout' in kw and not 'stderr' in kw:
        kw['stdout'] = kw['stderr'] = subprocess.DEVNULL
    return subprocess.call(cmd, **kw) == 0
开发者ID:pgquiles,项目名称:kdewindows-emerge,代码行数:10,代码来源:utils.py

示例6: unpack

# 需要导入模块: import EmergeDebug [as 别名]
# 或者: from EmergeDebug import verbose [as 别名]
    def unpack(self):
        EmergeDebug.trace("VersionSystemSourceBase unpack", 2)
        self.enterBuildDir()

        if not self.noClean:
            if EmergeDebug.verbose() > 0:
                print("cleaning %s" % self.buildDir())
            utils.cleanDirectory( self.buildDir() )
        if not self.noCopy:
            sourceDir = self.checkoutDir()
            if EmergeDebug.verbose() > 0:
                print("copying %s to %s" % (sourceDir, self.buildDir()))
            utils.copySrcDirToDestDir(sourceDir, self.buildDir())
        ret = self.applyPatches()
        if emergeSettings.getboolean("General","EMERGE_HOLD_ON_PATCH_FAIL", False):
            return ret
        return True
开发者ID:TheOneRing,项目名称:emerge,代码行数:19,代码来源:VersionSystemSourceBase.py

示例7: createImportLibs

# 需要导入模块: import EmergeDebug [as 别名]
# 或者: from EmergeDebug import verbose [as 别名]
def createImportLibs( dll_name, basepath ):
    """creating the import libraries for the other compiler(if ANSI-C libs)"""

    dst = os.path.join( basepath, "lib" )
    if( not os.path.exists( dst ) ):
        os.mkdir( dst )

    # check whether the required binary tools exist
    HAVE_GENDEF = UtilsCache.findApplication( "gendef" ) is not None
    USE_GENDEF = HAVE_GENDEF
    HAVE_LIB = UtilsCache.findApplication( "lib" ) is not None
    HAVE_DLLTOOL = UtilsCache.findApplication( "dlltool" ) is not None
    if EmergeDebug.verbose() > 1:
        print("gendef found:", HAVE_GENDEF)
        print("gendef used:", USE_GENDEF)
        print("lib found:", HAVE_LIB)
        print("dlltool found:", HAVE_DLLTOOL)

    dllpath = os.path.join( basepath, "bin", "%s.dll" % dll_name )
    defpath = os.path.join( basepath, "lib", "%s.def" % dll_name )
    exppath = os.path.join( basepath, "lib", "%s.exp" % dll_name )
    imppath = os.path.join( basepath, "lib", "%s.lib" % dll_name )
    gccpath = os.path.join( basepath, "lib", "%s.dll.a" % dll_name )

    if not HAVE_GENDEF and os.path.exists( defpath ):
        HAVE_GENDEF = True
        USE_GENDEF = False
    if not HAVE_GENDEF:
        EmergeDebug.warning("system does not have gendef.exe")
        return False
    if not HAVE_LIB  and not os.path.isfile( imppath ):
        EmergeDebug.warning("system does not have lib.exe (from msvc)")
    if not HAVE_DLLTOOL and not os.path.isfile( gccpath ):
        EmergeDebug.warning("system does not have dlltool.exe")

    # create .def
    if USE_GENDEF:
        cmd = "gendef - %s -a > %s " % ( dllpath, defpath )
        system( cmd )

    if( HAVE_LIB and not os.path.isfile( imppath ) ):
        # create .lib
        cmd = "lib /machine:x86 /def:%s /out:%s" % ( defpath, imppath )
        system( cmd )

    if( HAVE_DLLTOOL and not os.path.isfile( gccpath ) ):
        # create .dll.a
        cmd = "dlltool -d %s -l %s -k" % ( defpath, gccpath )
        system( cmd )

    if os.path.exists( defpath ):
        os.remove( defpath )
    if os.path.exists( exppath ):
        os.remove( exppath )
    return True
开发者ID:pgquiles,项目名称:kdewindows-emerge,代码行数:57,代码来源:utils.py

示例8: make

# 需要导入模块: import EmergeDebug [as 别名]
# 或者: from EmergeDebug import verbose [as 别名]
 def make( self ):
     """implements the make step for cmake projects"""
     self.boost = portage.getPackageInstance('win32libs', 'boost-headers')
     self.subinfo.targetInstSrc[ self.subinfo.buildTarget ] = os.path.join(self.boost.sourceDir(),"libs",self.subinfo.targetInstSrc[ self.subinfo.buildTarget ],"build")
     
     self.enterSourceDir()
     cmd  = "bjam"
     cmd += self.configureOptions(self.subinfo.options.configure.defines)
     if EmergeDebug.verbose() >= 1:
         print(cmd)
     return self.system(cmd)
开发者ID:TheOneRing,项目名称:emerge,代码行数:13,代码来源:BoostBuildSystem.py

示例9: un7zip

# 需要导入模块: import EmergeDebug [as 别名]
# 或者: from EmergeDebug import verbose [as 别名]
def un7zip( fileName, destdir, flag = None ):
    command = "7za x -r -y -o%s %s" % ( destdir, fileName )

    if flag == ".7z":
        # Actually this is not needed for a normal archive.
        # But git is an exe file renamed to 7z and we need to specify the type.
        # Yes it is an ugly hack.
        command += " -t7z"
    command += " -bsp1"
    if EmergeDebug.verbose() <= 1:
        command += " -bso0"
    return system( command )
开发者ID:TheOneRing,项目名称:emerge,代码行数:14,代码来源:utils.py

示例10: makeOptions

# 需要导入模块: import EmergeDebug [as 别名]
# 或者: from EmergeDebug import verbose [as 别名]
 def makeOptions(self, defines="", maybeVerbose=True):
     """return options for make command line"""
     if self.subinfo.options.make.ignoreErrors:
         defines += " -i"
     if self.subinfo.options.make.makeOptions:
         defines += " %s" % self.subinfo.options.make.makeOptions
     if maybeVerbose and EmergeDebug.verbose() > 1:
         if self.supportsNinja and emergeSettings.getboolean("Compile","UseNinja", False ):
             defines += " -v "
         else:
             defines += " VERBOSE=1 V=1"
     return defines
开发者ID:pgquiles,项目名称:kdewindows-emerge,代码行数:14,代码来源:BuildSystemBase.py

示例11: un7zip

# 需要导入模块: import EmergeDebug [as 别名]
# 或者: from EmergeDebug import verbose [as 别名]
def un7zip( fileName, destdir, flag = None ):
    command = os.path.join(EmergeStandardDirs.emergeRoot(), "emerge", "bin", "emerge_7za")
    command += " x -r -y -o%s %s" % ( destdir, fileName )

    if flag == ".7z":
        # Actually this is not needed for a normal archive.
        # But git is an exe file renamed to 7z and we need to specify the type.
        # Yes it is an ugly hack.
        command += " -t7z"
    command += " -bsp1"
    if EmergeDebug.verbose() <= 1:
        command += " -bso0"
    return system( command )
开发者ID:pgquiles,项目名称:kdewindows-emerge,代码行数:15,代码来源:utils.py

示例12: main

# 需要导入模块: import EmergeDebug [as 别名]
# 或者: from EmergeDebug import verbose [as 别名]
def main( ):
    parser = argparse.ArgumentParser( prog = "emerge",
                                      description = "Emerge is a tool for building KDE-related software under Windows. emerge automates it, looks for the dependencies and fetches them automatically.\
                                      Some options should be used with extreme caution since they will make your kde installation unusable in 999 out of 1000 cases.",
                                      epilog = """More information see the README or http://windows.kde.org/.
    Send feedback to <[email protected]>.""" )

    parser.add_argument( "-p", "--probe", action = "store_true",
                         help = "probing: emerge will only look which files it has to build according to the list of installed files and according to the dependencies of the package." )
    parser.add_argument( "--list-file", action = "store",
                         help = "Build all packages from the csv file provided" )
    _def = emergeSettings.get( "General", "EMERGE_OPTIONS", "" )
    if _def == "": _def = []
    else: _def = _def.split( ";" )
    parser.add_argument( "--options", action = "append",
                         default = _def,
                         help = "Set emerge property from string <OPTIONS>. An example for is \"cmake.openIDE=1\" see options.py for more informations." )
    parser.add_argument( "-z", "--outDateVCS", action = "store_true",
                         help = "if packages from version control system sources are installed, it marks them as out of date and rebuilds them (tags are not marked as out of date)." )
    parser.add_argument( "-sz", "--outDatePackage", action = "store_true",
                         help = "similar to -z, only that it acts only on the last package, and works as normal on the rest." )
    parser.add_argument( "-q", "--stayquiet", action = "store_true",
                         dest = "stayQuiet",
                         help = "quiet: there should be no output - The verbose level should be 0" )
    parser.add_argument( "-t", "--buildtests", action = "store_true", dest = "buildTests",
                         default = emergeSettings.getboolean( "General", "EMERGE_BUILDTESTS", False ) )
    parser.add_argument( "-c", "--continue", action = "store_true", dest = "doContinue" )
    parser.add_argument( "--offline", action = "store_true",
                         default = emergeSettings.getboolean( "General", "WorkOffline", False ),
                         help = "do not try to connect to the internet: KDE packages will try to use an existing source tree and other packages would try to use existing packages in the download directory.\
                          If that doesn't work, the build will fail." )
    parser.add_argument( "-f", "--force", action = "store_true", dest = "forced",
                         default = emergeSettings.getboolean( "General", "EMERGE_FORCED", False ) )
    parser.add_argument( "--buildtype", choices = [ "Release", "RelWithDebInfo", "MinSizeRel", "Debug" ],
                         dest = "buildType",
                         default = emergeSettings.get( "General", "EMERGE_BUILDTYPE", "RelWithDebInfo" ),
                         help = "This will override the build type set by the environment option EMERGE_BUILDTYPE ." )
    parser.add_argument( "-v", "--verbose", action = "count",
                         default = int( emergeSettings.get( "EmergeDebug", "Verbose", "0" ) ),
                         help = " verbose: increases the verbose level of emerge. Default is 1. verbose level 1 contains some notes from emerge, all output of cmake, make and other programs that are used.\
                          verbose level 2a dds an option VERBOSE=1 to make and emerge is more verbose highest level is verbose level 3." )
    parser.add_argument( "--trace", action = "store",
                         default = int( emergeSettings.get( "General", "EMERGE_TRACE", "0" ) ), type = int )
    parser.add_argument( "-i", "--ignoreInstalled", action = "store_true",
                         help = "ignore install: using this option will install a package over an existing install. This can be useful if you want to check some new code and your last build isn't that old." )
    parser.add_argument( "-ia", "--ignoreAllInstalled", action = "store_true",
                         help = "ignore all install: using this option will install all package over an existing install. This can be useful if you want to check some new code and your last build isn't that old." )

    parser.add_argument( "--target", action = "store",
                         help = "This will override the build of the default target. The default Target is marked with a star in the printout of --print-targets" )
    parser.add_argument( "--search", action = "store_true",
                         help = "This will search for a package or a description matching or similar to the search term." )
    parser.add_argument( "--nocopy", action = "store_true",
                         default = emergeSettings.getboolean( "General", "EMERGE_NOCOPY", False ),
                         help = "this option is deprecated. In older releases emerge would have copied everything from the SVN source tree to a source directory under KDEROOT\\tmp - currently nocopy is applied\
                          by default if EMERGE_NOCOPY is not set to \"False\". Be aware that setting EMERGE_NOCOPY to \"False\" might slow down the build process, irritate you and increase the disk space roughly\
                           by the size of SVN source tree." )
    parser.add_argument( "--noclean", action = "store_true",
                         default = emergeSettings.getboolean( "General", "EMERGE_NOCLEAN", False ),
                         help = "this option will try to use an existing build directory. Please handle this option with care - it will possibly break if the directory isn't existing." )
    parser.add_argument( "--clean", action = "store_false", dest = "noclean",
                         help = "oposite of --noclean" )
    parser.add_argument( "--patchlevel", action = "store",
                         default = emergeSettings.get( "General", "EMERGE_PKGPATCHLVL", "" ),
                         help = "This will add a patch level when used together with --package" )
    parser.add_argument( "--log-dir", action = "store",
                         default = emergeSettings.get( "General", "EMERGE_LOG_DIR", "" ),
                         help = "This will log the build output to a logfile in LOG_DIR for each package. Logging information is appended to existing logs." )
    parser.add_argument( "--dt", action = "store", choices = [ "both", "runtime", "buildtime" ], default = "both",
                         dest = "dependencyType" )
    parser.add_argument( "--update-fast", action = "store_true",
                         help = "If the package is installed from svn/git and the revision did not change all steps after fetch are skipped" )
    parser.add_argument( "-d", "--dependencydepth", action = "store", type = int, default = -1,
                         help = "By default emerge resolves the whole dependency graph, this option limits the depth of the graph, so a value of 1 would mean only dependencies defined in that package" )

    actionHandler = ActionHandler(parser)
    for x in sorted( [ "fetch", "unpack", "configure", "compile", "make",
                       "install", "install-deps", "qmerge", "manifest", "package", "unmerge", "test",
                       "checkdigest", "dumpdeps",
                       "full-package", "cleanimage", "cleanbuild", "createpatch", "geturls"] ):
        actionHandler.addAction( x )
    actionHandler.addAction( "update", help = "Update a single package" )

    # read-only actions
    actionHandler.addAction( "print-source-version" )
    actionHandler.addAction( "print-package-version" )
    actionHandler.addAction( "print-targets",
                             help = "This will show a list of available targets for the package" )
    actionHandler.addAction( "print-installed",
                             help = "This will show a list of all packages that are installed currently." )
    actionHandler.addAction( "print-installable",
                             help = "This will give you a list of packages that can be installed. Currently you don't need to enter the category and package: only the package will be enough." )
    actionHandler.addAction( "print-revision", help = "Print the revision of the package and exit" )
    actionHandler.addAction( "print-files", help = "Print the files installed by the package and exit" )
    actionHandler.addActionWithArg( "search-file", help = "Print packages owning the file" )

    # other actions
    actionHandler.addActionWithArg( "dump-deps-file", dest = "dumpDepsFile",
                                    help = "Output the dependencies of this package as a csv file suitable for emerge server." )
    actionHandler.addAction( "generate-jenkins-job")
#.........这里部分代码省略.........
开发者ID:TheOneRing,项目名称:emerge,代码行数:103,代码来源:emerge.py

示例13: handleSinglePackage

# 需要导入模块: import EmergeDebug [as 别名]
# 或者: from EmergeDebug import verbose [as 别名]

#.........这里部分代码省略.........
            item.target = targetDict[ item.category + "/" + item.package ]

        if args.target in list(
                portage.PortageInstance.getAllTargets( item.category, item.package ).keys( ) ):
            # if no target or a wrong one is defined, simply set the default target here
            item.target = args.target

        EmergeDebug.debug("dependency: %s" % item, 1)
    if not deplist:
        EmergeDebug.debug("<none>", 1)

    EmergeDebug.debug_line(1)

    #for item in deplist:
    #    cat = item[ 0 ]
    #    pac = item[ 1 ]
    #    ver = item[ 2 ]

    #    if portage.isInstalled( cat, pac, ver, buildType) and updateAll and not portage.isPackageUpdateable( cat, pac, ver ):
    #        print "remove:", cat, pac, ver
    #        deplist.remove( item )

    if action == "install-deps":
        # the first dependency is the package itself - ignore it
        # TODO: why are we our own dependency?
        del deplist[ 0 ]
    elif action == "update-direct-deps":
        for item in deplist:
            item.enabled = True

    deplist.reverse( )

    # package[0] -> category
    # package[1] -> package
    # package[2] -> version

    info = deplist[ -1 ]
    if not portage.PortageInstance.isVirtualPackage( info.category, info.package ) and \
        not action in [ "all", "install-deps" ,"generate-jenkins-job"] and\
        not args.list_file or\
        action in ["print-targets"]:#not all commands should be executed on the deps if we are a virtual packages
        # if a buildAction is given, then do not try to build dependencies
        # and do the action although the package might already be installed.
        # This is still a bit problematic since packageName might not be a valid
        # package
        # for list files, we also want to handle fetching & packaging per package

        if not handlePackage( info.category, info.package, action, args.doContinue, args.update_fast ):
            utils.notify( "Emerge %s failed" % action, "%s of %s/%s failed" % (
                action, info.category, info.package), action )
            return False
        utils.notify( "Emerge %s finished" % action,
                      "%s of %s/%s finished" % ( action, info.category, info.package),
                      action )

    else:
        if args.dumpDepsFile:
            dumpDepsFileObject = open( args.dumpDepsFile, 'w+' )
            dumpDepsFileObject.write( "# dependency dump of package %s\n" % ( packageName ) )
        for info in deplist:
            isVCSTarget = False

            if args.dumpDepsFile:
                dumpDepsFileObject.write( ",".join( [ info.category, info.package, info.target, "" ] ) + "\n" )

            isLastPackage = info == deplist[ -1 ]
            if args.outDateVCS or (args.outDatePackage and isLastPackage):
                isVCSTarget = portage.PortageInstance.getUpdatableVCSTargets( info.category, info.package ) != [ ]
            isInstalled = InstallDB.installdb.isInstalled( info.category, info.package )
            if args.list_file and action != "all":
                info.enabled = info.package in originalPackageList
            if ( isInstalled and not info.enabled ) and not (
                            isInstalled and (args.outDateVCS or (
                                    args.outDatePackage and isLastPackage) ) and isVCSTarget ):
                if EmergeDebug.verbose() > 1 and info.package == packageName:
                    EmergeDebug.warning("already installed %s/%s" % (info.category, info.package))
                elif EmergeDebug.verbose() > 2 and not info.package == packageName:
                    EmergeDebug.warning("already installed %s/%s" % (info.category, info.package))
            else:
                # in case we only want to see which packages are still to be build, simply return the package name
                if args.probe:
                    if EmergeDebug.verbose() > 0:
                        EmergeDebug.warning("pretending %s" % info)
                else:
                    if action in [ "install-deps", "update-direct-deps" ]:
                        action = "all"

                    if not handlePackage( info.category, info.package, action, args.doContinue, args.update_fast ):
                        EmergeDebug.error("fatal error: package %s/%s %s failed" % \
                                          ( info.category, info.package, action ))
                        utils.notify( "Emerge build failed",
                                      "Build of %s/%s failed" % ( info.category, info.package),
                                      action )
                        return False
                    utils.notify( "Emerge build finished",
                                  "Build of %s/%s finished" % ( info.category, info.package),
                                  action )

    EmergeDebug.new_line()
    return True
开发者ID:TheOneRing,项目名称:emerge,代码行数:104,代码来源:emerge.py

示例14: generateNSISInstaller

# 需要导入模块: import EmergeDebug [as 别名]
# 或者: from EmergeDebug import verbose [as 别名]
    def generateNSISInstaller( self ):
        """ runs makensis to generate the installer itself """

        self.isInstalled()

        if not self.scriptname:
            self.scriptname = os.path.join( os.path.dirname( __file__ ), "NullsoftInstaller.nsi" )

        if self.package.endswith( "-package" ):
            shortPackage = self.package[ : -8 ]
        else:
            shortPackage = self.package

        if not "setupname" in self.defines or not self.defines[ "setupname" ]:
            self.defines[ "setupname" ] = "%s-%s-setup-%s.exe" % ( shortPackage, compiler.architecture(), self.buildTarget )
        if not "srcdir" in self.defines or not self.defines[ "srcdir" ]:
            self.defines[ "srcdir" ] = self.archiveDir()
        if not "company" in self.defines or not self.defines[ "company" ]:
            self.defines[ "company" ] = "KDE"
        if not "productname" in self.defines or not self.defines[ "productname" ]:
            self.defines[ "productname" ] = shortPackage.capitalize()
        if not "version" in self.defines or not self.defines[ "version" ]:
            self.defines[ "version" ] = self.buildTarget
        if not "executable" in self.defines or not self.defines[ "executable" ]:
            self.defines[ "executable" ] = ""
        if "license" in self.defines and self.defines[ "license" ]:
            self.defines[ "license" ] = "!insertmacro MUI_PAGE_LICENSE \"%s\"" %  self.defines[ "license" ] 
        else:
            self.defines[ "license" ] = ""
        if "icon" in self.defines and self.defines[ "icon" ]:
            self.defines[ "icon" ] = "!define MUI_ICON \"%s\"" % self.defines[ "icon" ]
        else:
            self.defines[ "icon" ] = ""
        self.defines[ "architecture" ] = compiler.architecture()
        self.defines[ "defaultinstdir" ] = "$PROGRAMFILES64" if compiler.isX64() else "$PROGRAMFILES"

        # runtime distributable files
        self.defines[ "vcredist" ] = self.getVCRedistLocation(compiler)
        if not self.defines[ "vcredist" ]:
            self.defines[ "vcredist" ] = "none"
            # for earlier versions of MSVC, simply copy the redist files to the "bin" folder of the installation
            if compiler.isMSVC():
                if compiler.isX64():
                    redistPath = os.path.join( os.path.join( self.getVCRuntimeLibrariesLocation(), "x64" ) )
                else:
                    redistPath = os.path.join( os.path.join( self.getVCRuntimeLibrariesLocation(), "x86" ) )
                for root, subdirs, files in os.walk( redistPath ):
                    for f in files:
                        shutil.copy( os.path.join( root, f ), os.path.join( self.archiveDir(), "bin" ) )
            elif compiler.isMinGW():
                for f in glob.glob( os.path.join( self.rootdir, "mingw", "bin", "*.dll") ):
                    shutil.copy( f, os.path.join( self.archiveDir(), "bin" ) )
            else:
                EmergeDebug.die( "Fixme: Copy runtime libraries for this compiler" )

        # make absolute path for output file
        if not os.path.isabs( self.defines[ "setupname" ] ):
            dstpath = self.packageDestinationDir()
            self.defines[ "setupname" ] = os.path.join( dstpath, self.defines[ "setupname" ] )

        definestring = ""
        for key in self.defines:
            definestring += " /D" + key + "=\"" + self.defines[ key ] + "\""

        EmergeDebug.new_line()
        EmergeDebug.debug("generating installer %s" % self.defines["setupname"])

        verboseString = "/V4" if EmergeDebug.verbose() > 0 else "/V3"

        if self.isInstalled:
            makensisExe = os.path.join(self.nsisInstallPath, 'makensis.exe')
            if not utils.systemWithoutShell( "\"%s\" %s %s %s" % (makensisExe, verboseString, definestring,
                    self.scriptname ), cwd = os.path.abspath( self.packageDir() ) ):
                EmergeDebug.die("Error in makensis execution")
开发者ID:pgquiles,项目名称:kdewindows-emerge,代码行数:76,代码来源:NullsoftInstallerPackager.py


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