Beispiel #1
0
def genTengilFile(outputFile = str(), viewDir = str(), outputName = str(), inputName = str(), buildItems = list(), bcFile = str()):
    launch_path = posixpath.abspath('.')
    view_dir = ctx2_common.get_view_dir(viewDir)
    obj_dir = view_dir + os.sep + '.ctx/obj'

    envLayout = None
    oldEnv = None

    contexo_config_path = posixpath.join( ctx_common.getUserCfgDir(), ctx_sysinfo.CTX_CONFIG_FILENAME )
    cfgFile = ctx_cfg.CFGFile( contexo_config_path )

    cview = ctx_view.CTXView(view_dir, validate=False)
    bc = ctx2_common.getBuildConfiguration(cview, bcFile, cfgFile)

    comps = ctx2_common.expand_list_files(cview, buildItems)

    components = list()
    modules = list()
    components = ctx2_common.create_components(comps, cview.getItemPaths('comp'), obj_dir, launch_path)
    for comp in components:
        for library, compModules in comp.libraries.items():
            modules.extend(compModules)

    buildTests = True
    librarySources, includes = ctx2_common.parseComps(cview, view_dir, buildTests, bc, components)
    tempdir = tempfile.mkdtemp(prefix='ctx2tengil')

    for file in includes:
        shutil.copy(file, tempdir)
    for sources in librarySources.values():
        for file in sources:
            shutil.copy(file, tempdir)

    args = " ".join(['grep', '-h', inputName, tempdir + os.sep + '*',  '|', 'grep', '-v', '"#define"' + '>', outputFile])
    print args
    if subprocess.call(args, shell=True) != 0:
        sys.exit()
    
    args = " ".join(['sed', '-i', 's/' + inputName + '/' + outputName + '/g', outputFile])
    print args
    if subprocess.Popen(args, shell=True) != 0:
        sys.exit()
 
    shutil.rmtree(tempdir)
Beispiel #2
0
from internal_argparse import ArgumentParser
import contexo.ctx_export as ctx_export
from contexo.ctx_common import infoMessage, userErrorExit, warningMessage
import os
import contexo.ctx_bc
import contexo.ctx_cmod
import contexo.ctx_msvc
import contexo.ctx_cfg as ctx_cfg
import contexo.ctx_common as ctx_common
import contexo.ctx_sysinfo as ctx_sysinfo

msgSender = 'MSVC Export'

default_projname = "MSVC_EXPORT"

contexo_config_path = os.path.join( ctx_common.getUserCfgDir(), ctx_sysinfo.CTX_CONFIG_FILENAME )
infoMessage("Using config file '%s'"%contexo_config_path,  1)
cfgFile = ctx_cfg.CFGFile( contexo_config_path)
ctx_common.setInfoMessageVerboseLevel( int(cfgFile.getVerboseLevel()) )

#------------------------------------------------------------------------------
def create_module_mapping_from_module_list( ctx_module_list, depMgr):
    code_module_map = list()
    print >>sys.stderr, 'mapping'
    for mod in ctx_module_list:
        #srcFiles = list()
        privHdrs = list()
        pubHdrs  = list()
        depHdrDirs = set()

        rawMod = ctx_module_list[mod] #ctx_cmod.CTXRawCodeModule( mod )
Beispiel #3
0
# --- WINDOWS SPECIFICS ---
#

import distutils
import contexo.ctx_common as ctx_common
import shutil
from os.path import join as pjoin
python_lib = distutils.sysconfig.get_python_lib()  #path to site-packages
contexo_path   = pjoin( python_lib, 'contexo' )
default_bconfs = pjoin( contexo_path, 'defaults/bconf' )
default_cdefs  = pjoin( contexo_path, 'defaults/cdef' )

if sys.platform == 'win32':
    # Create user profile directories
    for subdir in ['plugins', 'bconf', 'cdef', 'env']:
        subdir = pjoin( ctx_common.getUserCfgDir(), subdir )
        if not os.path.exists( subdir ):
            os.makedirs( subdir )

    # Copy standard bconf items
    for bconf in os.listdir( default_bconfs ):
        dst = pjoin(ctx_common.getUserCfgDir(), 'bconf', bconf)
        if not os.path.exists( dst ):
            shutil.copyfile( pjoin(default_bconfs, bconf), dst )

    # Copy standard cdef items
    for cdef in os.listdir( default_cdefs ):
        dst = pjoin(ctx_common.getUserCfgDir(), 'cdef', cdef)
        if not os.path.exists( dst ):
            shutil.copyfile( pjoin(default_cdefs, cdef), dst )