1 |
On 12/03/2016 01:48 PM, Brian Dolbec wrote: |
2 |
> |
3 |
> From c4a61bebca1cfeb0833cefb2c64be6156bdb8e8d Mon Sep 17 00:00:00 2001 |
4 |
> From: "hackers.terabit" <terabit.funtoo@××××××.com> |
5 |
> Date: Thu, 27 Oct 2016 03:29:16 +0000 |
6 |
> Subject: [PATCH] _emerge/depgraph.py: Autounmask-write fails when there isn't |
7 |
> a file in package.*/ bug 598116 |
8 |
> |
9 |
> Instead of outputting "!!! No file to write for ..." error message, |
10 |
> Use a sane default filename. |
11 |
> Add zz- prefix to ensure it remains the last file in sorted order. |
12 |
> |
13 |
> X-Gentoo-bug: 598116 |
14 |
> X-Gentoo-bug-url: https://bugs.gentoo.org/598116 |
15 |
> --- |
16 |
> pym/_emerge/depgraph.py | 6 ++++++ |
17 |
> 1 file changed, 6 insertions(+) |
18 |
> |
19 |
> diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py |
20 |
> index 9161914..7dc1f55 100644 |
21 |
> --- a/pym/_emerge/depgraph.py |
22 |
> +++ b/pym/_emerge/depgraph.py |
23 |
> @@ -8240,6 +8240,12 @@ class depgraph(object): |
24 |
> child.endswith("~"): |
25 |
> continue |
26 |
> stack.append(os.path.join(p, child)) |
27 |
> + # If the directory is empty add a file with name |
28 |
> + # pattern file_name.default |
29 |
> + if last_file_path == None: |
30 |
> + last_file_path=os.path.join(file_path, file_path, "zz-autounmask") |
31 |
> + with open(last_file_path,"a+") as default: |
32 |
> + default.write("# " + file_name) |
33 |
> |
34 |
> return last_file_path |
35 |
> |
36 |
> |
37 |
|
38 |
Patch looks good except it could use these style tweaks: |
39 |
|
40 |
-if last_file_path == None: |
41 |
+if last_file_path is None: |
42 |
|
43 |
-last_file_path=os.path.join(file_path, file_path, "zz-autounmask") |
44 |
+last_file_path = os.path.join(file_path, file_path, "zz-autounmask") |
45 |
|
46 |
-with open(last_file_path,"a+") as default: |
47 |
+with open(last_file_path, "a+") as default: |
48 |
-- |
49 |
Thanks, |
50 |
Zac |