@@ -160,7 +160,7 @@ def arcname_from(name):
160160
161161 def add_string (self , filename , contents ):
162162 """Add given 'contents' as filename to the distribution."""
163- if sys . version_info [ 0 ] > 2 and isinstance (contents , str ):
163+ if isinstance (contents , str ):
164164 contents = contents .encode ("utf-8" , "surrogateescape" )
165165 zinfo = self ._zipinfo (filename )
166166 self .writestr (zinfo , contents )
@@ -199,7 +199,7 @@ def add_recordfile(self):
199199 entries = self ._record + [(record_path , b"" , b"" )]
200200 contents = b""
201201 for filename , digest , size in entries :
202- if sys . version_info [ 0 ] > 2 and isinstance (filename , str ):
202+ if isinstance (filename , str ):
203203 filename = filename .lstrip ("/" ).encode ("utf-8" , "surrogateescape" )
204204 contents += b"%s,%s,%s\n " % (filename , digest , size )
205205
@@ -530,22 +530,14 @@ def main() -> None:
530530
531531 description = None
532532 if arguments .description_file :
533- if sys .version_info [0 ] == 2 :
534- with open (arguments .description_file , "rt" ) as description_file :
535- description = description_file .read ()
536- else :
537- with open (
538- arguments .description_file , "rt" , encoding = "utf-8"
539- ) as description_file :
540- description = description_file .read ()
533+ with open (
534+ arguments .description_file , "rt" , encoding = "utf-8"
535+ ) as description_file :
536+ description = description_file .read ()
541537
542538 metadata = None
543- if sys .version_info [0 ] == 2 :
544- with open (arguments .metadata_file , "rt" ) as metadata_file :
545- metadata = metadata_file .read ()
546- else :
547- with open (arguments .metadata_file , "rt" , encoding = "utf-8" ) as metadata_file :
548- metadata = metadata_file .read ()
539+ with open (arguments .metadata_file , "rt" , encoding = "utf-8" ) as metadata_file :
540+ metadata = metadata_file .read ()
549541
550542 if arguments .noincompatible_normalize_version :
551543 version_in_metadata = version
0 commit comments