Changeset 107145 in webkit


Ignore:
Timestamp:
Feb 8, 2012 3:59:04 PM (12 years ago)
Author:
abarth@webkit.org
Message:

Remove the ospath compat shim from webkitpy
https://bugs.webkit.org/show_bug.cgi?id=78170

Reviewed by Eric Seidel.

We no longer need this compat shim now that we don't support Python 2.5.

  • Scripts/webkitpy/common/checkout/scm/git.py:
  • Scripts/webkitpy/common/checkout/scm/svn.py:
  • Scripts/webkitpy/common/system/filesystem.py:

(FileSystem.relpath):

  • Scripts/webkitpy/common/system/filesystem_mock.py:

(MockFileSystem.relpath):

  • Scripts/webkitpy/common/system/ospath.py: Removed.
  • Scripts/webkitpy/common/system/ospath_unittest.py: Removed.
Location:
trunk/Tools
Files:
2 deleted
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Tools/ChangeLog

    r107144 r107145  
     12012-02-08  Adam Barth  <abarth@webkit.org>
     2
     3        Remove the ospath compat shim from webkitpy
     4        https://bugs.webkit.org/show_bug.cgi?id=78170
     5
     6        Reviewed by Eric Seidel.
     7
     8        We no longer need this compat shim now that we don't support Python 2.5.
     9
     10        * Scripts/webkitpy/common/checkout/scm/git.py:
     11        * Scripts/webkitpy/common/checkout/scm/svn.py:
     12        * Scripts/webkitpy/common/system/filesystem.py:
     13        (FileSystem.relpath):
     14        * Scripts/webkitpy/common/system/filesystem_mock.py:
     15        (MockFileSystem.relpath):
     16        * Scripts/webkitpy/common/system/ospath.py: Removed.
     17        * Scripts/webkitpy/common/system/ospath_unittest.py: Removed.
     18
    1192012-02-08  Ryosuke Niwa  <rniwa@webkit.org>
    220
  • trunk/Tools/Scripts/webkitpy/common/checkout/scm/git.py

    r106687 r107145  
    3535from webkitpy.common.system.deprecated_logging import log
    3636from webkitpy.common.system.executive import Executive, ScriptError
    37 from webkitpy.common.system import ospath
    3837
    3938from .commitmessage import CommitMessage
  • trunk/Tools/Scripts/webkitpy/common/checkout/scm/svn.py

    r106687 r107145  
    3737from webkitpy.common.system.deprecated_logging import log
    3838from webkitpy.common.system.executive import Executive, ScriptError
    39 from webkitpy.common.system import ospath
    4039
    4140from .scm import AuthenticationError, SCM, commit_error_handler
  • trunk/Tools/Scripts/webkitpy/common/system/filesystem.py

    r107136 r107145  
    4040import time
    4141
    42 from webkitpy.common.system import ospath
    43 
    4442class FileSystem(object):
    4543    """FileSystem interface for webkitpy.
     
    228226
    229227    def relpath(self, path, start='.'):
    230         return ospath.relpath(path, start)
     228        return os.path.relpath(path, start)
    231229
    232230    class _WindowsError(exceptions.OSError):
  • trunk/Tools/Scripts/webkitpy/common/system/filesystem_mock.py

    r106692 r107145  
    3434
    3535from webkitpy.common.system import path
    36 from webkitpy.common.system import ospath
    3736
    3837
     
    304303
    305304    def relpath(self, path, start='.'):
    306         return ospath.relpath(path, start, self.abspath, self.sep)
     305        # Since os.path.relpath() calls os.path.normpath()
     306        # (see http://docs.python.org/library/os.path.html#os.path.abspath )
     307        # it also removes trailing slashes and converts forward and backward
     308        # slashes to the preferred slash os.sep.
     309        start = self.abspath(start)
     310        path = self.abspath(path)
     311
     312        if not path.lower().startswith(start.lower()):
     313            # Then path is outside the directory given by start.
     314            return None  # FIXME: os.relpath still returns a path here.
     315
     316        rel_path = path[len(start):]
     317
     318        if not rel_path:
     319            # Then the paths are the same.
     320            pass
     321        elif rel_path[0] == self.sep:
     322            # It is probably sufficient to remove just the first character
     323            # since os.path.normpath() collapses separators, but we use
     324            # lstrip() just to be sure.
     325            rel_path = rel_path.lstrip(self.sep)
     326        else:
     327            # We are in the case typified by the following example:
     328            # path = "/tmp/foobar", start = "/tmp/foo" -> rel_path = "bar"
     329            return None
     330
     331        return rel_path
    307332
    308333    def remove(self, path):
Note: See TracChangeset for help on using the changeset viewer.