diff options
author | Joseph Brill <48932340+jcbrill@users.noreply.github.com> | 2023-12-28 22:35:29 (GMT) |
---|---|---|
committer | Joseph Brill <48932340+jcbrill@users.noreply.github.com> | 2023-12-28 22:35:29 (GMT) |
commit | 6827a03a4628f13fd79eaa14c24bf8df508d5aa0 (patch) | |
tree | b343158646fbc8a94981ec21a7fe82ca443f0e0b /testing | |
parent | f9b68fef9b08f4bcb523e7315595c23a8c64f4d9 (diff) | |
download | SCons-6827a03a4628f13fd79eaa14c24bf8df508d5aa0.zip SCons-6827a03a4628f13fd79eaa14c24bf8df508d5aa0.tar.gz SCons-6827a03a4628f13fd79eaa14c24bf8df508d5aa0.tar.bz2 |
Add unlink_files method to TestCmd, replace file deletion loops with method calls in msvs executable test scripts, re-order CHANGES.txt.
Diffstat (limited to 'testing')
-rw-r--r-- | testing/framework/TestCmd.py | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/testing/framework/TestCmd.py b/testing/framework/TestCmd.py index c207aa7..98094c8 100644 --- a/testing/framework/TestCmd.py +++ b/testing/framework/TestCmd.py @@ -1872,6 +1872,31 @@ class TestCmd: file = self.canonicalize(file) os.unlink(file) + def unlink_files(self, dirpath, files): + """Unlinks a list of file names from the specified directory. + + The directory path may be a list, in which case the elements are + concatenated with the os.path.join() method. + + A file name may be a list, in which case the elements are + concatenated with the os.path.join() method. + + The directory path and file name are concatenated with the + os.path.join() method. The resulting file path is assumed to be + under the temporary working directory unless it is an absolute path + name. An attempt to unlink the resulting file is made only when the + file exists otherwise the file path is ignored. + """ + if is_List(dirpath): + dirpath = os.path.join(*dirpath) + for file in files: + if is_List(file): + file = os.path.join(*file) + filepath = os.path.join(dirpath, file) + filepath = self.canonicalize(filepath) + if os.path.exists(filepath): + self.unlink(filepath) + def verbose_set(self, verbose) -> None: """Sets the verbose level.""" self.verbose = verbose |