Ejemplo n.º 1
0
def create(scripts, debug, verbosity, workdir, ascii=0):
    infos = []  # (path, module, klasses)
    for script in scripts:
        infos.append(analscriptname(script))
    if not os.path.exists(workdir):
        os.makedirs(workdir)
    outfnm = 'drive%s.py' % infos[0][1]
    outfnm = os.path.join(workdir, outfnm)
    outf = open(outfnm, 'w')
    klassspecs = []
    modimports = []
    flags = 'debug=%s, quiet=%s' % (debug, verbosity==0)
    paths = []
    for path, module, klasses in infos:
        if path:
            paths.append(path)
        modimports.append("import %s" % (module,))
        for klass in klasses:
            klassspecs.append("%s.%s" % (module, klass))
    for i in range(len(paths)):
        path = paths[i]
        paths[i] = win32api.GetShortPathName(os.path.normpath(path))
    modimports = string.join(modimports, '\n')
    klassspecs = string.join(klassspecs, ', ')
    d = { 'modules':modimports,
          'klasses':klassspecs,
          }
    outf.write( tmplt % d )
    outf.close()
    print "**********************************"
    print "Driver script %s created" % outfnm
    specfnm = Makespec.main([outfnm], console=debug, debug=debug,
                            workdir=workdir, pathex=paths, comserver=1, ascii=ascii)
    print "Spec file %s created" % specfnm
Ejemplo n.º 2
0
def run_makespec(opts, args):
    # Split pathex by using the path separator
    temppaths = opts.pathex[:]
    opts.pathex = []
    for p in temppaths:
        opts.pathex.extend(p.split(os.pathsep))

    spec_file = Makespec.main(args, **opts.__dict__)
    print "wrote %s" % spec_file
    return spec_file
Ejemplo n.º 3
0
def run_makespec(opts, args):
    # Split pathex by using the path separator
    temppaths = opts.pathex[:]
    opts.pathex = []
    for p in temppaths:
        opts.pathex.extend(p.split(os.pathsep))

    spec_file = Makespec.main(args, **opts.__dict__)
    print "wrote %s" % spec_file
    return spec_file
Ejemplo n.º 4
0
def create(scripts, debug, verbosity, workdir, ascii=0):
    infos = []  # (path, module, klasses)
    for script in scripts:
        infos.append(analscriptname(script))
    outfnm = 'drive%s.py' % infos[0][1]
    dllname = 'drive%s.dll' % infos[0][1]
    if not os.path.exists(workdir):
        os.makedirs(workdir)
    outfnm = os.path.join(workdir, outfnm)
    outf = open(outfnm, 'w')
    modspecs = []
    regspecs = []
    modimports = []
    flags = 'debug=0, quiet=%s' % (verbosity == 0)
    paths = []
    for path, module, klasses in infos:
        if path:
            paths.append(path)
        for klass in klasses:
            d = {'mod': module, 'klass': klass, 'dllname': dllname}
            modspecs.append(modspec % d)
            regspecs.append('%(mod)s.%(klass)s' % d)
            modimports.append("import %(mod)s" % d)
    for i in range(len(paths)):
        path = paths[i]
        paths[i] = win32api.GetShortPathName(os.path.normpath(path))
    modspecs = string.join(modspecs, '\n')
    modimports = string.join(modimports, '\n')
    regspecs = string.join(regspecs, ', ')
    d = {
        'modspecs': modspecs,
        'regspecs': regspecs,
        'modimports': modimports,
        'flags': flags
    }
    outf.write(tmplt % d)
    outf.close()
    print "**********************************"
    print "Driver script %s created" % outfnm
    specfnm = Makespec.main([outfnm],
                            console=debug,
                            debug=debug,
                            workdir=workdir,
                            pathex=paths,
                            comserver=1,
                            ascii=ascii)
    print "Spec file %s created" % specfnm