def __init__(self, path, mkdir=False, logsuffix=''):
    if path:
        pwd = getpwd()
        self._prev_pwd = pwd
    else:
        self._prev_pwd = None
        return
    if (not isabs(path)):
        path = normpath(op.join(pwd, path))
    if ((not os.path.exists(path)) and mkdir):
        self._mkdir = True
        os.mkdir(path)
    else:
        self._mkdir = False
    lgr.debug('chdir %r -> %r %s', self._prev_pwd, path, logsuffix)
    os.chdir(path)
    os.environ['PWD'] = str(path)
def __init__(self, path, mkdir=False, logsuffix=):
    if path:
        pwd = getpwd()
        self._prev_pwd = pwd
    else:
        self._prev_pwd = None
        return
    if (not isabs(path)):
        path = normpath(op.join(pwd, path))
    if ((not os.path.exists(path)) and mkdir):
        self._mkdir = True
        os.mkdir(path)
    else:
        self._mkdir = False
    lgr.debug('chdir %r -> %r %s', self._prev_pwd, path, logsuffix)
    os.chdir(path)
    os.environ['PWD'] = str(path)