@@ -2019,23 +2019,41 @@ def import_files(from_dir, to_dir):
2019
2019
dest_file = join (to_dir , relative_dir_path , filename )
2020
2020
import_file (src_file , dest_file )
2021
2021
2022
+ def remove_inexisting_file (src_file , dest_file ):
2023
+ if not os .path .exists (dest_file ):
2024
+ mx .logv ("Removing file {} since {} does not exist" .format (src_file , dest_file ))
2025
+ vc .git_command (SUITE .dir , ["rm" , src_file ])
2026
+ os .unlink (src_file , missing_ok = True )
2027
+
2028
+ def remove_inexisting_files (hpy_dir , our_dir ):
2029
+ mx .log ("Looking for removed files in {} (HPy reference dir {})" .format (our_dir , hpy_dir ))
2030
+ for dirpath , _ , filenames in os .walk (our_dir ):
2031
+ relative_dir_path = os .path .relpath (dirpath , start = our_dir )
2032
+ for filename in filenames :
2033
+ src_file = join (dirpath , filename )
2034
+ dest_file = join (hpy_dir , relative_dir_path , filename )
2035
+ remove_inexisting_file (src_file , dest_file )
2036
+
2022
2037
# headers go into 'com.oracle.graal.python.cext/include'
2023
2038
header_dest = join (mx .dependency ("com.oracle.graal.python.cext" ).dir , "include" )
2024
2039
2025
2040
# copy headers from .../hpy/hpy/devel/include' to 'header_dest'
2026
2041
# but exclude subdir 'cpython' (since that's only for CPython)
2027
2042
import_files (hpy_repo_include_dir , header_dest )
2043
+ remove_inexisting_files (hpy_repo_include_dir , header_dest )
2028
2044
2029
- # runtime sources go into 'lib-graalpython/module/hpy/src'
2030
- runtime_files_dest = join (_get_core_home (), "modules" , "hpy" , "src" )
2045
+ # runtime sources go into 'lib-graalpython/module/hpy/devel/ src'
2046
+ runtime_files_dest = join (_get_core_home (), "modules" , "hpy" , "devel" , " src" )
2031
2047
import_files (hpy_repo_runtime_dir , runtime_files_dest )
2048
+ remove_inexisting_files (hpy_repo_runtime_dir , runtime_files_dest )
2032
2049
2033
2050
# tests go to 'lib-graalpython/module/hpy/tests'
2034
2051
test_files_dest = _hpy_test_root ()
2035
2052
import_files (hpy_repo_test_dir , test_files_dest )
2053
+ remove_inexisting_files (hpy_repo_test_dir , test_files_dest )
2036
2054
2037
- # 'version.py' goes to 'lib-graalpython/module/hpy/'
2038
- import_file (join (hpy_repo_path , "hpy" , "devel" , "version.py" ), join (_get_core_home (), "modules" , "hpy" , "version.py" ))
2055
+ # 'version.py' goes to 'lib-graalpython/module/hpy/devel/ '
2056
+ import_file (join (hpy_repo_path , "hpy" , "devel" , "version.py" ), join (_get_core_home (), "modules" , "hpy" , "devel" , " version.py" ))
2039
2057
2040
2058
SUITE .vc .git_command (SUITE .dir , ["add" , header_dest , runtime_files_dest , test_files_dest ])
2041
2059
raw_input ("Check that the updated files look as intended, then press RETURN..." )
0 commit comments