Changeset 53887 in webkit


Ignore:
Timestamp:
Jan 26, 2010 7:04:35 PM (14 years ago)
Author:
Chris Jerdonek
Message:

2010-01-26 Chris Jerdonek <Chris Jerdonek>

Reviewed by Eric Seidel.

The Python autoinstall cache directory now only gets created
in the directory containing autoinstall.py.

https://bugs.webkit.org/show_bug.cgi?id=33365

  • Scripts/webkitpy/autoinstall.py:
    • Also added a README file to the cache directory saying where it came from.
Location:
trunk/WebKitTools
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebKitTools/ChangeLog

    r53882 r53887  
     12010-01-26  Chris Jerdonek  <cjerdonek@webkit.org>
     2
     3        Reviewed by Eric Seidel.
     4
     5        The Python autoinstall cache directory now only gets created
     6        in the directory containing autoinstall.py.
     7
     8        https://bugs.webkit.org/show_bug.cgi?id=33365
     9
     10        * Scripts/webkitpy/autoinstall.py:
     11          - Also added a README file to the cache directory saying
     12            where it came from.
     13
    1142010-01-26  Chris Jerdonek  <cjerdonek@webkit.org>
    215
  • trunk/WebKitTools/Scripts/webkitpy/autoinstall.py

    r52718 r53887  
    180180
    181181    def __init__(self, directory=None):
    182         self.directory = directory or "./autoinstall.cache.d/"
     182        if directory is None:
     183            # Default to putting the cache directory in the same directory
     184            # as this file.
     185            containing_directory = os.path.dirname(__file__)
     186            directory = os.path.join(containing_directory, "autoinstall.cache.d");
     187
     188        self.directory = directory
    183189        try:
    184190            if not os.path.exists(self.directory):
    185                 _logger.debug("Creating cache directory '%s'." % self.directory)
    186                 os.mkdir(self.directory)
     191                self._create_cache_directory()
    187192        except Exception, err:
    188193            _logger.exception(err)
     
    190195        _logger.info("Using cache directory '%s'." % self.directory)
    191196   
     197    def _create_cache_directory(self):
     198        _logger.debug("Creating cache directory '%s'." % self.directory)
     199        os.mkdir(self.directory)
     200        readme_path = os.path.join(self.directory, "README")
     201        with open(readme_path, "w") as f:
     202            f.write("This directory was auto-generated by '%s'.\n"
     203                    "It is safe to delete.\n" % __file__)
     204
    192205    def get(self, url):
    193206        _logger.info("Getting '%s' from cache." % url)
Note: See TracChangeset for help on using the changeset viewer.