Merge lp:~zyga/snapcraft/fix-logging-calls into lp:~snappy-dev/snapcraft/core

Proposed by Zygmunt Krynicki on 2015-08-26
Status: Merged
Approved by: Michael Vogt on 2015-08-26
Approved revision: 136
Merged at revision: 137
Proposed branch: lp:~zyga/snapcraft/fix-logging-calls
Merge into: lp:~snappy-dev/snapcraft/core
Diff against target: 155 lines (+15/-15)
8 files modified
snapcraft/__init__.py (+6/-6)
snapcraft/cmds.py (+2/-2)
snapcraft/plugin.py (+1/-1)
snapcraft/plugins/ant_project.py (+1/-1)
snapcraft/plugins/copy.py (+1/-1)
snapcraft/plugins/maven_project.py (+1/-1)
snapcraft/plugins/ubuntu.py (+2/-2)
snapcraft/yaml.py (+1/-1)
To merge this branch: bzr merge lp:~zyga/snapcraft/fix-logging-calls
Reviewer Review Type Date Requested Status
Michael Vogt 2015-08-26 Approve on 2015-08-26
Review via email: mp+269167@code.launchpad.net

Commit Message

Correct all the logging calls to pass arguments directly

To post a comment you must log in.
Michael Vogt (mvo) wrote :

