@@ -74,7 +74,7 @@ def prepend_module_to_path(module_path):
74
74
name = Path (module_path ).name
75
75
prefix = "Prepending module to sys.path"
76
76
message = prefix + (
77
- "%s [revision %s]" % ( name , changeset )
77
+ f" { name } [revision { changeset } ]"
78
78
).rjust (80 - len (prefix ), "." )
79
79
print (message , file = sys .stderr )
80
80
if name in sys .modules :
@@ -84,9 +84,9 @@ def prepend_module_to_path(module_path):
84
84
if modname .startswith (name + '.' ):
85
85
sys .modules .pop (modname )
86
86
nbsp += 1
87
- warning = '(removed %s from sys.modules' % name
87
+ warning = f '(removed { name } from sys.modules'
88
88
if nbsp :
89
- warning += ' and %d subpackages' % nbsp
89
+ warning += f ' and { nbsp } subpackages'
90
90
warning += ')'
91
91
print (warning .rjust (80 ), file = sys .stderr )
92
92
return message
@@ -157,7 +157,7 @@ def strip_version(version):
157
157
def remove_dir (dirname ):
158
158
"""Remove directory *dirname* and all its contents
159
159
Print details about the operation (progress, success/failure)"""
160
- print ("Removing directory '%s '..." % dirname , end = ' ' )
160
+ print (f "Removing directory '{ dirname } '..." , end = ' ' )
161
161
try :
162
162
shutil .rmtree (dirname , ignore_errors = True )
163
163
print ("OK" )
@@ -530,7 +530,7 @@ def add_matplotlib(self):
530
530
def add_modules (self , * module_names ):
531
531
"""Include module *module_name*"""
532
532
for module_name in module_names :
533
- print ("Configuring module '%s'" % module_name )
533
+ print (f "Configuring module '{ module_name } '" )
534
534
if module_name == 'PyQt4' :
535
535
self .add_pyqt4 ()
536
536
elif module_name == 'PySide' :
@@ -552,7 +552,7 @@ def add_modules(self, *module_names):
552
552
]:
553
553
if hasattr (h5py , attr ):
554
554
self .includes .append (
555
- 'h5py.%s' % attr
555
+ f 'h5py.{ attr } '
556
556
)
557
557
if (
558
558
self .bin_path_excludes is not None
@@ -598,8 +598,7 @@ def add_modules(self, *module_names):
598
598
):
599
599
if Path (fname ).suffix == '.py' :
600
600
modname = (
601
- 'sphinx.ext.%s'
602
- % Path (fname ).stem
601
+ f'sphinx.ext.{ Path (fname ).stem } '
603
602
)
604
603
self .includes .append (modname )
605
604
elif module_name == 'pygments' :
@@ -661,8 +660,7 @@ def add_modules(self, *module_names):
661
660
)
662
661
except IOError :
663
662
raise RuntimeError (
664
- "Module not supported: %s"
665
- % module_name
663
+ f"Module not supported: { module_name } "
666
664
)
667
665
668
666
def add_module_data_dir (
@@ -684,7 +682,7 @@ def add_module_data_dir(
684
682
data_dir = str (Path (module_dir ) / data_dir_name )
685
683
if not Path (data_dir ).is_dir ():
686
684
raise IOError (
687
- "Directory not found: %s" % data_dir
685
+ f "Directory not found: { data_dir } "
688
686
)
689
687
for dirpath , _dirnames , filenames in os .walk (
690
688
data_dir
@@ -719,12 +717,7 @@ def add_module_data_files(
719
717
*extensions*: list of file extensions, e.g. ('.png', '.svg')
720
718
"""
721
719
print (
722
- "Adding module '%s' data files in %s (%s)"
723
- % (
724
- module_name ,
725
- ", " .join (data_dir_names ),
726
- ", " .join (extensions ),
727
- )
720
+ f"Adding module '{ module_name } ' data files in { ', ' .join (data_dir_names )} ({ ', ' .join (extensions )} )"
728
721
)
729
722
module_dir = get_module_path (module_name )
730
723
for data_dir_name in data_dir_names :
@@ -750,11 +743,7 @@ def add_module_data_files(
750
743
)
751
744
)
752
745
print (
753
- "Adding module '%s' translation file: %s"
754
- % (
755
- module_name ,
756
- Path (translation_file ).name ,
757
- )
746
+ f"Adding module '{ module_name } ' translation file: { Path (translation_file ).name } "
758
747
)
759
748
760
749
def build (
@@ -785,7 +774,7 @@ def build(
785
774
)
786
775
else :
787
776
raise RuntimeError (
788
- "Unsupported library %s" % library
777
+ f "Unsupported library { library } "
789
778
)
790
779
791
780
def __cleanup (self ):
@@ -803,7 +792,7 @@ def __create_archive(self, option):
803
792
* 'move': move target directory to a ZIP archive
804
793
"""
805
794
name = self .target_dir
806
- os .system ('zip "%s .zip" -r "%s"' % ( name , name ) )
795
+ os .system (f 'zip "{ name } .zip" -r "{ name } "' )
807
796
if option == 'move' :
808
797
shutil .rmtree (name )
809
798
0 commit comments