@@ -126,7 +126,7 @@ def replace_in_nsis_file(fname, data):
126126 if line .startswith (start + ' ' ):
127127 lines [idx ] = (
128128 line [: len (start ) + 1 ]
129- + ( '"%s"' % text )
129+ + f'" { text } "'
130130 + '\n '
131131 )
132132 fd = open (fname , 'w' )
@@ -151,7 +151,7 @@ def replace_in_iss_file(fname, data):
151151 if line .startswith (start + ' ' ):
152152 lines [idx ] = (
153153 line [: len (start ) + 1 ]
154- + ( '"%s"' % text )
154+ + f'" { text } "'
155155 + '\n '
156156 )
157157 fd = open (fname , 'w' )
@@ -176,7 +176,7 @@ def replace_in_7zip_file(fname, data):
176176 if line .startswith (start + '=' ):
177177 lines [idx ] = (
178178 line [: len (start ) + 1 ]
179- + ( '%s' % text )
179+ + f' { text } '
180180 + '\n '
181181 )
182182 fd = open (fname , 'w' )
@@ -198,7 +198,7 @@ def build_nsis(srcname, dstname, data):
198198 replace_in_nsis_file (dstname , data )
199199 try :
200200 retcode = subprocess .call (
201- '"%s " -V2 "%s"' % ( NSIS_EXE , dstname ) ,
201+ f'" { NSIS_EXE } " -V2 "{ dstname } "' ,
202202 shell = True ,
203203 stdout = sys .stderr ,
204204 )
@@ -221,7 +221,7 @@ def build_iss(srcname, dstname, data):
221221 replace_in_iss_file (dstname , data )
222222 try :
223223 retcode = subprocess .call (
224- '"%s " "%s"' % ( ISCC_EXE , dstname ) ,
224+ f'" { ISCC_EXE } " "{ dstname } "' ,
225225 shell = True ,
226226 stdout = sys .stderr ,
227227 )
@@ -247,9 +247,9 @@ def build_7zip(srcname, dstname, data):
247247 replace_in_7zip_file (dstname , data )
248248 try :
249249 # insted of a 7zip command line, we launch a script that does it
250- # retcode = subprocess.call('"%s " "%s"' % (SEVENZIP_EXE, dstname ),
250+ # retcode = subprocess.call(f'"{SEVENZIP_EXE} " "{dstname}"' ),
251251 retcode = subprocess .call (
252- '"%s " ' % ( dstname ) ,
252+ f'" { dstname } " ' ,
253253 shell = True ,
254254 stdout = sys .stderr ,
255255 )
@@ -326,7 +326,7 @@ def __init__(
326326 self .python_name = Path (self .python_fname ).name [
327327 :- 4
328328 ]
329- self .distname = 'winUNKNOWN' #win%s' % self.python_name # PyPy ?
329+ self .distname = 'winUNKNOWN' # f'win{ self.python_name}' # PyPy ?
330330 #vlst = (
331331 # re.match(r'winpython-([0-9\.]*)', self.distname)
332332 # .groups()[0]
@@ -406,67 +406,46 @@ def get_tool_path_dir(relpath):
406406 metadata ['url' ],
407407 metadata ['description' ],
408408 )
409- tools += [
410- '[%s](%s) | %s | %s'
411- % (name , url , ver , desc )
412- ]
409+ tools += [f'[{ name } ]({ url } ) | { ver } | { desc } ' ]
413410 # get all packages installed in the changelog, whatever the method
414411 self .installed_packages = (
415412 self .distribution .get_installed_packages (update = True )
416413 )
417414
418415 packages = [
419- '[%s](%s) | %s | %s'
420- % (
421- pack .name ,
422- pack .url ,
423- pack .version ,
424- pack .description ,
425- )
416+ f'[{ pack .name } ]({ pack .url } ) | { pack .version } | { pack .description } '
426417 for pack in sorted (
427418 self .installed_packages ,
428419 key = lambda p : p .name .lower (),
429420 )
430421 ]
431422 python_desc = 'Python programming language with standard library'
432- return """## WinPython %s
423+ tools_f = '\n ' .join (tools )
424+ packages_f = '\n ' .join (packages )
425+ return f"""## WinPython { self .winpyver2 + self .flavor }
433426
434- The following packages are included in WinPython-%sbit v%s%s .
427+ The following packages are included in WinPython-{ self . winpy_arch } bit v { self . winpyver2 + self . flavor } { self . release_level } .
435428
436429<details>
437430
438431### Tools
439432
440433Name | Version | Description
441434-----|---------|------------
442- %s
435+ { tools_f }
443436
444437### Python packages
445438
446439Name | Version | Description
447440-----|---------|------------
448- [Python](http://www.python.org/) | %s | %s
449- %s""" % (
450- self .winpyver2 + self .flavor ,
451- self .winpy_arch ,
452- self .winpyver2 + self .flavor ,
453- (' %s' % self .release_level ),
454- '\n ' .join (tools ),
455- self .python_fullversion ,
456- python_desc ,
457- '\n ' .join (packages ),
458- ) + '\n \n </details>\n '
441+ [Python](http://www.python.org/) | { self .python_fullversion } | { python_desc }
442+ { packages_f } """ + '\n \n </details>\n '
459443
460444 # @property makes self.winpyver becomes a call to self.winpyver()
461445 @property
462446 def winpyver (self ):
463447 """Return WinPython version (with flavor and release level!)"""
464- return '%s.%d%s%s' % (
465- self .python_fullversion ,
466- self .build_number ,
467- self .flavor ,
468- self .release_level ,
469- )
448+ return f'{ self .python_fullversion } .{ self .build_number } { self .flavor } { self .release_level } '
470449
471450 @property
472451 def python_dir (self ):
@@ -476,7 +455,7 @@ def python_dir(self):
476455 @property
477456 def winpy_arch (self ):
478457 """Return WinPython architecture"""
479- return '%d' % self .distribution .architecture
458+ return f' { self .distribution .architecture } '
480459
481460 @property
482461 def py_arch (self ):
@@ -552,8 +531,7 @@ def get_package_fname(self, pattern):
552531 return str ((Path (path ) / fname ).resolve ())
553532 else :
554533 raise RuntimeError (
555- 'Could not find required package matching %s'
556- % pattern
534+ f'Could not find required package matching { pattern } '
557535 )
558536
559537 def create_batch_script (self , name , contents ,
@@ -601,7 +579,7 @@ def create_launcher(
601579 fname = str (Path (self .winpydir ) / (Path (name ).stem + '.nsi' ))
602580
603581 data = [
604- ('WINPYDIR' , '$EXEDIR\%s' % self .python_name ),
582+ ('WINPYDIR' , f '$EXEDIR\{ self .python_name } ' ),
605583 ('WINPYVER' , self .winpyver ),
606584 ('COMMAND' , command ),
607585 ('PARAMETERS' , args ),
@@ -662,22 +640,12 @@ def create_installer(self):
662640 ('ARCH' , self .winpy_arch ),
663641 (
664642 'VERSION' ,
665- '%s.%d%s'
666- % (
667- self .python_fullversion ,
668- self .build_number ,
669- self .flavor ,
670- ),
643+ f'{ self .python_fullversion } .{ self .build_number } { self .flavor } ' ,
671644 ),
672645 (
673646 'VERSION_INSTALL' ,
674- '%s%d'
675- % (
676- self .python_fullversion .replace (
677- '.' , ''
678- ),
679- self .build_number ,
680- ),
647+ f'{ self .python_fullversion .replace ("." , "" )} ' +
648+ f'{ self .build_number } ' ,
681649 ),
682650 ('RELEASELEVEL' , self .release_level ),
683651 )
@@ -694,22 +662,12 @@ def create_installer_inno(self):
694662 ('ARCH' , self .winpy_arch ),
695663 (
696664 'VERSION' ,
697- '%s.%d%s'
698- % (
699- self .python_fullversion ,
700- self .build_number ,
701- self .flavor ,
702- ),
665+ f'{ self .python_fullversion } .{ self .build_number } { self .flavor } ' ,
703666 ),
704667 (
705668 'VERSION_INSTALL' ,
706- '%s%d'
707- % (
708- self .python_fullversion .replace (
709- '.' , ''
710- ),
711- self .build_number ,
712- ),
669+ f'{ self .python_fullversion .replace ("." , "" )} ' +
670+ f'{ self .build_number } ' ,
713671 ),
714672 ('RELEASELEVEL' , self .release_level ),
715673 )
@@ -726,22 +684,12 @@ def create_installer_7zip(self, installer_option=''):
726684 ('ARCH' , self .winpy_arch ),
727685 (
728686 'VERSION' ,
729- '%s.%d%s'
730- % (
731- self .python_fullversion ,
732- self .build_number ,
733- self .flavor ,
734- ),
687+ f'{ self .python_fullversion } .{ self .build_number } { self .flavor } ' ,
735688 ),
736689 (
737690 'VERSION_INSTALL' ,
738- '%s%d'
739- % (
740- self .python_fullversion .replace (
741- '.' , ''
742- ),
743- self .build_number ,
744- ),
691+ f'{ self .python_fullversion .replace ("." , "" )} ' +
692+ f'{ self .build_number } ' ,
745693 ),
746694 ('RELEASELEVEL' , self .release_level ),
747695 )
@@ -1974,24 +1922,17 @@ def _run_complement_batch_scripts(
19741922 self , this_batch = "run_complement.bat"
19751923 ):
19761924 """ tools\..\r un_complement.bat for final complements"""
1977- print ('now %s in tooldirs\..' % this_batch )
1925+ print (f 'now { this_batch } in tooldirs\..' )
19781926 for post_complement in list (
19791927 set ([str (Path (s ).parent ) for s in self ._toolsdirs ])
19801928 ):
19811929 filepath = str (Path (post_complement ) / this_batch )
19821930 if Path (filepath ).is_file ():
1983- print (
1984- 'launch "%s" for "%s"'
1985- % (filepath , self .winpydir )
1986- )
1987- self ._print (
1988- 'launch "%s" for "%s" !'
1989- % (filepath , self .winpydir )
1990- )
1931+ print (f'launch "{ filepath } " for "{ self .winpydir } "' )
1932+ self ._print (f'launch "{ filepath } " for "{ self .winpydir } " !' )
19911933 try :
19921934 retcode = subprocess .call (
1993- '"%s" "%s"'
1994- % (filepath , self .winpydir ),
1935+ f'"{ filepath } " "{ self .winpydir } "' ,
19951936 shell = True ,
19961937 stdout = sys .stderr ,
19971938 )
@@ -2046,10 +1987,7 @@ def make(
20461987 self .winpydir = str (Path (self .target ) / self .distname ) # PyPy to delete
20471988 else :
20481989 self .winpydir = str (Path (self .target ) / my_winpydir ) # Create/re-create the WinPython base directory
2049- self ._print (
2050- "Creating WinPython %s base directory"
2051- % my_winpydir
2052- )
1990+ self ._print (f"Creating WinPython { my_winpydir } base directory" )
20531991 if (
20541992 Path (self .winpydir ).is_dir ()
20551993 and remove_existing
@@ -2111,8 +2049,8 @@ def make(
21112049 actions = ["install" , "--upgrade" , "--pre" , req ]
21122050 if self .install_options is not None :
21132051 actions += self .install_options
2114- print ("piping %s" % ' ' .join (actions ))
2115- self ._print ("piping %s" % ' ' .join (actions ))
2052+ print (f "piping { ' ' .join (actions )} " )
2053+ self ._print (f "piping { ' ' .join (actions )} " )
21162054 self .distribution .do_pip_action (actions )
21172055 self .distribution .patch_standard_packages (
21182056 req
@@ -2132,10 +2070,8 @@ def make(
21322070 actions = ["install" , "-r" , req ]
21332071 if self .install_options is not None :
21342072 actions += self .install_options
2135- print ("piping %s" % ' ' .join (actions ))
2136- self ._print (
2137- "piping %s" % ' ' .join (actions )
2138- )
2073+ print (f"piping { ' ' .join (actions )} " )
2074+ self ._print (f"piping { ' ' .join (actions )} " )
21392075 self .distribution .do_pip_action (actions )
21402076 # actions=["install","-r", req, "--no-index",
21412077 # "--trusted-host=None"]+ links,
@@ -2150,10 +2086,7 @@ def make(
21502086 self ._print ("Writing package index" )
21512087 # winpyver2 = need the version without build part
21522088 # but with self.distribution.architecture
2153- self .winpyver2 = '%s.%s' % (
2154- self .python_fullversion ,
2155- self .build_number ,
2156- )
2089+ self .winpyver2 = f'{ self .python_fullversion } .{ self .build_number } '
21572090 fname = str (Path (self .winpydir ).parent / (
21582091 f'WinPython{ self .flavor } -' +
21592092 f'{ self .distribution .architecture } bit-' +
@@ -2248,8 +2181,8 @@ def make_all(
22482181 ), "The *basedir* directory must be specified"
22492182 assert architecture in (32 , 64 )
22502183 utils .print_box (
2251- "Making WinPython %dbits at %s" % ( architecture ,
2252- str ( Path (basedir ) / ('bu' + flavor ))) )
2184+ f "Making WinPython { architecture } bits" +
2185+ f" at { Path (basedir ) / ('bu' + flavor )} " )
22532186
22542187 # Create Build director, where Winpython will be constructed
22552188 builddir = str (Path (basedir ) / ('bu' + flavor ) )
@@ -2273,15 +2206,15 @@ def make_all(
22732206 docsdirs = transform_in_list (docsdirs , 'docsdirs=' )
22742207 print ('docsdirs output' , docsdirs )
22752208
2276- # install_options = ['--no-index', '--pre', '--find-links=%s' % wheeldir]
2209+ # install_options = ['--no-index', '--pre', f '--find-links={ wheeldir)' ]
22772210 install_options = transform_in_list (
22782211 install_options , 'install_options'
22792212 )
22802213
22812214 find_links = transform_in_list (find_links , 'find_links' )
22822215
22832216 find_list = [
2284- '--find-links=%s' % l
2217+ f '--find-links={ l } '
22852218 for l in find_links + [wheeldir ]
22862219 ]
22872220 dist = WinPythonDistribution (
@@ -2312,23 +2245,23 @@ def make_all(
23122245 if not python_target_release == None :
23132246 my_winpydir = (
23142247 'WPy'
2315- + ( '%s' % architecture )
2248+ + f' { architecture } '
23162249 + '-'
23172250 + python_target_release
23182251 + ''
2319- + ( '%s' % build_number )
2252+ + f' { build_number } '
23202253 ) + release_level
23212254 # + flavor
23222255 else :
23232256 my_winpydir = (
23242257 'WPy'
2325- + ( '%s' % architecture )
2258+ + f' { architecture } '
23262259 + '-'
23272260 + pyver .replace ('.' , '' )
23282261 + ''
23292262 + my_x
23302263 + ''
2331- + ( '%s' % build_number )
2264+ + f' { build_number } '
23322265 ) + release_level
23332266 # + flavor
23342267
0 commit comments