Rename "dir" variables

The variable name "dir" conflicts with the name of a Python built-in
function: http://docs.python.org/library/functions.html#dir

Change-Id: I850f3ec8df7563dc85e21f2876fe5e6550ca2d8f
This commit is contained in:
Mickaël Salaün
2012-09-30 00:37:55 +02:00
parent 3a6cd4200e
commit 2f6ab7f5b8
5 changed files with 28 additions and 28 deletions

30
repo
View File

@ -538,19 +538,19 @@ def _Checkout(cwd, branch, rev, quiet):
def _FindRepo():
"""Look for a repo installation, starting at the current directory.
"""
dir = os.getcwd()
curdir = os.getcwd()
repo = None
olddir = None
while dir != '/' \
and dir != olddir \
while curdir != '/' \
and curdir != olddir \
and not repo:
repo = os.path.join(dir, repodir, REPO_MAIN)
repo = os.path.join(curdir, repodir, REPO_MAIN)
if not os.path.isfile(repo):
repo = None
olddir = dir
dir = os.path.dirname(dir)
return (repo, os.path.join(dir, repodir))
olddir = curdir
curdir = os.path.dirname(curdir)
return (repo, os.path.join(curdir, repodir))
class _Options:
@ -656,13 +656,13 @@ def _SetDefaultsTo(gitdir):
def main(orig_args):
main, dir = _FindRepo()
repo_main, rel_repo_dir = _FindRepo()
cmd, opt, args = _ParseArguments(orig_args)
wrapper_path = os.path.abspath(__file__)
my_main, my_git = _RunSelf(wrapper_path)
if not main:
if not repo_main:
if opt.help:
_Usage()
if cmd == 'help':
@ -682,25 +682,25 @@ def main(orig_args):
os.rmdir(os.path.join(root, name))
os.rmdir(repodir)
sys.exit(1)
main, dir = _FindRepo()
repo_main, rel_repo_dir = _FindRepo()
else:
_NoCommands(cmd)
if my_main:
main = my_main
repo_main = my_main
ver_str = '.'.join(map(lambda x: str(x), VERSION))
me = [main,
'--repo-dir=%s' % dir,
me = [repo_main,
'--repo-dir=%s' % rel_repo_dir,
'--wrapper-version=%s' % ver_str,
'--wrapper-path=%s' % wrapper_path,
'--']
me.extend(orig_args)
me.extend(extra_args)
try:
os.execv(main, me)
os.execv(repo_main, me)
except OSError, e:
print >>sys.stderr, "fatal: unable to start %s" % main
print >>sys.stderr, "fatal: unable to start %s" % repo_main
print >>sys.stderr, "fatal: %s" % e
sys.exit(148)