SConstruct (11401:55f9a21e34b4) SConstruct (11408:cb18b6551499)
1# -*- mode:python -*-
2
1# -*- mode:python -*-
2
3# Copyright (c) 2013, 2015 ARM Limited
3# Copyright (c) 2013, 2015, 2016 ARM Limited
4# All rights reserved.
5#
6# The license below extends only to copyright in the software and shall
7# not be construed as granting a license to any other intellectual
8# property including but not limited to intellectual property relating
9# to a hardware implementation of the functionality of the software
10# licensed hereunder. You may use the software subject to the license
11# terms below provided that you ensure that this notice is replicated

--- 243 unchanged lines hidden (view full) ---

255# Mercurial Stuff.
256#
257# If the gem5 directory is a mercurial repository, we should do some
258# extra things.
259#
260########################################################################
261
262hgdir = main.root.Dir(".hg")
4# All rights reserved.
5#
6# The license below extends only to copyright in the software and shall
7# not be construed as granting a license to any other intellectual
8# property including but not limited to intellectual property relating
9# to a hardware implementation of the functionality of the software
10# licensed hereunder. You may use the software subject to the license
11# terms below provided that you ensure that this notice is replicated

--- 243 unchanged lines hidden (view full) ---

255# Mercurial Stuff.
256#
257# If the gem5 directory is a mercurial repository, we should do some
258# extra things.
259#
260########################################################################
261
262hgdir = main.root.Dir(".hg")
263gitdir = main.root.Dir(".git")
263
264
264mercurial_style_message = """
265
266style_message = """
265You're missing the gem5 style hook, which automatically checks your code
266against the gem5 style rules on hg commit and qrefresh commands. This
267You're missing the gem5 style hook, which automatically checks your code
268against the gem5 style rules on hg commit and qrefresh commands. This
267script will now install the hook in your .hg/hgrc file.
269script will now install the hook in your %s.
268Press enter to continue, or ctrl-c to abort: """
269
270Press enter to continue, or ctrl-c to abort: """
271
272mercurial_style_message = style_message % ".hg/hgrc file"
273git_style_message = style_message % ".git/hooks/ directory"
274
270mercurial_style_upgrade_message = """
271Your Mercurial style hooks are not up-to-date. This script will now
272try to automatically update them. A backup of your hgrc will be saved
273in .hg/hgrc.old.
274Press enter to continue, or ctrl-c to abort: """
275
276mercurial_style_hook = """
277# The following lines were automatically added by gem5/SConstruct

--- 10 unchanged lines hidden (view full) ---

288
289mercurial_lib_not_found = """
290Mercurial libraries cannot be found, ignoring style hook. If
291you are a gem5 developer, please fix this and run the style
292hook. It is important.
293"""
294
295# Check for style hook and prompt for installation if it's not there.
275mercurial_style_upgrade_message = """
276Your Mercurial style hooks are not up-to-date. This script will now
277try to automatically update them. A backup of your hgrc will be saved
278in .hg/hgrc.old.
279Press enter to continue, or ctrl-c to abort: """
280
281mercurial_style_hook = """
282# The following lines were automatically added by gem5/SConstruct

--- 10 unchanged lines hidden (view full) ---

293
294mercurial_lib_not_found = """
295Mercurial libraries cannot be found, ignoring style hook. If
296you are a gem5 developer, please fix this and run the style
297hook. It is important.
298"""
299
300# Check for style hook and prompt for installation if it's not there.
296# Skip this if --ignore-style was specified, there's no .hg dir to
297# install a hook in, or there's no interactive terminal to prompt.
298if not GetOption('ignore_style') and hgdir.exists() and sys.stdin.isatty():
301# Skip this if --ignore-style was specified, there's no interactive
302# terminal to prompt, or no recognized revision control system can be
303# found.
304ignore_style = GetOption('ignore_style') or not sys.stdin.isatty()
305
306# Try wire up Mercurial to the style hooks
307if not ignore_style and hgdir.exists():
299 style_hook = True
300 style_hooks = tuple()
301 hgrc = hgdir.File('hgrc')
302 hgrc_old = hgdir.File('hgrc.old')
303 try:
304 from mercurial import ui
305 ui = ui.ui()
306 ui.readconfig(hgrc.abspath)

--- 47 unchanged lines hidden (view full) ---

354 print "Adding style hook to", hgrc_path, "\n"
355 try:
356 with open(hgrc_path, 'a') as f:
357 f.write(mercurial_style_hook)
358 except:
359 print "Error updating", hgrc_path
360 sys.exit(1)
361
308 style_hook = True
309 style_hooks = tuple()
310 hgrc = hgdir.File('hgrc')
311 hgrc_old = hgdir.File('hgrc.old')
312 try:
313 from mercurial import ui
314 ui = ui.ui()
315 ui.readconfig(hgrc.abspath)

--- 47 unchanged lines hidden (view full) ---

363 print "Adding style hook to", hgrc_path, "\n"
364 try:
365 with open(hgrc_path, 'a') as f:
366 f.write(mercurial_style_hook)
367 except:
368 print "Error updating", hgrc_path
369 sys.exit(1)
370
371# Try to wire up git to the style hooks
372git_pre_commit_hook = gitdir.File("hooks/pre-commit")
373if not ignore_style and gitdir.exists() and not git_pre_commit_hook.exists():
374 git_style_script = File("util/git-pre-commit.py")
362
375
376 print git_style_message,
377 try:
378 raw_input()
379 except:
380 print "Input exception, exiting scons.\n"
381 sys.exit(1)
382
383 try:
384 rel_style_script = os.path.relpath(
385 git_style_script.get_abspath(),
386 git_pre_commit_hook.Dir(".").get_abspath())
387 os.symlink(rel_style_script, git_pre_commit_hook.get_abspath())
388 except:
389 print "Error updating git pre-commit hook"
390 raise
391 sys.exit(1)
392
363###################################################
364#
365# Figure out which configurations to set up based on the path(s) of
366# the target(s).
367#
368###################################################
369
370# Find default configuration & binary.

--- 1130 unchanged lines hidden ---
393###################################################
394#
395# Figure out which configurations to set up based on the path(s) of
396# the target(s).
397#
398###################################################
399
400# Find default configuration & binary.

--- 1130 unchanged lines hidden ---