diff options
author | Joseph Brill <48932340+jcbrill@users.noreply.github.com> | 2023-12-29 01:35:29 +0300 |
---|---|---|
committer | Joseph Brill <48932340+jcbrill@users.noreply.github.com> | 2023-12-29 01:35:29 +0300 |
commit | 6827a03a4628f13fd79eaa14c24bf8df508d5aa0 (patch) | |
tree | b343158646fbc8a94981ec21a7fe82ca443f0e0b | |
parent | f9b68fef9b08f4bcb523e7315595c23a8c64f4d9 (diff) |
Add unlink_files method to TestCmd, replace file deletion loops with method calls in msvs executable test scripts, re-order CHANGES.txt.
-rw-r--r-- | CHANGES.txt | 11 | ||||
-rw-r--r-- | RELEASE.txt | 5 | ||||
-rw-r--r-- | test/MSVS/vs-10.0-exec.py | 5 | ||||
-rw-r--r-- | test/MSVS/vs-10.0Exp-exec.py | 5 | ||||
-rw-r--r-- | test/MSVS/vs-11.0-exec.py | 5 | ||||
-rw-r--r-- | test/MSVS/vs-11.0Exp-exec.py | 5 | ||||
-rw-r--r-- | test/MSVS/vs-14.0-exec.py | 5 | ||||
-rw-r--r-- | test/MSVS/vs-14.0Exp-exec.py | 5 | ||||
-rw-r--r-- | test/MSVS/vs-14.1-exec.py | 5 | ||||
-rw-r--r-- | test/MSVS/vs-14.2-exec.py | 5 | ||||
-rw-r--r-- | test/MSVS/vs-14.3-exec.py | 5 | ||||
-rw-r--r-- | test/MSVS/vs-6.0-exec.py | 5 | ||||
-rw-r--r-- | test/MSVS/vs-7.0-exec.py | 5 | ||||
-rw-r--r-- | test/MSVS/vs-7.1-exec.py | 5 | ||||
-rw-r--r-- | test/MSVS/vs-8.0-exec.py | 5 | ||||
-rw-r--r-- | test/MSVS/vs-8.0Exp-exec.py | 5 | ||||
-rw-r--r-- | test/MSVS/vs-9.0-exec.py | 5 | ||||
-rw-r--r-- | test/MSVS/vs-9.0Exp-exec.py | 5 | ||||
-rw-r--r-- | testing/framework/TestCmd.py | 25 |
19 files changed, 52 insertions, 69 deletions
diff --git a/CHANGES.txt b/CHANGES.txt index 40c2d7ceb..8d63f8923 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -9,6 +9,10 @@ NOTE: 4.3.0 now requires Python 3.6.0 and above. Python 3.5.x is no longer suppo RELEASE VERSION/DATE TO BE FILLED IN LATER + From Ataf Fazledin Ahamed: + - Use of NotImplemented instead of NotImplementedError for special methods + of _ListVariable class + From Joseph Brill: - Fix issue #2755: the msvs tool no longer writes the OS environment SCONS_HOME value into the SCons environment when the SCONS_HOME variable already exists @@ -32,6 +36,9 @@ RELEASE VERSION/DATE TO BE FILLED IN LATER build. The tests were modified to delete the test executable, object file, and sconsign file prior to the command-line invocation of the VS development binary. + - A method, unlink_files, was added to the TestCmd class that unlinks a list of + files from a specified directory. An attempt to unlink a file is made only when + the file exists, otherwise, the file is ignored. From Michał Górny: - Remove unecessary dependencies on pypi packages from setup.cfg @@ -40,10 +47,6 @@ RELEASE VERSION/DATE TO BE FILLED IN LATER - Fix of the --debug=sconscript option to return exist statements when using return statement with stop flag enabled - From Ataf Fazledin Ahamed: - - Use of NotImplemented instead of NotImplementedError for special methods - of _ListVariable class - RELEASE 4.6.0 - Sun, 19 Nov 2023 17:22:20 -0700 From Max Bachmann: diff --git a/RELEASE.txt b/RELEASE.txt index b5e732e13..b4478ef68 100644 --- a/RELEASE.txt +++ b/RELEASE.txt @@ -16,7 +16,10 @@ Here is a summary of the changes since 4.6.0: NEW FUNCTIONALITY ----------------- -- List new features (presumably why a checkpoint is being released) +- A method, unlink_files, was added to the TestCmd class that unlinks a list of + files from a specified directory. An attempt to unlink a file is made only when + the file exists, otherwise, the file is ignored. + DEPRECATED FUNCTIONALITY ------------------------ diff --git a/test/MSVS/vs-10.0-exec.py b/test/MSVS/vs-10.0-exec.py index d439437a6..cf140a26e 100644 --- a/test/MSVS/vs-10.0-exec.py +++ b/test/MSVS/vs-10.0-exec.py @@ -90,10 +90,7 @@ main(int argc, char *argv) test.run(chdir='sub dir', arguments='.') -for filename in ('foo.exe', 'foo.obj', '.sconsign.dblite'): - filepath = test.workpath('sub dir', filename) - if os.path.exists(filepath): - test.unlink(filepath) +test.unlink_files('sub dir', ['foo.exe', 'foo.obj', '.sconsign.dblite']) test.vcproj_sys_path(test.workpath('sub dir', 'foo.vcxproj')) diff --git a/test/MSVS/vs-10.0Exp-exec.py b/test/MSVS/vs-10.0Exp-exec.py index f0b0881df..87ddf29ce 100644 --- a/test/MSVS/vs-10.0Exp-exec.py +++ b/test/MSVS/vs-10.0Exp-exec.py @@ -91,10 +91,7 @@ main(int argc, char *argv) test.run(chdir='sub dir', arguments='.') -for filename in ('foo.exe', 'foo.obj', '.sconsign.dblite'): - filepath = test.workpath('sub dir', filename) - if os.path.exists(filepath): - test.unlink(filepath) +test.unlink_files('sub dir', ['foo.exe', 'foo.obj', '.sconsign.dblite']) test.vcproj_sys_path(test.workpath('sub dir', 'foo.vcxproj')) diff --git a/test/MSVS/vs-11.0-exec.py b/test/MSVS/vs-11.0-exec.py index f2dfe8e45..27dd79460 100644 --- a/test/MSVS/vs-11.0-exec.py +++ b/test/MSVS/vs-11.0-exec.py @@ -91,10 +91,7 @@ main(int argc, char *argv) test.run(chdir='sub dir', arguments='.') -for filename in ('foo.exe', 'foo.obj', '.sconsign.dblite'): - filepath = test.workpath('sub dir', filename) - if os.path.exists(filepath): - test.unlink(filepath) +test.unlink_files('sub dir', ['foo.exe', 'foo.obj', '.sconsign.dblite']) test.vcproj_sys_path(test.workpath('sub dir', 'foo.vcxproj')) diff --git a/test/MSVS/vs-11.0Exp-exec.py b/test/MSVS/vs-11.0Exp-exec.py index b16f870a3..385a50dfc 100644 --- a/test/MSVS/vs-11.0Exp-exec.py +++ b/test/MSVS/vs-11.0Exp-exec.py @@ -91,10 +91,7 @@ main(int argc, char *argv) test.run(chdir='sub dir', arguments='.') -for filename in ('foo.exe', 'foo.obj', '.sconsign.dblite'): - filepath = test.workpath('sub dir', filename) - if os.path.exists(filepath): - test.unlink(filepath) +test.unlink_files('sub dir', ['foo.exe', 'foo.obj', '.sconsign.dblite']) test.vcproj_sys_path(test.workpath('sub dir', 'foo.vcxproj')) diff --git a/test/MSVS/vs-14.0-exec.py b/test/MSVS/vs-14.0-exec.py index a11f4054c..96e338969 100644 --- a/test/MSVS/vs-14.0-exec.py +++ b/test/MSVS/vs-14.0-exec.py @@ -92,10 +92,7 @@ main(int argc, char *argv) test.run(chdir='sub dir', arguments='.') -for filename in ('foo.exe', 'foo.obj', '.sconsign.dblite'): - filepath = test.workpath('sub dir', filename) - if os.path.exists(filepath): - test.unlink(filepath) +test.unlink_files('sub dir', ['foo.exe', 'foo.obj', '.sconsign.dblite']) test.vcproj_sys_path(test.workpath('sub dir', 'foo.vcxproj')) diff --git a/test/MSVS/vs-14.0Exp-exec.py b/test/MSVS/vs-14.0Exp-exec.py index 5c49322b7..d27d4d5ed 100644 --- a/test/MSVS/vs-14.0Exp-exec.py +++ b/test/MSVS/vs-14.0Exp-exec.py @@ -92,10 +92,7 @@ main(int argc, char *argv) test.run(chdir='sub dir', arguments='.') -for filename in ('foo.exe', 'foo.obj', '.sconsign.dblite'): - filepath = test.workpath('sub dir', filename) - if os.path.exists(filepath): - test.unlink(filepath) +test.unlink_files('sub dir', ['foo.exe', 'foo.obj', '.sconsign.dblite']) test.vcproj_sys_path(test.workpath('sub dir', 'foo.vcxproj')) diff --git a/test/MSVS/vs-14.1-exec.py b/test/MSVS/vs-14.1-exec.py index d0324c248..0a9250923 100644 --- a/test/MSVS/vs-14.1-exec.py +++ b/test/MSVS/vs-14.1-exec.py @@ -92,10 +92,7 @@ main(int argc, char *argv) test.run(chdir='sub dir', arguments='.') -for filename in ('foo.exe', 'foo.obj', '.sconsign.dblite'): - filepath = test.workpath('sub dir', filename) - if os.path.exists(filepath): - test.unlink(filepath) +test.unlink_files('sub dir', ['foo.exe', 'foo.obj', '.sconsign.dblite']) test.vcproj_sys_path(test.workpath('sub dir', 'foo.vcxproj')) diff --git a/test/MSVS/vs-14.2-exec.py b/test/MSVS/vs-14.2-exec.py index 90c56413a..a95982b85 100644 --- a/test/MSVS/vs-14.2-exec.py +++ b/test/MSVS/vs-14.2-exec.py @@ -92,10 +92,7 @@ main(int argc, char *argv) test.run(chdir='sub dir', arguments='.') -for filename in ('foo.exe', 'foo.obj', '.sconsign.dblite'): - filepath = test.workpath('sub dir', filename) - if os.path.exists(filepath): - test.unlink(filepath) +test.unlink_files('sub dir', ['foo.exe', 'foo.obj', '.sconsign.dblite']) test.vcproj_sys_path(test.workpath('sub dir', 'foo.vcxproj')) diff --git a/test/MSVS/vs-14.3-exec.py b/test/MSVS/vs-14.3-exec.py index 164c953cc..ef9dc33de 100644 --- a/test/MSVS/vs-14.3-exec.py +++ b/test/MSVS/vs-14.3-exec.py @@ -92,10 +92,7 @@ main(int argc, char *argv) test.run(chdir='sub dir', arguments='.') -for filename in ('foo.exe', 'foo.obj', '.sconsign.dblite'): - filepath = test.workpath('sub dir', filename) - if os.path.exists(filepath): - test.unlink(filepath) +test.unlink_files('sub dir', ['foo.exe', 'foo.obj', '.sconsign.dblite']) test.vcproj_sys_path(test.workpath('sub dir', 'foo.vcxproj')) diff --git a/test/MSVS/vs-6.0-exec.py b/test/MSVS/vs-6.0-exec.py index 38f715dab..7cffb4837 100644 --- a/test/MSVS/vs-6.0-exec.py +++ b/test/MSVS/vs-6.0-exec.py @@ -90,10 +90,7 @@ main(int argc, char *argv) test.run(chdir='sub dir', arguments='.') -for filename in ('foo.exe', 'foo.obj', '.sconsign.dblite'): - filepath = test.workpath('sub dir', filename) - if os.path.exists(filepath): - test.unlink(filepath) +test.unlink_files('sub dir', ['foo.exe', 'foo.obj', '.sconsign.dblite']) test.run(chdir='sub dir', program=[test.get_msvs_executable(msvs_version)], diff --git a/test/MSVS/vs-7.0-exec.py b/test/MSVS/vs-7.0-exec.py index c0340c4ef..7e81d4e70 100644 --- a/test/MSVS/vs-7.0-exec.py +++ b/test/MSVS/vs-7.0-exec.py @@ -90,10 +90,7 @@ main(int argc, char *argv) test.run(chdir='sub dir', arguments='.') -for filename in ('foo.exe', 'foo.obj', '.sconsign.dblite'): - filepath = test.workpath('sub dir', filename) - if os.path.exists(filepath): - test.unlink(filepath) +test.unlink_files('sub dir', ['foo.exe', 'foo.obj', '.sconsign.dblite']) test.vcproj_sys_path(test.workpath('sub dir', 'foo.vcproj')) diff --git a/test/MSVS/vs-7.1-exec.py b/test/MSVS/vs-7.1-exec.py index 015840be5..e7f4203f7 100644 --- a/test/MSVS/vs-7.1-exec.py +++ b/test/MSVS/vs-7.1-exec.py @@ -90,10 +90,7 @@ main(int argc, char *argv) test.run(chdir='sub dir', arguments='.') -for filename in ('foo.exe', 'foo.obj', '.sconsign.dblite'): - filepath = test.workpath('sub dir', filename) - if os.path.exists(filepath): - test.unlink(filepath) +test.unlink_files('sub dir', ['foo.exe', 'foo.obj', '.sconsign.dblite']) test.vcproj_sys_path(test.workpath('sub dir', 'foo.vcproj')) diff --git a/test/MSVS/vs-8.0-exec.py b/test/MSVS/vs-8.0-exec.py index 228800a10..3a3de0529 100644 --- a/test/MSVS/vs-8.0-exec.py +++ b/test/MSVS/vs-8.0-exec.py @@ -91,10 +91,7 @@ main(int argc, char *argv) test.run(chdir='sub dir', arguments='.') -for filename in ('foo.exe', 'foo.obj', '.sconsign.dblite'): - filepath = test.workpath('sub dir', filename) - if os.path.exists(filepath): - test.unlink(filepath) +test.unlink_files('sub dir', ['foo.exe', 'foo.obj', '.sconsign.dblite']) test.vcproj_sys_path(test.workpath('sub dir', 'foo.vcproj')) diff --git a/test/MSVS/vs-8.0Exp-exec.py b/test/MSVS/vs-8.0Exp-exec.py index ba9aa7adf..a3a83ada8 100644 --- a/test/MSVS/vs-8.0Exp-exec.py +++ b/test/MSVS/vs-8.0Exp-exec.py @@ -91,10 +91,7 @@ main(int argc, char *argv) test.run(chdir='sub dir', arguments='.') -for filename in ('foo.exe', 'foo.obj', '.sconsign.dblite'): - filepath = test.workpath('sub dir', filename) - if os.path.exists(filepath): - test.unlink(filepath) +test.unlink_files('sub dir', ['foo.exe', 'foo.obj', '.sconsign.dblite']) test.vcproj_sys_path(test.workpath('sub dir', 'foo.vcproj')) diff --git a/test/MSVS/vs-9.0-exec.py b/test/MSVS/vs-9.0-exec.py index 75d7bb783..e112f7a20 100644 --- a/test/MSVS/vs-9.0-exec.py +++ b/test/MSVS/vs-9.0-exec.py @@ -91,10 +91,7 @@ main(int argc, char *argv) test.run(chdir='sub dir', arguments='.') -for filename in ('foo.exe', 'foo.obj', '.sconsign.dblite'): - filepath = test.workpath('sub dir', filename) - if os.path.exists(filepath): - test.unlink(filepath) +test.unlink_files('sub dir', ['foo.exe', 'foo.obj', '.sconsign.dblite']) test.vcproj_sys_path(test.workpath('sub dir', 'foo.vcproj')) diff --git a/test/MSVS/vs-9.0Exp-exec.py b/test/MSVS/vs-9.0Exp-exec.py index 36d036758..cc95ba971 100644 --- a/test/MSVS/vs-9.0Exp-exec.py +++ b/test/MSVS/vs-9.0Exp-exec.py @@ -91,10 +91,7 @@ main(int argc, char *argv) test.run(chdir='sub dir', arguments='.') -for filename in ('foo.exe', 'foo.obj', '.sconsign.dblite'): - filepath = test.workpath('sub dir', filename) - if os.path.exists(filepath): - test.unlink(filepath) +test.unlink_files('sub dir', ['foo.exe', 'foo.obj', '.sconsign.dblite']) test.vcproj_sys_path(test.workpath('sub dir', 'foo.vcproj')) diff --git a/testing/framework/TestCmd.py b/testing/framework/TestCmd.py index c207aa7e3..98094c875 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 |