Title: [104495] trunk/Tools
Revision
104495
Author
[email protected]
Date
2012-01-09 15:14:09 -0800 (Mon, 09 Jan 2012)

Log Message

Fix regression in test-webkitpy introduced by removing the webkitpy/python24 directory.

Unreviewed, build fix.

test-webkitpy had a built-in self-test routine to verify that
deleting the .pyc files worked correctly. When I removed the
python24 directory in r104482, I broke the self-test.

I have deleted the self-test for now. Since I am reworking
test-webkitpy I will make sure the new version is adequately
tested.

* Scripts/test-webkitpy:
(configure_logging):
(_clean_pyc_files):
(_clean_packages):
(init):

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (104494 => 104495)


--- trunk/Tools/ChangeLog	2012-01-09 23:13:00 UTC (rev 104494)
+++ trunk/Tools/ChangeLog	2012-01-09 23:14:09 UTC (rev 104495)
@@ -1,3 +1,23 @@
+2012-01-09  Dirk Pranke  <[email protected]>
+
+        Fix regression in test-webkitpy introduced by removing the webkitpy/python24 directory.
+
+        Unreviewed, build fix.
+
+        test-webkitpy had a built-in self-test routine to verify that
+        deleting the .pyc files worked correctly. When I removed the
+        python24 directory in r104482, I broke the self-test.
+
+        I have deleted the self-test for now. Since I am reworking
+        test-webkitpy I will make sure the new version is adequately
+        tested.
+
+        * Scripts/test-webkitpy:
+        (configure_logging):
+        (_clean_pyc_files):
+        (_clean_packages):
+        (init):
+
 2012-01-09  Justin Novosad  <[email protected]>
 
         [Chromium] remove all references to the legacy accelerated 2d Canvas

Modified: trunk/Tools/Scripts/test-webkitpy (104494 => 104495)


--- trunk/Tools/Scripts/test-webkitpy	2012-01-09 23:13:00 UTC (rev 104494)
+++ trunk/Tools/Scripts/test-webkitpy	2012-01-09 23:14:09 UTC (rev 104495)
@@ -104,60 +104,24 @@
     handler.addFilter(testing_filter)
 
 
-def _clean_pyc_files(dir_to_clean, paths_not_to_log):
-    """Delete from a directory all .pyc files that have no .py file.
-
-    Args:
-      dir_to_clean: The path to the directory to clean.
-      paths_not_to_log: A list of paths to .pyc files whose deletions should
-                        not be logged.  This list should normally include
-                        only test .pyc files.
-
-    """
+def _clean_pyc_files(dir_to_clean):
+    """Delete from under a directory all .pyc files that have no .py file."""
     _log.debug("Cleaning orphaned *.pyc files from: %s" % dir_to_clean)
-
-    # Normalize paths not to log.
-    paths_not_to_log = [os.path.abspath(path) for path in paths_not_to_log]
-
     for dir_path, dir_names, file_names in os.walk(dir_to_clean):
         for file_name in file_names:
             if file_name.endswith(".pyc") and file_name[:-1] not in file_names:
                 file_path = os.path.join(dir_path, file_name)
-                if os.path.abspath(file_path) not in paths_not_to_log:
-                    _log.info("Deleting orphan *.pyc file: %s" % file_path)
+                _log.info("Deleting orphan *.pyc file: %s" % file_path)
                 os.remove(file_path)
 
 
-# As a substitute for a unit test, this method tests _clean_pyc_files()
-# in addition to calling it.  We chose not to use the unittest module
-# because _clean_pyc_files() is called only once and is not used elsewhere.
-def _clean_packages_with_test(external_package_paths):
+def _clean_packages(external_package_paths):
     webkitpy_dir = os.path.join(os.path.dirname(__file__), "webkitpy")
     package_paths = [webkitpy_dir] + external_package_paths
-
-    # The test .pyc file is--
-    # webkitpy/python24/TEMP_test-webkitpy_test_pyc_file.pyc.
-    test_path = os.path.join(webkitpy_dir, "python24",
-                             "TEMP_test-webkitpy_test_pyc_file.pyc")
-
-    test_file = open(test_path, "w")
-    try:
-        test_file.write("Test .pyc file generated by test-webkitpy.")
-    finally:
-        test_file.close()
-
-    # Confirm that the test file exists so that when we check that it does
-    # not exist, the result is meaningful.
-    if not os.path.exists(test_path):
-        raise Exception("Test .pyc file not created: %s" % test_path)
-
     for path in package_paths:
-        _clean_pyc_files(path, [test_path])
+        _clean_pyc_files(path)
 
-    if os.path.exists(test_path):
-        raise Exception("Test .pyc file not deleted: %s" % test_path)
 
-
 def init(command_args, external_package_paths):
     """Execute code prior to importing from webkitpy.unittests.
 
@@ -204,7 +168,7 @@
     #
     # Deleting the orphaned .pyc file prior to importing, however, would
     # cause an ImportError to occur on import as desired.
-    _clean_packages_with_test(external_package_paths)
+    _clean_packages(external_package_paths)
 
 
 def _path_from_webkit_root(*components):
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to