@@ -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 (f "unable to run { dispcmd } " )
90+ print ("unable to run %s" % dispcmd )
9191 print (e )
9292 return None , None
9393 else :
9494 if verbose :
95- print (f "unable to find command, tried { commands } " )
95+ print ("unable to find command, tried %s" % ( 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 (f "unable to run { dispcmd } (error)" )
103- print (f "stdout was { stdout } " )
102+ print ("unable to run %s (error)" % dispcmd )
103+ print ("stdout was %s" % stdout )
104104 return None , p .returncode
105105 return stdout , p .returncode
106106
@@ -125,8 +125,8 @@ def versions_from_parentdir(parentdir_prefix, root, verbose):
125125 root = os .path .dirname (root ) # up a level
126126
127127 if verbose :
128- print (f "Tried directories { str ( rootdirs ) } but "
129- f"none started with prefix { parentdir_prefix } " )
128+ print ("Tried directories %s but none started with prefix %s" %
129+ ( str ( rootdirs ), parentdir_prefix ) )
130130 raise NotThisMethod ("rootdir doesn't start with parentdir_prefix" )
131131
132132
@@ -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 (f "discarding '{ ',' .join (refs - tags )} ', no digits" )
204+ print ("discarding '%s', no digits" % "," .join (refs - tags ))
205205 if verbose :
206- print (f "likely tags: { ',' .join (sorted (tags ))} " )
206+ print ("likely tags: %s" % "," .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 (f "picking { r } " )
217+ print ("picking %s" % 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 (f "Directory { root } not under git control" )
246+ print ("Directory %s not under git control" % root )
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" , f" { tag_prefix } *" ],
253+ "--match" , "%s*" % tag_prefix ],
254254 cwd = root )
255255 # --long was added in git-1.5.5
256256 if describe_out is None :
@@ -283,17 +283,18 @@ 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" ] = f"unable to parse git-describe output: '{ describe_out } '"
286+ pieces ["error" ] = ("unable to parse git-describe output: '%s'"
287+ % describe_out )
287288 return pieces
288289
289290 # tag
290291 full_tag = mo .group (1 )
291292 if not full_tag .startswith (tag_prefix ):
292293 if verbose :
293- txt = f "tag '{ full_tag } ' doesn't start with prefix '{ tag_prefix } '"
294- print (txt )
295- pieces ["error" ] = (f "tag '{ full_tag } ' doesn't start with prefix "
296- f"' { tag_prefix } '" )
294+ fmt = "tag '%s ' doesn't start with prefix '%s '"
295+ print (fmt % ( full_tag , tag_prefix ) )
296+ pieces ["error" ] = ("tag '%s ' doesn't start with prefix '%s' "
297+ % ( full_tag , tag_prefix ) )
297298 return pieces
298299 pieces ["closest-tag" ] = full_tag [len (tag_prefix ):]
299300
@@ -383,13 +384,13 @@ def render_pep440_post(pieces):
383384 if pieces ["dirty" ]:
384385 rendered += ".dev0"
385386 rendered += plus_or_dot (pieces )
386- rendered += f"g { pieces [' short' ] } "
387+ rendered += "g%s" % pieces [" short" ]
387388 else :
388389 # exception #1
389390 rendered = "0.post%d" % pieces ["distance" ]
390391 if pieces ["dirty" ]:
391392 rendered += ".dev0"
392- rendered += f "+g{ pieces [' short' ] } "
393+ rendered += "+g%s" % pieces [" short" ]
393394 return rendered
394395
395396
@@ -480,7 +481,7 @@ def render(pieces, style):
480481 elif style == "git-describe-long" :
481482 rendered = render_git_describe_long (pieces )
482483 else :
483- raise ValueError (f "unknown style '{ style } '" )
484+ raise ValueError ("unknown style '%s'" % style )
484485
485486 return {"version" : rendered , "full-revisionid" : pieces ["long" ],
486487 "dirty" : pieces ["dirty" ], "error" : None ,
0 commit comments