@@ -87,20 +87,20 @@ def run_command(commands, args, cwd=None, verbose=False, hide_stderr=False,
87
87
if e .errno == errno .ENOENT :
88
88
continue
89
89
if verbose :
90
- print (f "unable to run { dispcmd } " )
90
+ print ("unable to run %s" % dispcmd )
91
91
print (e )
92
92
return None , None
93
93
else :
94
94
if verbose :
95
- print (f "unable to find command, tried { commands } " )
95
+ print ("unable to find command, tried %s" % ( commands ,) )
96
96
return None , None
97
97
stdout = p .communicate ()[0 ].strip ()
98
98
if sys .version_info [0 ] >= 3 :
99
99
stdout = stdout .decode ()
100
100
if p .returncode != 0 :
101
101
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 )
104
104
return None , p .returncode
105
105
return stdout , p .returncode
106
106
@@ -125,8 +125,8 @@ def versions_from_parentdir(parentdir_prefix, root, verbose):
125
125
root = os .path .dirname (root ) # up a level
126
126
127
127
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 ) )
130
130
raise NotThisMethod ("rootdir doesn't start with parentdir_prefix" )
131
131
132
132
@@ -201,9 +201,9 @@ def git_versions_from_keywords(keywords, tag_prefix, verbose):
201
201
# "stabilization", as well as "HEAD" and "master".
202
202
tags = set ([r for r in refs if re .search (r'\d' , r )])
203
203
if verbose :
204
- print (f "discarding '{ ',' .join (refs - tags )} ', no digits" )
204
+ print ("discarding '%s', no digits" % "," .join (refs - tags ))
205
205
if verbose :
206
- print (f "likely tags: { ',' .join (sorted (tags ))} " )
206
+ print ("likely tags: %s" % "," .join (sorted (tags )))
207
207
for ref in sorted (tags ):
208
208
# sorting will prefer e.g. "2.0" over "2.0rc1"
209
209
if ref .startswith (tag_prefix ):
@@ -214,7 +214,7 @@ def git_versions_from_keywords(keywords, tag_prefix, verbose):
214
214
if not re .match (r'\d' , r ):
215
215
continue
216
216
if verbose :
217
- print (f "picking { r } " )
217
+ print ("picking %s" % r )
218
218
return {"version" : r ,
219
219
"full-revisionid" : keywords ["full" ].strip (),
220
220
"dirty" : False , "error" : None ,
@@ -243,14 +243,14 @@ def git_pieces_from_vcs(tag_prefix, root, verbose, run_command=run_command):
243
243
hide_stderr = True )
244
244
if rc != 0 :
245
245
if verbose :
246
- print (f "Directory { root } not under git control" )
246
+ print ("Directory %s not under git control" % root )
247
247
raise NotThisMethod ("'git rev-parse --git-dir' returned error" )
248
248
249
249
# if there is a tag matching tag_prefix, this yields TAG-NUM-gHEX[-dirty]
250
250
# if there isn't one, this yields HEX[-dirty] (no NUM)
251
251
describe_out , rc = run_command (GITS , ["describe" , "--tags" , "--dirty" ,
252
252
"--always" , "--long" ,
253
- "--match" , f" { tag_prefix } *" ],
253
+ "--match" , "%s*" % tag_prefix ],
254
254
cwd = root )
255
255
# --long was added in git-1.5.5
256
256
if describe_out is None :
@@ -283,17 +283,18 @@ def git_pieces_from_vcs(tag_prefix, root, verbose, run_command=run_command):
283
283
mo = re .search (r'^(.+)-(\d+)-g([0-9a-f]+)$' , git_describe )
284
284
if not mo :
285
285
# 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 )
287
288
return pieces
288
289
289
290
# tag
290
291
full_tag = mo .group (1 )
291
292
if not full_tag .startswith (tag_prefix ):
292
293
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 ) )
297
298
return pieces
298
299
pieces ["closest-tag" ] = full_tag [len (tag_prefix ):]
299
300
@@ -383,13 +384,13 @@ def render_pep440_post(pieces):
383
384
if pieces ["dirty" ]:
384
385
rendered += ".dev0"
385
386
rendered += plus_or_dot (pieces )
386
- rendered += f"g { pieces [' short' ] } "
387
+ rendered += "g%s" % pieces [" short" ]
387
388
else :
388
389
# exception #1
389
390
rendered = "0.post%d" % pieces ["distance" ]
390
391
if pieces ["dirty" ]:
391
392
rendered += ".dev0"
392
- rendered += f "+g{ pieces [' short' ] } "
393
+ rendered += "+g%s" % pieces [" short" ]
393
394
return rendered
394
395
395
396
@@ -480,7 +481,7 @@ def render(pieces, style):
480
481
elif style == "git-describe-long" :
481
482
rendered = render_git_describe_long (pieces )
482
483
else :
483
- raise ValueError (f "unknown style '{ style } '" )
484
+ raise ValueError ("unknown style '%s'" % style )
484
485
485
486
return {"version" : rendered , "full-revisionid" : pieces ["long" ],
486
487
"dirty" : pieces ["dirty" ], "error" : None ,
0 commit comments