mirror of
https://chromium.googlesource.com/chromium/tools/depot_tools.git
synced 2026-01-11 18:51:29 +00:00
Fix some path processing to work better on Windows.
R=hinoka@chromium.org BUG=555036 Review URL: https://codereview.chromium.org/1471973004 git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@297698 0039d316-1c4b-4281-b951-d872f2087c98
This commit is contained in:
@@ -255,7 +255,8 @@ class SvnConfig(object):
|
||||
if sys.platform == 'win32':
|
||||
self.svn_config_dir = os.path.join(os.environ['APPDATA'], 'Subversion')
|
||||
else:
|
||||
self.svn_config_dir = os.path.join(os.environ['HOME'], '.subversion')
|
||||
self.svn_config_dir = os.path.expanduser(
|
||||
os.path.join('~', '.subversion'))
|
||||
svn_config_file = os.path.join(self.svn_config_dir, 'config')
|
||||
parser = ConfigParser.SafeConfigParser()
|
||||
if os.path.isfile(svn_config_file):
|
||||
|
||||
2
cit.py
2
cit.py
@@ -22,7 +22,7 @@ import re
|
||||
|
||||
SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
|
||||
GCLIENT = os.path.join(SCRIPT_DIR, 'gclient.py')
|
||||
TARGET_DIR = os.path.expanduser('~/.chrome-infra')
|
||||
TARGET_DIR = os.path.expanduser(os.path.join('~', '.chrome-infra'))
|
||||
INFRA_DIR = os.path.join(TARGET_DIR, 'infra')
|
||||
|
||||
|
||||
|
||||
12
gcl.py
12
gcl.py
@@ -71,15 +71,9 @@ def CheckHomeForFile(filename):
|
||||
"""Checks the users home dir for the existence of the given file. Returns
|
||||
the path to the file if it's there, or None if it is not.
|
||||
"""
|
||||
home_vars = ['HOME']
|
||||
if sys.platform in ('cygwin', 'win32'):
|
||||
home_vars.append('USERPROFILE')
|
||||
for home_var in home_vars:
|
||||
home = os.getenv(home_var)
|
||||
if home != None:
|
||||
full_path = os.path.join(home, filename)
|
||||
if os.path.exists(full_path):
|
||||
return full_path
|
||||
full_path = os.path.expanduser(os.path.join('~', filename))
|
||||
if os.path.exists(full_path):
|
||||
return full_path
|
||||
return None
|
||||
|
||||
|
||||
|
||||
@@ -97,7 +97,7 @@ class NetrcAuthenticator(Authenticator):
|
||||
@staticmethod
|
||||
def _get_netrc():
|
||||
path = '_netrc' if sys.platform.startswith('win') else '.netrc'
|
||||
path = os.path.join(os.environ['HOME'], path)
|
||||
path = os.path.expanduser(os.path.join('~', path))
|
||||
try:
|
||||
return netrc.netrc(path)
|
||||
except IOError:
|
||||
|
||||
2
repo
2
repo
@@ -233,7 +233,7 @@ if (ver[0], ver[1]) < MIN_PYTHON_VERSION:
|
||||
% sys.version.split(' ')[0], file=sys.stderr)
|
||||
sys.exit(1)
|
||||
|
||||
home_dot_repo = os.path.expanduser('~/.repoconfig')
|
||||
home_dot_repo = os.path.expanduser(os.path.join('~','.repoconfig'))
|
||||
gpg_dir = os.path.join(home_dot_repo, 'gnupg')
|
||||
|
||||
extra_args = []
|
||||
|
||||
6
scm.py
6
scm.py
@@ -1040,10 +1040,10 @@ class SVN(object):
|
||||
auth_dir = os.path.join(os.environ['APPDATA'], 'Subversion', 'auth',
|
||||
'svn.simple')
|
||||
else:
|
||||
if not 'HOME' in os.environ:
|
||||
auth_dir = os.path.expanduser(
|
||||
os.path.join('~', '.subversion', 'auth', 'svn.simple'))
|
||||
if not os.path.exists(auth_dir):
|
||||
return None
|
||||
auth_dir = os.path.join(os.environ['HOME'], '.subversion', 'auth',
|
||||
'svn.simple')
|
||||
for credfile in os.listdir(auth_dir):
|
||||
cred_info = SVN.ReadSimpleAuth(os.path.join(auth_dir, credfile))
|
||||
if regexp.match(cred_info.get('svn:realmstring')):
|
||||
|
||||
Reference in New Issue
Block a user