Commit 729c71a9 authored by Nikos Skalkotos's avatar Nikos Skalkotos
Browse files

Fix pylint errors

parent 8533d09a
...@@ -58,7 +58,7 @@ BRANCH_TYPES = { ...@@ -58,7 +58,7 @@ BRANCH_TYPES = {
"master": branch_type(True, True, False, "master": branch_type(True, True, False,
"^%s$" % VERSION_RE, "debian"), "^%s$" % VERSION_RE, "debian"),
"hotfix": branch_type(True, True, True, "hotfix": branch_type(True, True, True,
"^(?P<bverstr>^%s\.[1-9][0-9]*)(%s)*$" % r"^(?P<bverstr>^%s\.[1-9][0-9]*)(%s)*$" %
(VERSION_RE, RC_RE), (VERSION_RE, RC_RE),
"debian")} "debian")}
BASE_VERSION_FILE = "version" BASE_VERSION_FILE = "version"
...@@ -146,7 +146,7 @@ def main(): ...@@ -146,7 +146,7 @@ def main():
parser.add_option("--color", parser.add_option("--color",
dest="color_output", dest="color_output",
default="auto", default="auto",
help="Enable/disable colored output. Default mode is" + help="Enable/disable colored output. Default mode is"
" auto, available options are yes/no") " auto, available options are yes/no")
(options, args) = parser.parse_args() (options, args) = parser.parse_args()
...@@ -156,10 +156,7 @@ def main(): ...@@ -156,10 +156,7 @@ def main():
elif options.color_output == "no": elif options.color_output == "no":
use_colors = False use_colors = False
else: else:
if sys.stdout.isatty(): use_colors = sys.stdout.isatty()
use_colors = True
else:
use_colors = False
red = lambda x: x red = lambda x: x
green = lambda x: x green = lambda x: x
...@@ -186,8 +183,8 @@ def main(): ...@@ -186,8 +183,8 @@ def main():
except IndexError: except IndexError:
mode = utils.get_build_mode() mode = utils.get_build_mode()
if mode not in AVAILABLE_MODES: if mode not in AVAILABLE_MODES:
raise ValueError(red("Invalid argument! Mode must be one: %s" raise ValueError(red("Invalid argument! Mode must be one: %s" %
% ", ".join(AVAILABLE_MODES))) ", ".join(AVAILABLE_MODES)))
# Load the repository # Load the repository
original_repo = utils.get_repository() original_repo = utils.get_repository()
...@@ -240,8 +237,8 @@ def main(): ...@@ -240,8 +237,8 @@ def main():
# Create the debian branch # Create the debian branch
repo.git.branch(debian_branch, origin_debian) repo.git.branch(debian_branch, origin_debian)
print_green("Created branch '%s' to track '%s'" % (debian_branch, print_green("Created branch '%s' to track '%s'" %
origin_debian)) (debian_branch, origin_debian))
# Go to debian branch # Go to debian branch
repo.git.checkout(debian_branch) repo.git.checkout(debian_branch)
......
...@@ -79,7 +79,7 @@ def get_hotfix_version(version): ...@@ -79,7 +79,7 @@ def get_hotfix_version(version):
parts = version.split('.') parts = version.split('.')
major_version = int(parts[0]) major_version = int(parts[0])
minor_version = int(parts[1]) minor_version = int(parts[1])
if (len(parts) > 2): if len(parts) > 2:
hotfix_version = int(parts[2]) hotfix_version = int(parts[2])
else: else:
hotfix_version = 0 hotfix_version = 0
...@@ -190,7 +190,7 @@ class GitManager(object): ...@@ -190,7 +190,7 @@ class GitManager(object):
lines.append("* " + commit.message.split("\n")[0]) lines.append("* " + commit.message.split("\n")[0])
lines.append("\n") lines.append("\n")
f = open(changelog, 'rw+') f = open(changelog, 'r+')
lines.extend(f.readlines()) lines.extend(f.readlines())
f.seek(0) f.seek(0)
f.truncate(0) f.truncate(0)
...@@ -267,7 +267,7 @@ class GitManager(object): ...@@ -267,7 +267,7 @@ class GitManager(object):
new_develop_version = "%snext" % version new_develop_version = "%snext" % version
upstream_branch = self.get_branch("hotfix", version) upstream_branch = self.get_branch("hotfix", version)
debian_branch = self.get_debian_branch("hotfix", version) # debian_branch = self.get_debian_branch("hotfix", version)
# create hotfix branch # create hotfix branch
repo.git.branch(upstream_branch, upstream) repo.git.branch(upstream_branch, upstream)
......
...@@ -239,7 +239,7 @@ def get_distribution_codename(): ...@@ -239,7 +239,7 @@ def get_distribution_codename():
try: try:
output = sh.lsb_release("-c") # pylint: disable=E1101 output = sh.lsb_release("-c") # pylint: disable=E1101
_, codename = output.split("\t") _, codename = output.split("\t")
except sh.CommandNotFound as e: except sh.CommandNotFound:
pass pass
codename = codename.strip() codename = codename.strip()
return codename return codename
...@@ -394,11 +394,10 @@ def update_version(): ...@@ -394,11 +394,10 @@ def update_version():
version_templates = list(version_templates) version_templates = list(version_templates)
if len(version_filenames) != len(version_templates): if len(version_filenames) != len(version_templates):
raise RuntimeError("devflow.conf contains '%s' version files and" raise RuntimeError(
" '%s' version templates. The number of version" "devflow.conf contains '%s' version files and '%s' version "
" files and templates must match." "templates. The number of version files and templates must "
% (len(version_filenames), "match." % (len(version_filenames), len(version_templates)))
len(version_templates)))
v_files_templates = zip(version_filenames, version_templates) v_files_templates = zip(version_filenames, version_templates)
for (vfilename, vtemplate) in v_files_templates: for (vfilename, vtemplate) in v_files_templates:
...@@ -441,7 +440,7 @@ def _bump_version(new_version, v): ...@@ -441,7 +440,7 @@ def _bump_version(new_version, v):
sys.stdout.write("Updating version file %s from version '%s' to '%s'\n" sys.stdout.write("Updating version file %s from version '%s' to '%s'\n"
% (version_file, old_version, new_version)) % (version_file, old_version, new_version))
f = open(version_file, 'rw+') f = open(version_file, 'r+')
lines = f.readlines() lines = f.readlines()
for i in range(0, len(lines)): for i in range(0, len(lines)):
if not lines[i].startswith("#"): if not lines[i].startswith("#"):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment