summaryrefslogtreecommitdiff
path: root/linaropy
diff options
context:
space:
mode:
Diffstat (limited to 'linaropy')
-rw-r--r--linaropy/colors.py13
-rw-r--r--linaropy/git/workdir.py4
-rw-r--r--linaropy/rn/rnseries.py28
-rw-r--r--linaropy/rninput.py6
4 files changed, 32 insertions, 19 deletions
diff --git a/linaropy/colors.py b/linaropy/colors.py
new file mode 100644
index 0000000..33d8d16
--- /dev/null
+++ b/linaropy/colors.py
@@ -0,0 +1,13 @@
+RED = "\033[31m"
+BLUE = "\033[34m"
+NC = "\033[0m"
+GREEN = "\033[32m"
+BOLD = "\033[1m"
+ITALIC = "\033[3m"
+
+def print_info(pstr):
+ """ This precedes pstr with two blue asterisks and a space. The input
+ string parameter, pstr, may also contain color codes from
+ linaropy/colors.py embedded in the string. This function always returns
+ the terminal to no-color text after printing pstr. """
+ print BLUE + "** " + NC + pstr + NC
diff --git a/linaropy/git/workdir.py b/linaropy/git/workdir.py
index f729a5a..8de4a81 100644
--- a/linaropy/git/workdir.py
+++ b/linaropy/git/workdir.py
@@ -60,13 +60,13 @@ class Workdir(GitRepo):
(workdir, track))
# TODO: Do we want to prevalidate that 'track' is a valid branch or tag?
# If we don't this will just throw an exception.
- print git_new_workdir(clone.clonedir(), workdir, track, _err_to_out=True, _out="/dev/null")
+ git_new_workdir(clone.clonedir(), workdir, track, _err_to_out=True, _out="/dev/null")
else:
logging.info(
"Workdir(): Calling git new-workdir for workdir %s, tracking %s" %
(workdir, "origin/HEAD"))
# Always just checkout HEAD if the track is not specified.
- print git_new_workdir(clone.clonedir(), workdir, "origin/HEAD", _err_to_out=True, _out="/dev/null")
+ git_new_workdir(clone.clonedir(), workdir, "origin/HEAD", _err_to_out=True, _out="/dev/null")
except ErrorReturnCode as exc:
# if 'workdir' is None
diff --git a/linaropy/rn/rnseries.py b/linaropy/rn/rnseries.py
index 6b69279..9b3063d 100644
--- a/linaropy/rn/rnseries.py
+++ b/linaropy/rn/rnseries.py
@@ -15,6 +15,7 @@ from linaroseries import linaroSeriesFromBranchname
from template import RNTemplate
from ..rninput import yninput
+from ..colors import *
# Abstract base class for a release-notes series
# Every RNSeries has a templateRN instance and a workdir. The template
@@ -139,13 +140,11 @@ class RNSeries(object):
remote_track = self.rn_clone.remote_branchname(
self.track_series.branchname())
if not self.rn_series:
- print("Looking for branch %s" % self.track_series.branchname())
+ logging.info("Looking for branch %s" % self.track_series.branchname())
# The workdir for the first candidate series will be derived from
# the changes made to the master branch templates. The workdir for
# subsequent candidates and releases will be made based on the
# existing candidate or release branch.
- # if not
- # self.rn_clone.branchexists(self.track_series.branchname()):
if not self.rn_clone.branchexists(remote_track):
logging.info(
"Creating RNSeries based on branch "
@@ -159,9 +158,8 @@ class RNSeries(object):
branchname=self.next_series.branchname())
else:
logging.info(
- "MARK Creating RNSeries based on branch "
+ "Creating RNSeries based on branch "
+ remote_track)
- # + self.track_series.branchname())
self.rn_series = Workdir(
proj=self.proj,
@@ -169,16 +167,16 @@ class RNSeries(object):
workdir=self.next_series.shorttype(),
track=remote_track,
branchname=self.next_series.branchname())
- # track=self.track_series.branchname(),
-
- logging.warning(
- "If you updated the template README.textile.series file"
- " the changes will not be reflected in this series"
- " README.textile.series as this series is derived from %s."
- " Please make the changes to the series"
- " README.textile.series file as well." %
- remote_track)
- # self.track_series.branchname())
+
+ print_info(
+ " If you updated the template README.textile.series file"
+ " the changes will not be reflected in this series")
+ print_info(
+ " README.textile.series as this series is derived from"
+ " the %s%s%s%s" % (BOLD, RED, remote_track, NC))
+ print_info(
+ " series release notes. Please make the changes to the"
+ " series README.textile.series file as well.")
# TODO: Ask if the user would like to merge the changes in
# the template README.textile.series file instead of the
diff --git a/linaropy/rninput.py b/linaropy/rninput.py
index d440a5b..6f4e346 100644
--- a/linaropy/rninput.py
+++ b/linaropy/rninput.py
@@ -1,6 +1,8 @@
# For fileIO
import os.path
+from colors import *
+
# @message - The question to display to the user.
# @default - The default if <enter> is hit.
# @accept - The list of valid responses.
@@ -19,7 +21,7 @@ def yninput(message, default="n", accept=['yes', 'y', 'no', 'n'], retry=True):
default_msg = " [Y/n]: "
while(1):
- answer = raw_input(message + default_msg) or default.lower()
+ answer = raw_input(BLUE + "** " + NC + BOLD + message + default_msg + NC) or default.lower()
if answer.lower() not in accept and retry:
print "'%s' is an invalid response. Please try again." % answer.lower()
continue
@@ -33,7 +35,7 @@ def yninput(message, default="n", accept=['yes', 'y', 'no', 'n'], retry=True):
def finput(message, orval):
while(1):
- answer = raw_input(message) or orval
+ answer = raw_input(BLUE + "** " + NC + BOLD + message + NC) or orval
if os.path.exists(answer) and os.path.isfile(answer):
return answer