author Matt Brubeck <mbrubeck@mozilla.com>
Wed, 13 Feb 2013 15:35:45 -0800
changeset 121817 d01bf199fcbacb932347767aa3023d73759020a1
parent 109790 cff221895afe122f2bb51224d369e6d26509dfad
permissions -rw-r--r--
Bug 839340 - mach reftest <dir> doesn't work on Windows [r=gps]

# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.

from __future__ import unicode_literals

import os

def parse_test_path(test_path, topsrcdir):
    """Returns a dict containing:
    * 'normalized': the normalized path, relative to the topsrcdir
    * 'isdir': whether the path points to a directory
    is_dir = os.path.isdir(test_path)

    normalized = os.path.normpath(test_path)
    topsrcdir = os.path.normpath(topsrcdir)

    if normalized.startswith(topsrcdir):
        normalized = normalized[len(topsrcdir):]

    return {
        'normalized': normalized,
        'is_dir': is_dir,