Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(10)

Unified Diff: tools/push-to-trunk/common_includes.py

Issue 594773003: Refactoring: Remove global configs in release scripts. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Remove global configs. Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/push-to-trunk/chromium_roll.py ('k') | tools/push-to-trunk/merge_to_branch.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/push-to-trunk/common_includes.py
diff --git a/tools/push-to-trunk/common_includes.py b/tools/push-to-trunk/common_includes.py
index 83e015689530810e43a90d23a11bae9db7d56ef3..00fb0971227b541978802308fa50d83b94b6df7b 100644
--- a/tools/push-to-trunk/common_includes.py
+++ b/tools/push-to-trunk/common_includes.py
@@ -45,13 +45,6 @@ import urllib2
from git_recipes import GitRecipesMixin
from git_recipes import GitFailedException
-PERSISTFILE_BASENAME = "PERSISTFILE_BASENAME"
-BRANCHNAME = "BRANCHNAME"
-CHANGELOG_FILE = "CHANGELOG_FILE"
-CHANGELOG_ENTRY_FILE = "CHANGELOG_ENTRY_FILE"
-COMMITMSG_FILE = "COMMITMSG_FILE"
-PATCH_FILE = "PATCH_FILE"
-
VERSION_FILE = os.path.join("src", "version.cc")
# V8 base directory.
@@ -294,7 +287,7 @@ class Step(GitRecipesMixin):
def Run(self):
# Restore state.
- state_file = "%s-state.json" % self._config[PERSISTFILE_BASENAME]
+ state_file = "%s-state.json" % self._config["PERSISTFILE_BASENAME"]
if not self._state and os.path.exists(state_file):
self._state.update(json.loads(FileToText(state_file)))
@@ -433,15 +426,15 @@ class Step(GitRecipesMixin):
def PrepareBranch(self):
# Delete the branch that will be created later if it exists already.
- self.DeleteBranch(self._config[BRANCHNAME])
+ self.DeleteBranch(self._config["BRANCHNAME"])
def CommonCleanup(self):
self.GitCheckout(self["current_branch"])
- if self._config[BRANCHNAME] != self["current_branch"]:
- self.GitDeleteBranch(self._config[BRANCHNAME])
+ if self._config["BRANCHNAME"] != self["current_branch"]:
+ self.GitDeleteBranch(self._config["BRANCHNAME"])
# Clean up all temporary files.
- for f in glob.iglob("%s*" % self._config[PERSISTFILE_BASENAME]):
+ for f in glob.iglob("%s*" % self._config["PERSISTFILE_BASENAME"]):
if os.path.isfile(f):
os.remove(f)
if os.path.isdir(f):
@@ -526,12 +519,12 @@ class Step(GitRecipesMixin):
def SVNCommit(self, root, commit_message):
patch = self.GitDiff("HEAD^", "HEAD")
- TextToFile(patch, self._config[PATCH_FILE])
+ TextToFile(patch, self._config["PATCH_FILE"])
self.Command("svn", "update", cwd=self._options.svn)
if self.Command("svn", "status", cwd=self._options.svn) != "":
self.Die("SVN checkout not clean.")
if not self.Command("patch", "-d %s -p1 -i %s" %
- (root, self._config[PATCH_FILE]),
+ (root, self._config["PATCH_FILE"]),
cwd=self._options.svn):
self.Die("Could not apply patch.")
self.Command(
@@ -608,9 +601,11 @@ def MakeStep(step_class=Step, number=0, state=None, config=None,
class ScriptsBase(object):
# TODO(machenbach): Move static config here.
tandrii(chromium) 2014/09/23 14:45:25 Is this still TODO?
Michael Achenbach 2014/09/25 08:17:41 Ups no. This is exactly what the todo was about...
- def __init__(self, config, side_effect_handler=DEFAULT_SIDE_EFFECT_HANDLER,
+ def __init__(self,
+ config=None,
+ side_effect_handler=DEFAULT_SIDE_EFFECT_HANDLER,
state=None):
- self._config = config
+ self._config = config or self._Config()
self._side_effect_handler = side_effect_handler
self._state = state if state is not None else {}
@@ -626,6 +621,9 @@ class ScriptsBase(object):
def _Steps(self): # pragma: no cover
raise Exception("Not implemented.")
+ def _Config(self):
+ return {}
+
def MakeOptions(self, args=None):
parser = argparse.ArgumentParser(description=self._Description())
parser.add_argument("-a", "--author", default="",
@@ -691,7 +689,7 @@ class ScriptsBase(object):
if not options:
return 1
- state_file = "%s-state.json" % self._config[PERSISTFILE_BASENAME]
+ state_file = "%s-state.json" % self._config["PERSISTFILE_BASENAME"]
if options.step == 0 and os.path.exists(state_file):
os.remove(state_file)
« no previous file with comments | « tools/push-to-trunk/chromium_roll.py ('k') | tools/push-to-trunk/merge_to_branch.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698