@@ -87,20 +87,20 @@ def run_command(commands, args, cwd=None, verbose=False, hide_stderr=False,
8787 if e .errno == errno .ENOENT :
8888 continue
8989 if verbose :
90- print ("unable to run %s" % dispcmd )
90+ print (f "unable to run { dispcmd } " )
9191 print (e )
9292 return None , None
9393 else :
9494 if verbose :
95- print ("unable to find command, tried %s" % ( commands ,) )
95+ print (f "unable to find command, tried { commands } " )
9696 return None , None
9797 stdout = p .communicate ()[0 ].strip ()
9898 if sys .version_info [0 ] >= 3 :
9999 stdout = stdout .decode ()
100100 if p .returncode != 0 :
101101 if verbose :
102- print ("unable to run %s (error)" % dispcmd )
103- print ("stdout was %s" % stdout )
102+ print (f "unable to run { dispcmd } (error)" )
103+ print (f "stdout was { stdout } " )
104104 return None , p .returncode
105105 return stdout , p .returncode
106106
@@ -201,9 +201,9 @@ def git_versions_from_keywords(keywords, tag_prefix, verbose):
201201 # "stabilization", as well as "HEAD" and "master".
202202 tags = set ([r for r in refs if re .search (r'\d' , r )])
203203 if verbose :
204- print ("discarding '%s', no digits" % "," .join (refs - tags ))
204+ print (f "discarding '{ ',' .join (refs - tags )} ', no digits" )
205205 if verbose :
206- print ("likely tags: %s" % "," .join (sorted (tags )))
206+ print (f "likely tags: { ',' .join (sorted (tags ))} " )
207207 for ref in sorted (tags ):
208208 # sorting will prefer e.g. "2.0" over "2.0rc1"
209209 if ref .startswith (tag_prefix ):
@@ -214,7 +214,7 @@ def git_versions_from_keywords(keywords, tag_prefix, verbose):
214214 if not re .match (r'\d' , r ):
215215 continue
216216 if verbose :
217- print ("picking %s" % r )
217+ print (f "picking { r } " )
218218 return {"version" : r ,
219219 "full-revisionid" : keywords ["full" ].strip (),
220220 "dirty" : False , "error" : None ,
@@ -243,14 +243,14 @@ def git_pieces_from_vcs(tag_prefix, root, verbose, run_command=run_command):
243243 hide_stderr = True )
244244 if rc != 0 :
245245 if verbose :
246- print ("Directory %s not under git control" % root )
246+ print (f "Directory { root } not under git control" )
247247 raise NotThisMethod ("'git rev-parse --git-dir' returned error" )
248248
249249 # if there is a tag matching tag_prefix, this yields TAG-NUM-gHEX[-dirty]
250250 # if there isn't one, this yields HEX[-dirty] (no NUM)
251251 describe_out , rc = run_command (GITS , ["describe" , "--tags" , "--dirty" ,
252252 "--always" , "--long" ,
253- "--match" , "%s*" % tag_prefix ],
253+ "--match" , f" { tag_prefix } *" ],
254254 cwd = root )
255255 # --long was added in git-1.5.5
256256 if describe_out is None :
@@ -283,8 +283,7 @@ def git_pieces_from_vcs(tag_prefix, root, verbose, run_command=run_command):
283283 mo = re .search (r'^(.+)-(\d+)-g([0-9a-f]+)$' , git_describe )
284284 if not mo :
285285 # unparseable. Maybe git-describe is misbehaving?
286- pieces ["error" ] = ("unable to parse git-describe output: '%s'"
287- % describe_out )
286+ pieces ["error" ] = (f"unable to parse git-describe output: '{ describe_out } '" )
288287 return pieces
289288
290289 # tag
@@ -384,13 +383,13 @@ def render_pep440_post(pieces):
384383 if pieces ["dirty" ]:
385384 rendered += ".dev0"
386385 rendered += plus_or_dot (pieces )
387- rendered += "g%s" % pieces [" short" ]
386+ rendered += f"g { pieces [' short' ] } "
388387 else :
389388 # exception #1
390389 rendered = "0.post%d" % pieces ["distance" ]
391390 if pieces ["dirty" ]:
392391 rendered += ".dev0"
393- rendered += "+g%s" % pieces [" short" ]
392+ rendered += f "+g{ pieces [' short' ] } "
394393 return rendered
395394
396395
@@ -481,7 +480,7 @@ def render(pieces, style):
481480 elif style == "git-describe-long" :
482481 rendered = render_git_describe_long (pieces )
483482 else :
484- raise ValueError ("unknown style '%s'" % style )
483+ raise ValueError (f "unknown style '{ style } '" )
485484
486485 return {"version" : rendered , "full-revisionid" : pieces ["long" ],
487486 "dirty" : pieces ["dirty" ], "error" : None ,
0 commit comments