1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
|
diff -aur michel-orgmode.pristine/michel/diff3.py michel-orgmode.new/michel/diff3.py
--- michel-orgmode.pristine/michel/diff3.py 2016-09-01 16:24:44.290659982 +0200
+++ michel-orgmode.new/michel/diff3.py 2016-09-01 16:46:02.570976348 +0200
@@ -9,9 +9,9 @@
"Perform diff3 merge on the text-string arguments."
# create temp files for operating on with diff3 tool
- my_file = tempfile.NamedTemporaryFile()
- orig_file = tempfile.NamedTemporaryFile()
- other_file = tempfile.NamedTemporaryFile()
+ my_file = tempfile.NamedTemporaryFile("w")
+ orig_file = tempfile.NamedTemporaryFile("w")
+ other_file = tempfile.NamedTemporaryFile("w")
# write text strings to files
my_file.write(my_text)
@@ -25,17 +25,19 @@
# call the diff3 executable, and collect results
p = subprocess.Popen([
- 'diff3',
- '-m',
- '-L', 'MINE',
- '-L', 'ORIGINAL',
- '-L', 'OTHER',
- my_file.name,
- orig_file.name,
- other_file.name
- ],
- stdout=subprocess.PIPE,
- stderr=subprocess.PIPE)
+ 'diff3',
+ '-m',
+ '-L', 'MINE',
+ '-L', 'ORIGINAL',
+ '-L', 'OTHER',
+ my_file.name,
+ orig_file.name,
+ other_file.name
+ ],
+ stdout=subprocess.PIPE,
+ stderr=subprocess.PIPE,
+ universal_newlines=True
+ )
stdout_text, stderr_text = p.communicate()
retcode = p.wait()
diff -aur michel-orgmode.pristine/michel/michel.py michel-orgmode.new/michel/michel.py
--- michel-orgmode.pristine/michel/michel.py 2016-09-01 16:24:44.290659982 +0200
+++ michel-orgmode.new/michel/michel.py 2016-09-01 16:54:41.478892705 +0200
@@ -19,12 +19,15 @@
# Set default encoding to 'UTF-8' instead of 'ascii'
# http://stackoverflow.com/questions/11741574/how-to-set-the-default-encoding-to-utf-8-in-python
# Bad things might happen though
-reload(sys)
-sys.setdefaultencoding("UTF8")
+
+# Martin Kaffanke <m.kaffanke@gmail.com>: Removing this for arch linux.
+# You will have troubles if you don't set your default encoding to utf-8 on the console.
+# reload(sys)
+#sys.setdefaultencoding("UTF8")
import re
-import cPickle as pickle
-import cStringIO
-import diff3
+import pickle
+from io import StringIO
+from . import diff3
import datetime
import dateutil.parser
@@ -86,7 +89,7 @@
TasksTree(title, task_id, task_notes, task_status, task_due))
else:
if self.get_task_with_id(parent_id) is None:
- raise ValueError, "No element with suitable parent id"
+ raise ValueError ("No element with suitable parent id")
self.get_task_with_id(parent_id).add_subtask(title, task_id, None,
task_notes, task_status, task_due)
@@ -312,7 +315,7 @@
break
else:
# no list with the given name was found
- print '\nERROR: No google task-list named "%s"\n' % list_name
+ print ('\nERROR: No google task-list named "%s"\n' % list_name)
sys.exit(2)
return list_id
@@ -398,7 +401,7 @@
def parse_text_to_tree(text):
"""Parses an org-mode formatted block of text and returns a tree"""
# create a (read-only) file object containing *text*
- f = cStringIO.StringIO(text)
+ f = StringIO(text)
headline_regex = re.compile("^(\*+ )( *)(DONE )?")
# DEADLINE timestmaps can have the formats described at
@@ -541,17 +544,17 @@
"'%s' has been updated to contain the contents of the "
"list, and a backup of this file has been created "
"as '%s'. Please update '%s' as desired, and re-run "
- "the synchronization.\n") % (list_name, path, bkup_fname, path)
+ "the synchronization.\n" % (list_name, path, bkup_fname, path))
merged_tree, conflict_occurred = treemerge(orgfile_tree, orig_tree, gtasks_tree)
if conflict_occurred:
conflicted_filename = path + ".conflicted"
- open(conflicted_filename, "wb").write(str(merged_tree))
+ open(conflicted_filename, "w").write(str(merged_tree))
print ("\nWARNING: Org-file and task-list could not be cleanly merged: "
"the attempted merge can be found in '%s'. Please "
"modify this file, copy it to '%s', and push '%s' back "
- "to the desired GTasks list.\n") % (conflicted_filename, path, path)
+ "to the desired GTasks list.\n" % (conflicted_filename, path, path))
sys.exit(2)
else:
# store the successfully merged tree locally so we can use it as the
@@ -566,7 +569,7 @@
merged_tree.push(service, list_id)
# write merged tree to orgfile
- open(path, 'wb').write(str(merged_tree))
+ open(path, 'w').write(str(merged_tree))
def main():
Nur in michel-orgmode.new/michel: __pycache__.
|