@@ -2509,77 +2509,6 @@ def clean(self, forBuild=False):
2509
2509
return 0
2510
2510
2511
2511
2512
- class GraalpythonCAPIBuildTask (GraalpythonBuildTask ):
2513
- def run (self , args , env = None , cwd = None , ** kwargs ):
2514
- env = env .copy () if env else os .environ .copy ()
2515
- # n.b.: we don't want derived projects to also have to depend on our build env vars
2516
- env .update (mx .dependency ("com.oracle.graal.python.cext" ).getBuildEnv ())
2517
- env .update (self .subject .getBuildEnv ())
2518
-
2519
- # we need to use the sulong toolchain for this
2520
- args .insert (0 , "--python.UseSystemToolchain=false" )
2521
-
2522
- # distutils will honor env variables CC, CFLAGS, LDFLAGS but we won't allow to change them,
2523
- # besides keeping custom sysroot, since our toolchain forwards to the system headers
2524
- for var in ["CC" , "CFLAGS" , "LDFLAGS" ]:
2525
- value = env .pop (var , None )
2526
- new_value = []
2527
- if value :
2528
- if wants_debug_build (value ):
2529
- new_value .append ("-ggdb3" )
2530
- if "--sysroot" in value :
2531
- seen_sysroot = False
2532
- for element in shlex .split (value ):
2533
- if element == "--sysroot" :
2534
- seen_sysroot = True
2535
- elif seen_sysroot :
2536
- new_value .append (f"--sysroot { element } " )
2537
- break
2538
- if new_value :
2539
- env [var ] = " " .join (new_value )
2540
- return super ().run (args , env = env , cwd = cwd , ** kwargs )
2541
-
2542
- def _dev_headers_dir (self ):
2543
- if sys .platform == "win32" :
2544
- return os .path .join (SUITE .dir , "graalpython" , "include" )
2545
- else :
2546
- return os .path .join (SUITE .dir , "graalpython" , "include" , f"python{ py_version_short ()} " )
2547
-
2548
- def _prepare_headers (self ):
2549
- target_dir = self ._dev_headers_dir ()
2550
- if os .path .exists (target_dir ):
2551
- shutil .rmtree (target_dir )
2552
- mx .logv ("Preparing header files (dest: {!s})" .format (target_dir ))
2553
- shutil .copytree (os .path .join (self .src_dir (), "include" ), target_dir , symlinks = True )
2554
- shutil .copy (os .path .join (mx .dependency ("SULONG_LEGACY" ).get_output (), "include" , "truffle.h" ), target_dir )
2555
-
2556
- def build (self ):
2557
- self ._prepare_headers ()
2558
- # n.b.: we do the following to ensure that there's a directory when the
2559
- # importlib PathFinder initializes it's directory finders
2560
- mx .ensure_dir_exists (os .path .join (self .subject .get_output_root (), "modules" ))
2561
- # TODO: backwards compat, remove once EE is updated
2562
- if not hasattr (self .subject , "args" ):
2563
- self .subject .args = [
2564
- os .path .join (self .src_dir (), "setup.py" ),
2565
- self .subject .get_output_root ()
2566
- ]
2567
- return super ().build ()
2568
-
2569
- def clean (self , forBuild = False ):
2570
- result = 0
2571
- if not forBuild :
2572
- try :
2573
- mx .logv ('Cleaning {0}...' .format (self ._dev_headers_dir ()))
2574
- shutil .rmtree (self ._dev_headers_dir (), ignore_errors = True )
2575
- mx .logv ('Cleaning {0}...' .format (self .subject .get_output_root ()))
2576
- shutil .rmtree (self .subject .get_output_root (), ignore_errors = True )
2577
- except BaseException as e :
2578
- mx .logv ('Error while cleaning: {0}' .format (e ))
2579
- result = 1
2580
- return max (result , super ().clean (forBuild = forBuild ))
2581
-
2582
-
2583
2512
class GraalpythonProject (mx .ArchivableProject ):
2584
2513
def __init__ (self , suite , name , subDir , srcDirs , deps , workingSets , d , theLicense = None , ** kwargs ): # pylint: disable=super-init-not-called
2585
2514
context = 'project ' + name
@@ -2621,16 +2550,6 @@ def getBuildEnv(self, replaceVar=mx_subst.path_substitutions):
2621
2550
return ret
2622
2551
2623
2552
2624
- class GraalpythonCAPIProject (GraalpythonProject ):
2625
- def __init__ (self , suite , name , subDir , srcDirs , deps , workingSets , d , theLicense = None , ** kwargs ):
2626
- super ().__init__ (suite , name , subDir , srcDirs , deps , workingSets , d , theLicense , ** kwargs )
2627
- if mx .suite ("sulong-managed" , fatalIfMissing = False ) is not None :
2628
- self .buildDependencies .append ('sulong-managed:SULONG_MANAGED_HOME' )
2629
-
2630
- def getBuildTask (self , args ):
2631
- return GraalpythonCAPIBuildTask (args , self )
2632
-
2633
-
2634
2553
orig_clean = mx .command_function ("clean" )
2635
2554
def python_clean (args ):
2636
2555
orig_clean (args )
0 commit comments