LGTM.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'snapcraft/__init__.py'
2--- snapcraft/__init__.py 2015-08-05 20:43:07 +0000
3+++ snapcraft/__init__.py 2015-08-26 09:04:25 +0000
4@@ -77,7 +77,7 @@
5
6 def pull_hg(self, source, source_tag=None, source_branch=None):
7 if source_tag and source_branch:
8- logger.error("You can't specify both source-tag and source-branch for a mercurial source (part '%s')." % self.name)
9+ logger.error("You can't specify both source-tag and source-branch for a mercurial source (part '%s').", self.name)
10 snapcraft.common.fatal()
11
12 if os.path.exists(os.path.join(self.sourcedir, ".hg")):
13@@ -96,7 +96,7 @@
14
15 def pull_git(self, source, source_tag=None, source_branch=None):
16 if source_tag and source_branch:
17- logger.error("You can't specify both source-tag and source-branch for a git source (part '%s')." % self.name)
18+ logger.error("You can't specify both source-tag and source-branch for a git source (part '%s').", self.name)
19 snapcraft.common.fatal()
20
21 if os.path.exists(os.path.join(self.sourcedir, ".git")):
22@@ -167,12 +167,12 @@
23 elif source.startswith("git:"):
24 source_type = 'git'
25 elif self.isurl(source):
26- logger.error("Unrecognized source '%s' for part '%s'." % (source, self.name))
27+ logger.error("Unrecognized source '%s' for part '%s'.", source, self.name)
28 snapcraft.common.fatal()
29
30 if source_type == 'bzr':
31 if source_branch:
32- logger.error("You can't specify source-branch for a bzr source (part '%s')." % self.name)
33+ logger.error("You can't specify source-branch for a bzr source (part '%s').", self.name)
34 snapcraft.common.fatal()
35 if not self.pull_bzr(source, source_tag=source_tag):
36 return False
37@@ -190,10 +190,10 @@
38 return False
39 elif source_type == 'tar':
40 if source_branch:
41- logger.error("You can't specify source-branch for a tar source (part '%s')." % self.name)
42+ logger.error("You can't specify source-branch for a tar source (part '%s').", self.name)
43 snapcraft.common.fatal()
44 if source_tag:
45- logger.error("You can't specify source-tag for a tar source (part '%s')." % self.name)
46+ logger.error("You can't specify source-tag for a tar source (part '%s').", self.name)
47 snapcraft.common.fatal()
48 if not self.pull_tarball(source):
49 return False
50
51=== modified file 'snapcraft/cmds.py'
52--- snapcraft/cmds.py 2015-08-05 14:38:33 +0000
53+++ snapcraft/cmds.py 2015-08-26 09:04:25 +0000
54@@ -216,7 +216,7 @@
55 for otherPartName in partsFiles:
56 common = partFiles & partsFiles[otherPartName]
57 if common:
58- logger.error('Error: parts %s and %s have the following files in common:\n %s' % (otherPartName, part.names()[0], '\n '.join(sorted(common))))
59+ logger.error('Error: parts %s and %s have the following files in common:\n %s', otherPartName, part.names()[0], '\n '.join(sorted(common)))
60 return False
61
62 # And add our files to the list
63@@ -262,5 +262,5 @@
64 common.env = config.build_env_for_part(part)
65 force = forceAll or cmd == forceCommand
66 if not getattr(part, cmd)(force=force):
67- logger.error('Failed doing %s for %s!' % (cmd, part.names()[0]))
68+ logger.error('Failed doing %s for %s!', cmd, part.names()[0])
69 sys.exit(1)
70
71=== modified file 'snapcraft/plugin.py'
72--- snapcraft/plugin.py 2015-08-05 14:25:54 +0000
73+++ snapcraft/plugin.py 2015-08-26 09:04:25 +0000
74@@ -266,6 +266,6 @@
75 def load_plugin(part_name, plugin_name, properties={}, load_code=True):
76 part = PluginHandler(plugin_name, part_name, properties, load_code=load_code)
77 if not part.is_valid():
78- logger.error('Could not load part {}'.format(plugin_name))
79+ logger.error('Could not load part %s', plugin_name)
80 sys.exit(1)
81 return part
82
83=== modified file 'snapcraft/plugins/ant_project.py'
84--- snapcraft/plugins/ant_project.py 2015-07-23 14:23:29 +0000
85+++ snapcraft/plugins/ant_project.py 2015-08-26 09:04:25 +0000
86@@ -36,7 +36,7 @@
87 return False
88 files = glob.glob(os.path.join(self.builddir, 'target', '*.jar'))
89 if not files:
90- logger.error('Could not find any built jar files for part %s' % self.name)
91+ logger.error('Could not find any built jar files for part %s', self.name)
92 sys.exit(1)
93 jardir = os.path.join(self.installdir, 'jar')
94 return self.run(['mkdir', '-p', jardir]) and \
95
96=== modified file 'snapcraft/plugins/copy.py'
97--- snapcraft/plugins/copy.py 2015-07-30 18:46:42 +0000
98+++ snapcraft/plugins/copy.py 2015-08-26 09:04:25 +0000
99@@ -30,7 +30,7 @@
100 for src in sorted(self.options.files):
101 dst = self.options.files[src]
102 if not os.path.lexists(src):
103- logger.warning("WARNING: file '%s' missing" % src)
104+ logger.warning("WARNING: file '%s' missing", src)
105 res = False
106 continue
107 dst = os.path.join(self.installdir, dst)
108
109=== modified file 'snapcraft/plugins/maven_project.py'
110--- snapcraft/plugins/maven_project.py 2015-08-18 11:25:21 +0000
111+++ snapcraft/plugins/maven_project.py 2015-08-26 09:04:25 +0000
112@@ -36,7 +36,7 @@
113 jarfiles = glob.glob(os.path.join(self.builddir, 'target', '*.jar'))
114 warfiles = glob.glob(os.path.join(self.builddir, 'target', '*.war'))
115 if not (jarfiles or warfiles):
116- logger.error('Could not find any built jar or war files for part {}'.format(self.name))
117+ logger.error('Could not find any built jar or war files for part %s', self.name)
118 snapcraft.common.fatal()
119 if jarfiles:
120 jardir = os.path.join(self.installdir, 'jar')
121
122=== modified file 'snapcraft/plugins/ubuntu.py'
123--- snapcraft/plugins/ubuntu.py 2015-08-06 11:18:47 +0000
124+++ snapcraft/plugins/ubuntu.py 2015-08-26 09:04:25 +0000
125@@ -39,7 +39,7 @@
126 else:
127 # User didn't specify a package, use the part name
128 if name == 'ubuntu':
129- logger.error('Part %s needs either a package option or a name' % name)
130+ logger.error('Part %s needs either a package option or a name', name)
131 sys.exit(1)
132 self.included_packages.append(name)
133
134@@ -94,7 +94,7 @@
135 for p in packages:
136 if p not in alldeps:
137 exit = True
138- logger.error("Package '{}' not recognized".format(p))
139+ logger.error("Package '%s' not recognized", p)
140 if exit:
141 sys.exit(1)
142
143
144=== modified file 'snapcraft/yaml.py'
145--- snapcraft/yaml.py 2015-07-31 20:14:25 +0000
146+++ snapcraft/yaml.py 2015-08-26 09:04:25 +0000
147@@ -81,7 +81,7 @@
148 foundIt = True
149 break
150 if not foundIt:
151- logger.error("Could not find part name %s" % dep)
152+ logger.error("Could not find part name %s", dep)
153 sys.exit(1)
154
155 # Now sort them (this is super inefficient, but easy-ish to follow)

Subscribers

People subscribed via source and target branches