[gem5-dev] Change in public/gem5[master]: scons: Pull style hook management out of the main SConstruct.

2017-11-10 Thread Gabe Black (Gerrit)
Gabe Black has submitted this change and it was merged. (  
https://gem5-review.googlesource.com/5563 )


Change subject: scons: Pull style hook management out of the main  
SConstruct.

..

scons: Pull style hook management out of the main SConstruct.

Put the code which supports style hooks for mercurial and git into two
scons "tools".

Change-Id: I3ffed85a177be4f9e458fff7b1cf16a3a479914e
Reviewed-on: https://gem5-review.googlesource.com/5563
Reviewed-by: Gabe Black 
Maintainer: Gabe Black 
---
M SConstruct
A site_scons/gem5_scons/__init__.py
A site_scons/gem5_scons/util.py
M site_scons/site_tools/default.py
A site_scons/site_tools/git.py
A site_scons/site_tools/mercurial.py
6 files changed, 313 insertions(+), 189 deletions(-)

Approvals:
  Gabe Black: Looks good to me, approved; Looks good to me, approved



diff --git a/SConstruct b/SConstruct
index 7cf2c9c..f0a3b65 100755
--- a/SConstruct
+++ b/SConstruct
@@ -196,195 +196,6 @@
 # as well
 main.AppendENVPath('PYTHONPATH', extra_python_paths)

-
-#
-# Mercurial Stuff.
-#
-# If the gem5 directory is a mercurial repository, we should do some
-# extra things.
-#
-
-
-hgdir = main.root.Dir(".hg")
-
-
-style_message = """
-You're missing the gem5 style hook, which automatically checks your code
-against the gem5 style rules on %s.
-This script will now install the hook in your %s.
-Press enter to continue, or ctrl-c to abort: """
-
-mercurial_style_message = """
-You're missing the gem5 style hook, which automatically checks your code
-against the gem5 style rules on hg commit and qrefresh commands.
-This script will now install the hook in your .hg/hgrc file.
-Press enter to continue, or ctrl-c to abort: """
-
-git_style_message = """
-You're missing the gem5 style or commit message hook. These hooks help
-to ensure that your code follows gem5's style rules on git commit.
-This script will now install the hook in your .git/hooks/ directory.
-Press enter to continue, or ctrl-c to abort: """
-
-mercurial_style_upgrade_message = """
-Your Mercurial style hooks are not up-to-date. This script will now
-try to automatically update them. A backup of your hgrc will be saved
-in .hg/hgrc.old.
-Press enter to continue, or ctrl-c to abort: """
-
-mercurial_style_hook = """
-# The following lines were automatically added by gem5/SConstruct
-# to provide the gem5 style-checking hooks
-[extensions]
-hgstyle = %s/util/hgstyle.py
-
-[hooks]
-pretxncommit.style = python:hgstyle.check_style
-pre-qrefresh.style = python:hgstyle.check_style
-# End of SConstruct additions
-
-""" % (main.root.abspath)
-
-mercurial_lib_not_found = """
-Mercurial libraries cannot be found, ignoring style hook.  If
-you are a gem5 developer, please fix this and run the style
-hook. It is important.
-"""
-
-# Check for style hook and prompt for installation if it's not there.
-# Skip this if --ignore-style was specified, there's no interactive
-# terminal to prompt, or no recognized revision control system can be
-# found.
-ignore_style = GetOption('ignore_style') or not sys.stdin.isatty()
-
-# Try wire up Mercurial to the style hooks
-if not ignore_style and hgdir.exists():
-style_hook = True
-style_hooks = tuple()
-hgrc = hgdir.File('hgrc')
-hgrc_old = hgdir.File('hgrc.old')
-try:
-from mercurial import ui
-ui = ui.ui()
-ui.readconfig(hgrc.abspath)
-style_hooks = (ui.config('hooks', 'pretxncommit.style', None),
-   ui.config('hooks', 'pre-qrefresh.style', None))
-style_hook = all(style_hooks)
-style_extension = ui.config('extensions', 'style', None)
-except ImportError:
-print mercurial_lib_not_found
-
-if "python:style.check_style" in style_hooks:
-# Try to upgrade the style hooks
-print mercurial_style_upgrade_message
-# continue unless user does ctrl-c/ctrl-d etc.
-try:
-raw_input()
-except:
-print "Input exception, exiting scons.\n"
-sys.exit(1)
-shutil.copyfile(hgrc.abspath, hgrc_old.abspath)
-re_style_hook = re.compile(r"^([^=#]+)\.style\s*=\s*([^#\s]+).*")
-re_style_extension = re.compile("style\s*=\s*([^#\s]+).*")
-old, new = open(hgrc_old.abspath, 'r'), open(hgrc.abspath, 'w')
-for l in old:
-m_hook = re_style_hook.match(l)
-m_ext = re_style_extension.match(l)
-if m_hook:
-hook, check = m_hook.groups()
-if check != "python:style.check_style":
-print "Warning: %s.style is using a non-default " \
-"checker: %s" % (hook, check)
-if hook not in ("pretxncommit", "pre-qrefresh"):
-

[gem5-dev] Change in public/gem5[master]: scons: Pull style hook management out of the main SConstruct.

2017-11-10 Thread Gabe Black (Gerrit)

Hello Jason Lowe-Power,

I'd like you to reexamine a change. Please visit

https://gem5-review.googlesource.com/5563

to look at the new patch set (#3).

Change subject: scons: Pull style hook management out of the main  
SConstruct.

..

scons: Pull style hook management out of the main SConstruct.

Put the code which supports style hooks for mercurial and git into two
scons "tools".

Change-Id: I3ffed85a177be4f9e458fff7b1cf16a3a479914e
---
M SConstruct
A site_scons/gem5_scons/__init__.py
A site_scons/gem5_scons/util.py
M site_scons/site_tools/default.py
A site_scons/site_tools/git.py
A site_scons/site_tools/mercurial.py
6 files changed, 313 insertions(+), 189 deletions(-)


--
To view, visit https://gem5-review.googlesource.com/5563
To unsubscribe, or for help writing mail filters, visit  
https://gem5-review.googlesource.com/settings


Gerrit-Project: public/gem5
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I3ffed85a177be4f9e458fff7b1cf16a3a479914e
Gerrit-Change-Number: 5563
Gerrit-PatchSet: 3
Gerrit-Owner: Gabe Black 
Gerrit-Assignee: Jason Lowe-Power 
Gerrit-Reviewer: Jason Lowe-Power 
Gerrit-CC: Andreas Sandberg 
___
gem5-dev mailing list
gem5-dev@gem5.org
http://m5sim.org/mailman/listinfo/gem5-dev

[gem5-dev] Change in public/gem5[master]: scons: Pull style hook management out of the main SConstruct.

2017-11-08 Thread Gabe Black (Gerrit)
Gabe Black has uploaded a new patch set (#2). (  
https://gem5-review.googlesource.com/5563 )


Change subject: scons: Pull style hook management out of the main  
SConstruct.

..

scons: Pull style hook management out of the main SConstruct.

Put the code which supports style hooks for mercurial and git into two
scons "tools".

Change-Id: I3ffed85a177be4f9e458fff7b1cf16a3a479914e
---
M SConstruct
A site_scons/gem5_scons/__init__.py
A site_scons/gem5_scons/util.py
M site_scons/site_tools/default.py
A site_scons/site_tools/git.py
A site_scons/site_tools/mercurial.py
6 files changed, 322 insertions(+), 189 deletions(-)


--
To view, visit https://gem5-review.googlesource.com/5563
To unsubscribe, or for help writing mail filters, visit  
https://gem5-review.googlesource.com/settings


Gerrit-Project: public/gem5
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I3ffed85a177be4f9e458fff7b1cf16a3a479914e
Gerrit-Change-Number: 5563
Gerrit-PatchSet: 2
Gerrit-Owner: Gabe Black 
___
gem5-dev mailing list
gem5-dev@gem5.org
http://m5sim.org/mailman/listinfo/gem5-dev

[gem5-dev] Change in public/gem5[master]: scons: Pull style hook management out of the main SConstruct.

2017-11-08 Thread Gabe Black (Gerrit)
Gabe Black has uploaded this change for review. (  
https://gem5-review.googlesource.com/5563



Change subject: scons: Pull style hook management out of the main  
SConstruct.

..

scons: Pull style hook management out of the main SConstruct.

Put the code which supports style hooks for mercurial and git into two
scons "tools".

Change-Id: I3ffed85a177be4f9e458fff7b1cf16a3a479914e
---
M SConstruct
A site_scons/gem5_scons/__init__.py
A site_scons/gem5_scons/util.py
M site_scons/site_tools/default.py
A site_scons/site_tools/git.py
A site_scons/site_tools/mercurial.py
6 files changed, 321 insertions(+), 189 deletions(-)



diff --git a/SConstruct b/SConstruct
index 7cf2c9c..f0a3b65 100755
--- a/SConstruct
+++ b/SConstruct
@@ -196,195 +196,6 @@
 # as well
 main.AppendENVPath('PYTHONPATH', extra_python_paths)

-
-#
-# Mercurial Stuff.
-#
-# If the gem5 directory is a mercurial repository, we should do some
-# extra things.
-#
-
-
-hgdir = main.root.Dir(".hg")
-
-
-style_message = """
-You're missing the gem5 style hook, which automatically checks your code
-against the gem5 style rules on %s.
-This script will now install the hook in your %s.
-Press enter to continue, or ctrl-c to abort: """
-
-mercurial_style_message = """
-You're missing the gem5 style hook, which automatically checks your code
-against the gem5 style rules on hg commit and qrefresh commands.
-This script will now install the hook in your .hg/hgrc file.
-Press enter to continue, or ctrl-c to abort: """
-
-git_style_message = """
-You're missing the gem5 style or commit message hook. These hooks help
-to ensure that your code follows gem5's style rules on git commit.
-This script will now install the hook in your .git/hooks/ directory.
-Press enter to continue, or ctrl-c to abort: """
-
-mercurial_style_upgrade_message = """
-Your Mercurial style hooks are not up-to-date. This script will now
-try to automatically update them. A backup of your hgrc will be saved
-in .hg/hgrc.old.
-Press enter to continue, or ctrl-c to abort: """
-
-mercurial_style_hook = """
-# The following lines were automatically added by gem5/SConstruct
-# to provide the gem5 style-checking hooks
-[extensions]
-hgstyle = %s/util/hgstyle.py
-
-[hooks]
-pretxncommit.style = python:hgstyle.check_style
-pre-qrefresh.style = python:hgstyle.check_style
-# End of SConstruct additions
-
-""" % (main.root.abspath)
-
-mercurial_lib_not_found = """
-Mercurial libraries cannot be found, ignoring style hook.  If
-you are a gem5 developer, please fix this and run the style
-hook. It is important.
-"""
-
-# Check for style hook and prompt for installation if it's not there.
-# Skip this if --ignore-style was specified, there's no interactive
-# terminal to prompt, or no recognized revision control system can be
-# found.
-ignore_style = GetOption('ignore_style') or not sys.stdin.isatty()
-
-# Try wire up Mercurial to the style hooks
-if not ignore_style and hgdir.exists():
-style_hook = True
-style_hooks = tuple()
-hgrc = hgdir.File('hgrc')
-hgrc_old = hgdir.File('hgrc.old')
-try:
-from mercurial import ui
-ui = ui.ui()
-ui.readconfig(hgrc.abspath)
-style_hooks = (ui.config('hooks', 'pretxncommit.style', None),
-   ui.config('hooks', 'pre-qrefresh.style', None))
-style_hook = all(style_hooks)
-style_extension = ui.config('extensions', 'style', None)
-except ImportError:
-print mercurial_lib_not_found
-
-if "python:style.check_style" in style_hooks:
-# Try to upgrade the style hooks
-print mercurial_style_upgrade_message
-# continue unless user does ctrl-c/ctrl-d etc.
-try:
-raw_input()
-except:
-print "Input exception, exiting scons.\n"
-sys.exit(1)
-shutil.copyfile(hgrc.abspath, hgrc_old.abspath)
-re_style_hook = re.compile(r"^([^=#]+)\.style\s*=\s*([^#\s]+).*")
-re_style_extension = re.compile("style\s*=\s*([^#\s]+).*")
-old, new = open(hgrc_old.abspath, 'r'), open(hgrc.abspath, 'w')
-for l in old:
-m_hook = re_style_hook.match(l)
-m_ext = re_style_extension.match(l)
-if m_hook:
-hook, check = m_hook.groups()
-if check != "python:style.check_style":
-print "Warning: %s.style is using a non-default " \
-"checker: %s" % (hook, check)
-if hook not in ("pretxncommit", "pre-qrefresh"):
-print "Warning: Updating unknown style hook: %s" % hook
-
-l = "%s.style = python:hgstyle.check_style\n" % hook
-elif m_ext and m_ext.group(1) == style_extension:
-l = "hgstyle =