@@ -2019,54 +2019,55 @@ def import_files(from_dir, to_dir):
20192019 dest_file = join (to_dir , relative_dir_path , filename )
20202020 import_file (src_file , dest_file )
20212021
2022- def remove_inexisting_file (src_file , dest_file ):
2022+ def remove_inexistent_file (src_file , dest_file ):
20232023 if not os .path .exists (dest_file ):
20242024 mx .logv ("Removing file {} since {} does not exist" .format (src_file , dest_file ))
20252025 vc .git_command (SUITE .dir , ["rm" , src_file ])
20262026
2027- def remove_inexisting_files (hpy_dir , our_dir ):
2027+ def remove_inexistent_files (hpy_dir , our_dir ):
20282028 mx .log ("Looking for removed files in {} (HPy reference dir {})" .format (our_dir , hpy_dir ))
20292029 for dirpath , _ , filenames in os .walk (our_dir ):
20302030 relative_dir_path = os .path .relpath (dirpath , start = our_dir )
20312031 for filename in filenames :
20322032 src_file = join (dirpath , filename )
20332033 dest_file = join (hpy_dir , relative_dir_path , filename )
2034- remove_inexisting_file (src_file , dest_file )
2034+ remove_inexistent_file (src_file , dest_file )
20352035
20362036 # headers go into 'com.oracle.graal.python.cext/include'
20372037 header_dest = join (mx .dependency ("com.oracle.graal.python.cext" ).dir , "include" )
20382038
20392039 # copy headers from .../hpy/hpy/devel/include' to 'header_dest'
20402040 # but exclude subdir 'cpython' (since that's only for CPython)
20412041 import_files (hpy_repo_include_dir , header_dest )
2042- remove_inexisting_files (hpy_repo_include_dir , header_dest )
2042+ remove_inexistent_files (hpy_repo_include_dir , header_dest )
20432043
20442044 # runtime sources go into 'lib-graalpython/module/hpy/devel/src'
20452045 runtime_files_dest = join (_get_core_home (), "modules" , "hpy" , "devel" , "src" )
20462046 import_files (hpy_repo_runtime_dir , runtime_files_dest )
2047- remove_inexisting_files (hpy_repo_runtime_dir , runtime_files_dest )
2047+ remove_inexistent_files (hpy_repo_runtime_dir , runtime_files_dest )
20482048
20492049 # tests go to 'lib-graalpython/module/hpy/tests'
20502050 test_files_dest = _hpy_test_root ()
20512051 import_files (hpy_repo_test_dir , test_files_dest )
2052- remove_inexisting_files (hpy_repo_test_dir , test_files_dest )
2052+ remove_inexistent_files (hpy_repo_test_dir , test_files_dest )
20532053
20542054 # 'version.py' goes to 'lib-graalpython/module/hpy/devel/'
20552055 dest_version_file = join (_get_core_home (), "modules" , "hpy" , "devel" , "version.py" )
20562056 import_file (join (hpy_repo_path , "hpy" , "devel" , "version.py" ), dest_version_file )
20572057
2058- # read version from 'version.py'
2059- with open (dest_version_file , "r" ) as f :
2060- dummy_globals = {}
2061- exec (f .read (), dummy_globals )
2062- imported_version = dummy_globals ["__version__" ]
2058+ # import 'version.py' by path and read '__version__'
2059+ from importlib import util
2060+ spec = util .spec_from_file_location ("version" , dest_version_file )
2061+ version_module = util .module_from_spec (spec )
2062+ spec .loader .exec_module (version_module )
2063+ imported_version = version_module .__version__
20632064
20642065 SUITE .vc .git_command (SUITE .dir , ["add" , header_dest , runtime_files_dest , test_files_dest ])
20652066 raw_input ("Check that the updated files look as intended, then press RETURN..." )
20662067 SUITE .vc .commit (SUITE .dir , "Update HPy inlined files: %s" % import_version )
20672068 SUITE .vc .git_command (SUITE .dir , ["checkout" , "-" ])
20682069 SUITE .vc .git_command (SUITE .dir , ["merge" , HPY_IMPORT_ORPHAN_BRANCH_NAME ])
2069-
2070+
20702071 # update PKG-INFO version
20712072 pkg_info_file = join (_get_core_home (), "modules" , "hpy.devel.egg-info" , "PKG-INFO" )
20722073 with open (pkg_info_file , "w" ) as f :
0 commit comments