Merge lp:~mvo/click/do-not-crash-in-build-on-broken-symlinks into lp:click/devel

Proposed by Michael Vogt
Status: Merged
Merged at revision: 548
Proposed branch: lp:~mvo/click/do-not-crash-in-build-on-broken-symlinks
Merge into: lp:click/devel
Diff against target: 28 lines (+6/-1)
2 files modified
click/build.py (+4/-1)
click/tests/test_build.py (+2/-0)
To merge this branch: bzr merge lp:~mvo/click/do-not-crash-in-build-on-broken-symlinks
Reviewer Review Type Date Requested Status
Colin Watson Approve
Review via email: mp+246875@code.launchpad.net

Description of the change

Right now click build will crash if there is a broken symlink in the click.
This branch fixes this crash.

To post a comment you must log in.
Revision history for this message
Colin Watson (cjwatson) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'click/build.py'
2--- click/build.py 2014-05-05 13:10:19 +0000
3+++ click/build.py 2015-01-19 10:27:52 +0000
4@@ -274,7 +274,10 @@
5 with open(md5sums_path, "w") as md5sums:
6 for path in sorted(self.list_files(root_path)):
7 md5 = hashlib.md5()
8- with open(os.path.join(root_path, path), "rb") as f:
9+ p = os.path.join(root_path, path)
10+ if not os.path.exists(p):
11+ continue
12+ with open(p, "rb") as f:
13 while True:
14 buf = f.read(16384)
15 if not buf:
16
17=== modified file 'click/tests/test_build.py'
18--- click/tests/test_build.py 2014-09-04 13:41:30 +0000
19+++ click/tests/test_build.py 2015-01-19 10:27:52 +0000
20@@ -134,6 +134,8 @@
21 touch(os.path.join(scratch, ".git", "config"))
22 with mkfile(os.path.join(scratch, "toplevel")) as f:
23 f.write("test /toplevel\n")
24+ os.symlink(
25+ "file-does-not-exist", os.path.join(scratch, "broken-symlink"))
26 with mkfile(os.path.join(scratch, "manifest.json")) as f:
27 json.dump({
28 "name": "com.example.test",

Subscribers

People subscribed via source and target branches

to all changes: