You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
					
					
						
							38 lines
						
					
					
						
							921 B
						
					
					
				
			
		
		
	
	
							38 lines
						
					
					
						
							921 B
						
					
					
				import SCons
 | 
						|
from SCons.Action import Action
 | 
						|
 | 
						|
cythonAction = Action("$CYTHONCOM")
 | 
						|
 | 
						|
def create_builder(env):
 | 
						|
  try:
 | 
						|
    cython = env['BUILDERS']['Cython']
 | 
						|
  except KeyError:
 | 
						|
    cython = SCons.Builder.Builder(
 | 
						|
               action = cythonAction,
 | 
						|
               emitter = {},
 | 
						|
               suffix = cython_suffix_emitter,
 | 
						|
               single_source = 1
 | 
						|
             )
 | 
						|
    env['BUILDERS']['Cython'] = cython
 | 
						|
  return cython
 | 
						|
 | 
						|
def cython_suffix_emitter(env, source):
 | 
						|
  return "$CYTHONCFILESUFFIX"
 | 
						|
 | 
						|
def generate(env):
 | 
						|
  env["CYTHON"] = "cythonize"
 | 
						|
  env["CYTHONCOM"] = "$CYTHON $CYTHONFLAGS $SOURCE"
 | 
						|
  env["CYTHONCFILESUFFIX"] = ".cpp"
 | 
						|
 | 
						|
  c_file, _ = SCons.Tool.createCFileBuilders(env)
 | 
						|
 | 
						|
  c_file.suffix['.pyx'] = cython_suffix_emitter
 | 
						|
  c_file.add_action('.pyx', cythonAction)
 | 
						|
 | 
						|
  c_file.suffix['.py'] = cython_suffix_emitter
 | 
						|
  c_file.add_action('.py', cythonAction)
 | 
						|
 | 
						|
  create_builder(env)
 | 
						|
 | 
						|
def exists(env):
 | 
						|
  return True
 | 
						|
 |