@@ -1023,12 +1023,11 @@ def install_exe(self, dist_filename, tmpdir):
1023
1023
1024
1024
# Write EGG-INFO/PKG-INFO
1025
1025
if not os .path .exists (pkg_inf ):
1026
- f = open (pkg_inf , 'w' ) # TODO: probably it is safe to use utf-8
1027
- f .write ('Metadata-Version: 1.0\n ' )
1028
- for k , v in cfg .items ('metadata' ):
1029
- if k != 'target_version' :
1030
- f .write ('%s: %s\n ' % (k .replace ('_' , '-' ).title (), v ))
1031
- f .close ()
1026
+ with open (pkg_inf , 'w' , encoding = "utf-8" ) as f :
1027
+ f .write ('Metadata-Version: 1.0\n ' )
1028
+ for k , v in cfg .items ('metadata' ):
1029
+ if k != 'target_version' :
1030
+ f .write ('%s: %s\n ' % (k .replace ('_' , '-' ).title (), v ))
1032
1031
script_dir = os .path .join (_egg_info , 'scripts' )
1033
1032
# delete entry-point scripts to avoid duping
1034
1033
self .delete_blockers ([
@@ -1094,9 +1093,8 @@ def process(src, dst):
1094
1093
if locals ()[name ]:
1095
1094
txt = os .path .join (egg_tmp , 'EGG-INFO' , name + '.txt' )
1096
1095
if not os .path .exists (txt ):
1097
- f = open (txt , 'w' ) # TODO: probably it is safe to use utf-8
1098
- f .write ('\n ' .join (locals ()[name ]) + '\n ' )
1099
- f .close ()
1096
+ with open (txt , 'w' , encoding = "utf-8" ) as f :
1097
+ f .write ('\n ' .join (locals ()[name ]) + '\n ' )
1100
1098
1101
1099
def install_wheel (self , wheel_path , tmpdir ):
1102
1100
wheel = Wheel (wheel_path )
0 commit comments