Merge lp:~elopio/snapcraft/fix1474022-lower_case into lp:~snappy-dev/snapcraft/core
- fix1474022-lower_case
- Merge into core
Proposed by
Leo Arias
Status: | Merged | ||||
---|---|---|---|---|---|
Approved by: | Michael Terry | ||||
Approved revision: | 81 | ||||
Merged at revision: | 76 | ||||
Proposed branch: | lp:~elopio/snapcraft/fix1474022-lower_case | ||||
Merge into: | lp:~snappy-dev/snapcraft/core | ||||
Diff against target: |
591 lines (+93/-93) 12 files modified
snapcraft/__init__.py (+6/-6) snapcraft/cmds.py (+10/-10) snapcraft/common.py (+2/-2) snapcraft/plugin.py (+32/-32) snapcraft/plugins/autotools_project.py (+2/-2) snapcraft/plugins/cmake_project.py (+1/-1) snapcraft/plugins/go14.py (+1/-1) snapcraft/plugins/make_project.py (+1/-1) snapcraft/plugins/ubuntu.py (+11/-11) snapcraft/yaml.py (+15/-15) tests/unit/test_cmds.py (+4/-4) tests/unit/test_plugin.py (+8/-8) |
||||
To merge this branch: | bzr merge lp:~elopio/snapcraft/fix1474022-lower_case | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Michael Terry (community) | Approve | ||
Review via email:
|
Commit message
Refactored all methods to be lowercase, following pep8.
Description of the change
Still missing: lowercase attributes and arguments.
To post a comment you must log in.
Revision history for this message
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Michael Terry (mterry) wrote : | # |
Revision history for this message
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Leo Arias (elopio) wrote : | # |
> Missed one internal function I noticed, but otherwise seems fine, yeah.
> Thanks :)
done.
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-07-09 20:08:38 +0000 |
3 | +++ snapcraft/__init__.py 2015-07-13 16:27:03 +0000 |
4 | @@ -36,7 +36,7 @@ |
5 | def build(self): |
6 | return True |
7 | |
8 | - def snapFiles(self): |
9 | + def snap_files(self): |
10 | """Returns two iteratables of globs: |
11 | - the first is the set of files/dirs to include |
12 | - the second is the set of files/dirs to exclude |
13 | @@ -57,20 +57,20 @@ |
14 | print(cmd) |
15 | return snapcraft.common.run(cmd, cwd=cwd, **kwargs) |
16 | |
17 | - def pullBzr(self, url): |
18 | + def pull_bzr(self, url): |
19 | if os.path.exists(os.path.join(self.sourcedir, ".bzr")): |
20 | return self.run(['bzr', 'pull', url], cwd=self.sourcedir) |
21 | else: |
22 | os.rmdir(self.sourcedir) |
23 | return self.run(['bzr', 'branch', url, self.sourcedir]) |
24 | |
25 | - def pullGit(self, url): |
26 | + def pull_git(self, url): |
27 | if os.path.exists(os.path.join(self.sourcedir, ".git")): |
28 | return self.run(['git', 'pull'], cwd=self.sourcedir) |
29 | else: |
30 | return self.run(['git', 'clone', url, '.'], cwd=self.sourcedir) |
31 | |
32 | - def pullBranch(self, url): |
33 | + def pull_branch(self, url): |
34 | branchType = None |
35 | if url.startswith("bzr:") or url.startswith("lp:"): |
36 | branchType = 'bzr' |
37 | @@ -87,12 +87,12 @@ |
38 | url = os.path.abspath(url) |
39 | |
40 | if branchType == 'bzr': |
41 | - if not self.pullBzr(url): |
42 | + if not self.pull_bzr(url): |
43 | return False |
44 | if not self.run(['cp', '-Trfa', self.sourcedir, self.builddir]): |
45 | return False |
46 | elif branchType == "git": |
47 | - if not self.pullGit(url): |
48 | + if not self.pull_git(url): |
49 | return False |
50 | if not self.run(['cp', '-Trfa', self.sourcedir, self.builddir]): |
51 | return False |
52 | |
53 | === modified file 'snapcraft/cmds.py' |
54 | --- snapcraft/cmds.py 2015-07-08 20:45:52 +0000 |
55 | +++ snapcraft/cmds.py 2015-07-13 16:27:03 +0000 |
56 | @@ -31,7 +31,7 @@ |
57 | sys.exit(1) |
58 | yaml = 'parts:\n' |
59 | for partName in args.part: |
60 | - part = snapcraft.plugin.loadPlugin(partName, partName, loadCode=False) |
61 | + part = snapcraft.plugin.load_plugin(partName, partName, loadCode=False) |
62 | yaml += ' ' + part.names()[0] + ':\n' |
63 | for opt in part.config.get('options', []): |
64 | if part.config['options'][opt].get('required', False): |
65 | @@ -47,7 +47,7 @@ |
66 | |
67 | def shell(args): |
68 | config = snapcraft.yaml.Config() |
69 | - snapcraft.common.env = config.stageEnv() |
70 | + snapcraft.common.env = config.stage_env() |
71 | userCommand = args.userCommand |
72 | if not userCommand: |
73 | userCommand = "/usr/bin/env PS1='\[\e[1;32m\]snapcraft:\w\$\[\e[0m\] ' /bin/bash --norc" |
74 | @@ -64,10 +64,10 @@ |
75 | "cp -arv %s %s" % (config.data["snap"]["meta"], snapcraft.common.snapdir)) |
76 | |
77 | # wrap all included commands |
78 | - snapcraft.common.env = config.snapEnv() |
79 | - script = "#!/bin/sh\n%s\nexec %%s $*" % snapcraft.common.assembleEnv().replace(snapcraft.common.snapdir, "$SNAP_APP_PATH") |
80 | + snapcraft.common.env = config.snap_env() |
81 | + script = "#!/bin/sh\n%s\nexec %%s $*" % snapcraft.common.assemble_env().replace(snapcraft.common.snapdir, "$SNAP_APP_PATH") |
82 | |
83 | - def wrapBins(bindir): |
84 | + def wrap_bins(bindir): |
85 | absbindir = os.path.join(snapcraft.common.snapdir, bindir) |
86 | if not os.path.exists(absbindir): |
87 | return |
88 | @@ -83,8 +83,8 @@ |
89 | with open(exePath, 'w+') as f: |
90 | f.write(script % ('"$SNAP_APP_PATH/' + bindir + '/' + exe + '.real"')) |
91 | os.chmod(exePath, 0o755) |
92 | - wrapBins('bin') |
93 | - wrapBins('usr/bin') |
94 | + wrap_bins('bin') |
95 | + wrap_bins('usr/bin') |
96 | |
97 | snapcraft.common.run("snappy build " + snapcraft.common.snapdir) |
98 | |
99 | @@ -134,7 +134,7 @@ |
100 | qemu.kill() |
101 | |
102 | |
103 | -def checkForCollisions(parts): |
104 | +def check_for_collisions(parts): |
105 | partsFiles = {} |
106 | for part in parts: |
107 | # Gather our own files up |
108 | @@ -190,10 +190,10 @@ |
109 | # allParts. But then we need to make sure we continue to handle |
110 | # cases like go, where you want go built before trying to pull |
111 | # a go project. |
112 | - if not checkForCollisions(config.allParts): |
113 | + if not check_for_collisions(config.allParts): |
114 | sys.exit(1) |
115 | |
116 | - snapcraft.common.env = config.buildEnvForPart(part) |
117 | + snapcraft.common.env = config.build_env_for_part(part) |
118 | force = forceAll or cmd == forceCommand |
119 | if not getattr(part, cmd)(force=force): |
120 | snapcraft.common.log("Failed doing %s for %s!" % (cmd, part.names()[0])) |
121 | |
122 | === modified file 'snapcraft/common.py' |
123 | --- snapcraft/common.py 2015-07-06 16:48:22 +0000 |
124 | +++ snapcraft/common.py 2015-07-13 16:27:03 +0000 |
125 | @@ -23,7 +23,7 @@ |
126 | env = [] |
127 | |
128 | |
129 | -def assembleEnv(): |
130 | +def assemble_env(): |
131 | return '\n'.join(['export ' + e for e in env]) |
132 | |
133 | |
134 | @@ -32,7 +32,7 @@ |
135 | if isinstance(cmd, list): |
136 | cmd = ' '.join(cmd) |
137 | with tempfile.NamedTemporaryFile(mode='w+') as f: |
138 | - f.write(assembleEnv()) |
139 | + f.write(assemble_env()) |
140 | f.write('\n') |
141 | f.write('exec ' + cmd) |
142 | f.flush() |
143 | |
144 | === modified file 'snapcraft/plugin.py' |
145 | --- snapcraft/plugin.py 2015-07-10 18:35:43 +0000 |
146 | +++ snapcraft/plugin.py 2015-07-13 16:27:03 +0000 |
147 | @@ -122,16 +122,16 @@ |
148 | except FileExistsError: |
149 | pass |
150 | |
151 | - def isValid(self): |
152 | + def is_valid(self): |
153 | return self.valid |
154 | |
155 | def names(self): |
156 | return self.partNames |
157 | |
158 | - def notifyStage(self, stage, hint=''): |
159 | + def notify_stage(self, stage, hint=''): |
160 | snapcraft.common.log(stage + " " + self.partNames[0] + hint) |
161 | |
162 | - def isDirty(self, stage): |
163 | + def is_dirty(self, stage): |
164 | try: |
165 | with open(self.statefile, 'r') as f: |
166 | lastStep = f.read() |
167 | @@ -139,70 +139,70 @@ |
168 | except Exception: |
169 | return True |
170 | |
171 | - def shouldStageRun(self, stage, force): |
172 | - if not force and not self.isDirty(stage): |
173 | - self.notifyStage('Skipping ' + stage, ' (already ran)') |
174 | + def should_stage_run(self, stage, force): |
175 | + if not force and not self.is_dirty(stage): |
176 | + self.notify_stage('Skipping ' + stage, ' (already ran)') |
177 | return False |
178 | return True |
179 | |
180 | - def markDone(self, stage): |
181 | + def mark_done(self, stage): |
182 | with open(self.statefile, 'w+') as f: |
183 | f.write(stage) |
184 | |
185 | def pull(self, force=False): |
186 | - if not self.shouldStageRun('pull', force): |
187 | + if not self.should_stage_run('pull', force): |
188 | return True |
189 | self.makedirs() |
190 | if self.code and hasattr(self.code, 'pull'): |
191 | - self.notifyStage("Pulling") |
192 | + self.notify_stage("Pulling") |
193 | if not getattr(self.code, 'pull')(): |
194 | return False |
195 | - self.markDone('pull') |
196 | + self.mark_done('pull') |
197 | return True |
198 | |
199 | def build(self, force=False): |
200 | - if not self.shouldStageRun('build', force): |
201 | + if not self.should_stage_run('build', force): |
202 | return True |
203 | self.makedirs() |
204 | if self.code and hasattr(self.code, 'build'): |
205 | - self.notifyStage("Building") |
206 | + self.notify_stage("Building") |
207 | if not getattr(self.code, 'build')(): |
208 | return False |
209 | - self.markDone('build') |
210 | + self.mark_done('build') |
211 | return True |
212 | |
213 | def stage(self, force=False): |
214 | - if not self.shouldStageRun('stage', force): |
215 | + if not self.should_stage_run('stage', force): |
216 | return True |
217 | self.makedirs() |
218 | if not self.code: |
219 | return True |
220 | |
221 | - self.notifyStage("Staging") |
222 | + self.notify_stage("Staging") |
223 | snapcraft.common.run(['cp', '-arT', self.installdir, self.stagedir]) |
224 | - self.markDone('stage') |
225 | + self.mark_done('stage') |
226 | return True |
227 | |
228 | def snap(self, force=False): |
229 | - if not self.shouldStageRun('snap', force): |
230 | + if not self.should_stage_run('snap', force): |
231 | return True |
232 | self.makedirs() |
233 | |
234 | - if self.code and hasattr(self.code, 'snapFiles'): |
235 | - self.notifyStage("Snapping") |
236 | + if self.code and hasattr(self.code, 'snap_files'): |
237 | + self.notify_stage("Snapping") |
238 | |
239 | - includes, excludes = getattr(self.code, 'snapFiles')() |
240 | - snapDirs, snapFiles = self.collectSnapFiles(includes, excludes) |
241 | + includes, excludes = getattr(self.code, 'snap_files')() |
242 | + snapDirs, snap_files = self.collect_snap_files(includes, excludes) |
243 | |
244 | if snapDirs: |
245 | snapcraft.common.run(['mkdir', '-p'] + list(snapDirs), cwd=self.stagedir) |
246 | - if snapFiles: |
247 | - snapcraft.common.run(['cp', '-a', '--parent'] + list(snapFiles) + [self.snapdir], cwd=self.stagedir) |
248 | + if snap_files: |
249 | + snapcraft.common.run(['cp', '-a', '--parent'] + list(snap_files) + [self.snapdir], cwd=self.stagedir) |
250 | |
251 | - self.markDone('snap') |
252 | + self.mark_done('snap') |
253 | return True |
254 | |
255 | - def collectSnapFiles(self, includes, excludes): |
256 | + def collect_snap_files(self, includes, excludes): |
257 | sourceFiles = set() |
258 | for root, dirs, files in os.walk(self.installdir): |
259 | sourceFiles |= set([os.path.join(root, d) for d in dirs]) |
260 | @@ -232,15 +232,15 @@ |
261 | excludeFiles = set([os.path.relpath(x, self.stagedir) for x in excludeFiles]) |
262 | |
263 | # And chop files, including whole trees if any dirs are mentioned |
264 | - snapFiles = (includeFiles & sourceFiles) - excludeFiles |
265 | + snap_files = (includeFiles & sourceFiles) - excludeFiles |
266 | for excludeDir in excludeDirs: |
267 | - snapFiles = set([x for x in snapFiles if not x.startswith(excludeDir + '/')]) |
268 | + snap_files = set([x for x in snap_files if not x.startswith(excludeDir + '/')]) |
269 | |
270 | # Separate dirs from files |
271 | - snapDirs = set([x for x in snapFiles if os.path.isdir(os.path.join(self.stagedir, x))]) |
272 | - snapFiles = snapFiles - snapDirs |
273 | + snapDirs = set([x for x in snap_files if os.path.isdir(os.path.join(self.stagedir, x))]) |
274 | + snap_files = snap_files - snapDirs |
275 | |
276 | - return snapDirs, snapFiles |
277 | + return snapDirs, snap_files |
278 | |
279 | def env(self, root): |
280 | if self.code and hasattr(self.code, 'env'): |
281 | @@ -248,9 +248,9 @@ |
282 | return [] |
283 | |
284 | |
285 | -def loadPlugin(partName, pluginName, properties={}, loadCode=True): |
286 | +def load_plugin(partName, pluginName, properties={}, loadCode=True): |
287 | part = Plugin(pluginName, partName, properties, loadCode=loadCode) |
288 | - if not part.isValid(): |
289 | + if not part.is_valid(): |
290 | snapcraft.common.log("Could not load part %s" % pluginName, file=sys.stderr) |
291 | sys.exit(1) |
292 | return part |
293 | |
294 | === modified file 'snapcraft/plugins/autotools_project.py' |
295 | --- snapcraft/plugins/autotools_project.py 2015-07-08 14:03:15 +0000 |
296 | +++ snapcraft/plugins/autotools_project.py 2015-07-13 16:27:03 +0000 |
297 | @@ -25,7 +25,7 @@ |
298 | self.options.configflags = '' |
299 | |
300 | def pull(self): |
301 | - return self.pullBranch(self.options.source) |
302 | + return self.pull_branch(self.options.source) |
303 | |
304 | def build(self): |
305 | if not os.path.exists(os.path.join(self.builddir, "configure")): |
306 | @@ -35,5 +35,5 @@ |
307 | return False |
308 | return self.run("make all") and self.run("make install DESTDIR=" + self.installdir) |
309 | |
310 | - def snapFiles(self): |
311 | + def snap_files(self): |
312 | return (['*'], ['include']) |
313 | |
314 | === modified file 'snapcraft/plugins/cmake_project.py' |
315 | --- snapcraft/plugins/cmake_project.py 2015-07-09 13:32:43 +0000 |
316 | +++ snapcraft/plugins/cmake_project.py 2015-07-13 16:27:03 +0000 |
317 | @@ -24,7 +24,7 @@ |
318 | self.options.configflags = '' |
319 | |
320 | def pull(self): |
321 | - return self.pullBranch(self.options.source) |
322 | + return self.pull_branch(self.options.source) |
323 | |
324 | def build(self): |
325 | return self.run('cmake . -DCMAKE_INSTALL_PREFIX= %s' % self.options.configflags) and \ |
326 | |
327 | === modified file 'snapcraft/plugins/go14.py' |
328 | --- snapcraft/plugins/go14.py 2015-07-08 14:03:15 +0000 |
329 | +++ snapcraft/plugins/go14.py 2015-07-13 16:27:03 +0000 |
330 | @@ -45,5 +45,5 @@ |
331 | self.makedirs(targetdir) |
332 | return self.run(['tar', 'xf', tar_file], cwd=targetdir) |
333 | |
334 | - def snapFiles(self): |
335 | + def snap_files(self): |
336 | return ([], []) |
337 | |
338 | === modified file 'snapcraft/plugins/make_project.py' |
339 | --- snapcraft/plugins/make_project.py 2015-07-08 14:03:15 +0000 |
340 | +++ snapcraft/plugins/make_project.py 2015-07-13 16:27:03 +0000 |
341 | @@ -20,7 +20,7 @@ |
342 | class MakePlugin(snapcraft.BasePlugin): |
343 | |
344 | def pull(self): |
345 | - return self.pullBranch(self.options.source) |
346 | + return self.pull_branch(self.options.source) |
347 | |
348 | def build(self): |
349 | return self.run("make") and self.run("make install DESTDIR=" + self.installdir) |
350 | |
351 | === modified file 'snapcraft/plugins/ubuntu.py' |
352 | --- snapcraft/plugins/ubuntu.py 2015-07-08 14:03:15 +0000 |
353 | +++ snapcraft/plugins/ubuntu.py 2015-07-13 16:27:03 +0000 |
354 | @@ -37,18 +37,18 @@ |
355 | self.includedPackages.append(name) |
356 | |
357 | def pull(self): |
358 | - self.downloadablePackages = self.getAllDepPackages(self.includedPackages) |
359 | - return self.downloadDebs(self.downloadablePackages) |
360 | + self.downloadablePackages = self.get_all_dep_packages(self.includedPackages) |
361 | + return self.download_debs(self.downloadablePackages) |
362 | |
363 | def build(self): |
364 | if not self.downloadablePackages: |
365 | - self.downloadablePackages = self.getAllDepPackages(self.includedPackages) |
366 | - return self.unpackDebs(self.downloadablePackages, self.installdir) |
367 | + self.downloadablePackages = self.get_all_dep_packages(self.includedPackages) |
368 | + return self.unpack_debs(self.downloadablePackages, self.installdir) |
369 | |
370 | - def snapFiles(self): |
371 | + def snap_files(self): |
372 | return (['*'], ['/usr/include', '/lib/*/*.a', '/usr/lib/*/*.a']) |
373 | |
374 | - def getAllDepPackages(self, packages): |
375 | + def get_all_dep_packages(self, packages): |
376 | cache = apt.Cache() |
377 | alldeps = set() |
378 | manifestdeps = set() |
379 | @@ -60,7 +60,7 @@ |
380 | if pkg in cache: |
381 | manifestdeps.add(pkg) |
382 | |
383 | - def addDeps(pkgs): |
384 | + def add_deps(pkgs): |
385 | for p in pkgs: |
386 | if p in alldeps: |
387 | continue |
388 | @@ -72,11 +72,11 @@ |
389 | candidatePkg = cache[p].candidate |
390 | deps = candidatePkg.dependencies + candidatePkg.recommends |
391 | alldeps.add(p) |
392 | - addDeps([x[0].name for x in deps]) |
393 | + add_deps([x[0].name for x in deps]) |
394 | except: |
395 | pass |
396 | |
397 | - addDeps(packages) |
398 | + add_deps(packages) |
399 | |
400 | exit = False |
401 | for p in packages: |
402 | @@ -88,14 +88,14 @@ |
403 | |
404 | return sorted(alldeps) |
405 | |
406 | - def downloadDebs(self, pkgs, debdir=None): |
407 | + def download_debs(self, pkgs, debdir=None): |
408 | debdir = debdir or self.builddir |
409 | if pkgs: |
410 | return self.run(['dget'] + pkgs, cwd=debdir, stdout=subprocess.DEVNULL) |
411 | else: |
412 | return True |
413 | |
414 | - def unpackDebs(self, pkgs, targetDir, debdir=None): |
415 | + def unpack_debs(self, pkgs, targetDir, debdir=None): |
416 | debdir = debdir or self.builddir |
417 | for p in pkgs: |
418 | if not self.run(['dpkg-deb', '--extract', p + '_*.deb', targetDir], cwd=debdir): |
419 | |
420 | === modified file 'snapcraft/yaml.py' |
421 | --- snapcraft/yaml.py 2015-07-10 18:35:43 +0000 |
422 | +++ snapcraft/yaml.py 2015-07-13 16:27:03 +0000 |
423 | @@ -47,7 +47,7 @@ |
424 | |
425 | # TODO: support 'filter' or 'blacklist' field to filter what gets put in snap/ |
426 | |
427 | - self.loadPlugin(partName, pluginName, properties) |
428 | + self.load_plugin(partName, pluginName, properties) |
429 | |
430 | localPlugins = set() |
431 | for part in self.allParts: |
432 | @@ -68,7 +68,7 @@ |
433 | alreadyPresent = True |
434 | break |
435 | if not alreadyPresent: |
436 | - newParts.append(self.loadPlugin(requiredPart, requiredPart, {})) |
437 | + newParts.append(self.load_plugin(requiredPart, requiredPart, {})) |
438 | |
439 | # Gather lists of dependencies |
440 | for part in self.allParts: |
441 | @@ -104,55 +104,55 @@ |
442 | self.allParts.remove(topPart) |
443 | self.allParts = sortedParts |
444 | |
445 | - def loadPlugin(self, partName, pluginName, properties, loadCode=True): |
446 | - part = snapcraft.plugin.loadPlugin(partName, pluginName, properties, loadCode=loadCode) |
447 | + def load_plugin(self, partName, pluginName, properties, loadCode=True): |
448 | + part = snapcraft.plugin.load_plugin(partName, pluginName, properties, loadCode=loadCode) |
449 | |
450 | self.systemPackages += part.config.get('systemPackages', []) |
451 | self.allParts.append(part) |
452 | return part |
453 | |
454 | - def runtimeEnv(self, root): |
455 | + def runtime_env(self, root): |
456 | env = [] |
457 | env.append("PATH=\"%s/bin:%s/usr/bin:$PATH\"" % (root, root)) |
458 | env.append("LD_LIBRARY_PATH=\"%s/lib:%s/usr/lib:$LD_LIBRARY_PATH\"" % (root, root)) |
459 | return env |
460 | |
461 | - def buildEnv(self, root): |
462 | + def build_env(self, root): |
463 | env = [] |
464 | env.append("CFLAGS=\"-I%s/include $CFLAGS\"" % root) |
465 | env.append("LDFLAGS=\"-L%s/lib -L%s/usr/lib $LDFLAGS\"" % (root, root)) |
466 | return env |
467 | |
468 | - def buildEnvForPart(self, part): |
469 | + def build_env_for_part(self, part): |
470 | # Grab build env of all part's dependencies |
471 | |
472 | env = [] |
473 | |
474 | for dep in part.deps: |
475 | root = dep.installdir |
476 | - env += self.runtimeEnv(root) |
477 | - env += self.buildEnv(root) |
478 | + env += self.runtime_env(root) |
479 | + env += self.build_env(root) |
480 | env += dep.env(root) |
481 | - env += self.buildEnvForPart(dep) |
482 | + env += self.build_env_for_part(dep) |
483 | |
484 | return env |
485 | |
486 | - def stageEnv(self): |
487 | + def stage_env(self): |
488 | root = snapcraft.common.stagedir |
489 | env = [] |
490 | |
491 | - env += self.runtimeEnv(root) |
492 | - env += self.buildEnv(root) |
493 | + env += self.runtime_env(root) |
494 | + env += self.build_env(root) |
495 | for part in self.allParts: |
496 | env += part.env(root) |
497 | |
498 | return env |
499 | |
500 | - def snapEnv(self): |
501 | + def snap_env(self): |
502 | root = snapcraft.common.snapdir |
503 | env = [] |
504 | |
505 | - env += self.runtimeEnv(root) |
506 | + env += self.runtime_env(root) |
507 | for part in self.allParts: |
508 | env += part.env(root) |
509 | |
510 | |
511 | === modified file 'tests/unit/test_cmds.py' |
512 | --- tests/unit/test_cmds.py 2015-07-08 18:21:52 +0000 |
513 | +++ tests/unit/test_cmds.py 2015-07-13 16:27:03 +0000 |
514 | @@ -19,13 +19,13 @@ |
515 | import unittest |
516 | from unittest import mock |
517 | |
518 | -from snapcraft.cmds import checkForCollisions |
519 | +from snapcraft.cmds import check_for_collisions |
520 | |
521 | |
522 | class TestCommands(unittest.TestCase): |
523 | |
524 | @mock.patch('snapcraft.common.log') |
525 | - def test_checkForCollisions(self, logmock): |
526 | + def test_check_for_collisions(self, logmock): |
527 | tmpdirObject = tempfile.TemporaryDirectory() |
528 | self.addCleanup(tmpdirObject.cleanup) |
529 | tmpdir = tmpdirObject.name |
530 | @@ -52,8 +52,8 @@ |
531 | open(part3.installdir + '/1', mode='w').close() |
532 | open(part3.installdir + '/a/2', mode='w').close() |
533 | |
534 | - self.assertTrue(checkForCollisions([part1, part2])) |
535 | + self.assertTrue(check_for_collisions([part1, part2])) |
536 | self.assertFalse(logmock.called) |
537 | |
538 | - self.assertFalse(checkForCollisions([part1, part2, part3])) |
539 | + self.assertFalse(check_for_collisions([part1, part2, part3])) |
540 | logmock.assert_called_with("Error: parts part2 and part3 have the following files in common:\n 1\n a/2") |
541 | |
542 | === modified file 'tests/unit/test_plugin.py' |
543 | --- tests/unit/test_plugin.py 2015-07-08 14:03:15 +0000 |
544 | +++ tests/unit/test_plugin.py 2015-07-13 16:27:03 +0000 |
545 | @@ -24,7 +24,7 @@ |
546 | |
547 | class TestPlugin(unittest.TestCase): |
548 | |
549 | - def test_isDirty(self): |
550 | + def test_is_dirty(self): |
551 | p = Plugin("mock", "mock-part", {}, loadConfig=False) |
552 | p.statefile = tempfile.NamedTemporaryFile().name |
553 | self.addCleanup(os.remove, p.statefile) |
554 | @@ -37,7 +37,7 @@ |
555 | p.pull() |
556 | self.assertFalse(p.code.pull.called) |
557 | |
558 | - def test_collectSnapFiles(self): |
559 | + def test_collect_snap_files(self): |
560 | p = Plugin("mock", "mock-part", {}, loadConfig=False) |
561 | |
562 | tmpdirObject = tempfile.TemporaryDirectory() |
563 | @@ -65,22 +65,22 @@ |
564 | open(tmpdir + '/stage/2/2b/a', mode='w').close() |
565 | open(tmpdir + '/stage/3/a', mode='w').close() |
566 | |
567 | - self.assertEqual(p.collectSnapFiles([], []), (set(), set())) |
568 | + self.assertEqual(p.collect_snap_files([], []), (set(), set())) |
569 | |
570 | - self.assertEqual(p.collectSnapFiles(['*'], []), ( |
571 | + self.assertEqual(p.collect_snap_files(['*'], []), ( |
572 | set(['1', '1/1a', '1/1a/1b', '2', '2/2a', '3']), |
573 | set(['a', 'b', '1/a', '3/a']))) |
574 | |
575 | - self.assertEqual(p.collectSnapFiles(['*'], ['1']), ( |
576 | + self.assertEqual(p.collect_snap_files(['*'], ['1']), ( |
577 | set(['2', '2/2a', '3']), |
578 | set(['a', 'b', '3/a']))) |
579 | |
580 | - self.assertEqual(p.collectSnapFiles(['a'], ['*']), (set(), set())) |
581 | + self.assertEqual(p.collect_snap_files(['a'], ['*']), (set(), set())) |
582 | |
583 | - self.assertEqual(p.collectSnapFiles(['*'], ['*/*']), ( |
584 | + self.assertEqual(p.collect_snap_files(['*'], ['*/*']), ( |
585 | set(['1', '2', '3']), |
586 | set(['a', 'b']))) |
587 | |
588 | - self.assertEqual(p.collectSnapFiles(['1', '2'], ['*/a']), ( |
589 | + self.assertEqual(p.collect_snap_files(['1', '2'], ['*/a']), ( |
590 | set(['1', '1/1a', '1/1a/1b', '2', '2/2a']), |
591 | set())) |
Missed one internal function I noticed, but otherwise seems fine, yeah. Thanks :)