Bug 1250748 - Remove the 20s countdown timer from mach first run; r=chmanchester

Previously on first `mach` run on a system, we'd display a prompt with a
20s countdown timer after which the default state directory
(~/.mozbuild) was created. Users had to wait 20s or ctrl+c and
make the directory by hand. Either way, they'd have to re-invoke
mach to run whatever command they were trying to run.

This was annoying.

This commit makes the following changes:

1) The countdown timer is replaced with "press RETURN/ENTER to continue"
2) The requirement to re-invoke mach has been removed

On first run, people now see a message telling them to press
RETURN/ENTER. Then the directory is created and whatever mach command
they requested to run is run.

While I was here, I also changed the permissions on the newly created
directory to match what it was a few lines above. Without, we're relying
on umask, which may be permissive. UNIX convention is to use a more
restrictive umask insider user directories. So this feels like the right
behavior.

MozReview-Commit-ID: IodN13xAJ8P

--HG--
extra : rebase_source : 7da66e2f03aaf4e6807c54ac20854a4f41092f2a
This commit is contained in:
Gregory Szorc 2016-02-23 17:29:38 -08:00
Родитель a5861fc16a
Коммит ce58df9563
1 изменённых файлов: 5 добавлений и 10 удалений

Просмотреть файл

@ -27,6 +27,8 @@ If you would like to use a different directory, hit CTRL+c and set the
MOZBUILD_STATE_PATH environment variable to the directory you would like to
use and re-run mach. For this change to take effect forever, you'll likely
want to export this environment variable from your shell's init scripts.
Press ENTER/RETURN to continue or CTRL+c to abort.
'''.lstrip()
NO_MERCURIAL_SETUP = '''
@ -401,25 +403,18 @@ def bootstrap(topsrcdir, mozilla_dir=None):
if is_environ:
if not os.path.exists(state_dir):
print('Creating global state directory from environment variable: %s'
% state_dir)
% state_dir)
os.makedirs(state_dir, mode=0o770)
print('Please re-run mach.')
sys.exit(1)
else:
if not os.path.exists(state_dir):
print(STATE_DIR_FIRST_RUN.format(userdir=state_dir))
try:
for i in range(20, -1, -1):
time.sleep(1)
sys.stdout.write('%d ' % i)
sys.stdout.flush()
sys.stdin.readline()
except KeyboardInterrupt:
sys.exit(1)
print('\nCreating default state directory: %s' % state_dir)
os.mkdir(state_dir)
print('Please re-run mach.')
sys.exit(1)
os.makedirs(state_dir, mode=0o770)
return state_dir