diff options
author | Dylan Deng <dxx1104@gmail.com> | 2018-06-23 15:02:26 +0800 |
---|---|---|
committer | Dylan Deng <dxx1104@gmail.com> | 2018-07-24 22:20:08 +0800 |
commit | e469a0c741832f6584513f4a382d6b93f417b8d2 (patch) | |
tree | 4ea43078d29bb494fb6688cf75f2a1d03e936d5a | |
parent | 65b0ba5aa0447f7ee25103828115662b1eb80ff9 (diff) | |
download | git-repo-e469a0c741832f6584513f4a382d6b93f417b8d2.tar.gz |
fix some sync error while using python3
Change-Id: I70925e48756c356d48359679d8ad1b9e33a68595
-rw-r--r-- | event_log.py | 4 | ||||
-rw-r--r-- | git_config.py | 4 | ||||
-rw-r--r-- | platform_utils.py | 7 |
3 files changed, 12 insertions, 3 deletions
diff --git a/event_log.py b/event_log.py index 45a2c268..2f1b180b 100644 --- a/event_log.py +++ b/event_log.py | |||
@@ -18,6 +18,8 @@ from __future__ import print_function | |||
18 | import json | 18 | import json |
19 | import multiprocessing | 19 | import multiprocessing |
20 | 20 | ||
21 | from pyversion import is_python3 | ||
22 | |||
21 | TASK_COMMAND = 'command' | 23 | TASK_COMMAND = 'command' |
22 | TASK_SYNC_NETWORK = 'sync-network' | 24 | TASK_SYNC_NETWORK = 'sync-network' |
23 | TASK_SYNC_LOCAL = 'sync-local' | 25 | TASK_SYNC_LOCAL = 'sync-local' |
@@ -71,7 +73,7 @@ class EventLog(object): | |||
71 | A dictionary of the event added to the log. | 73 | A dictionary of the event added to the log. |
72 | """ | 74 | """ |
73 | event = { | 75 | event = { |
74 | 'id': (kind, self._next_id.next()), | 76 | 'id': (kind, self._next_id.__next__() if is_python3() else self._next_id.next()), |
75 | 'name': name, | 77 | 'name': name, |
76 | 'task_name': task_name, | 78 | 'task_name': task_name, |
77 | 'start_time': start, | 79 | 'start_time': start, |
diff --git a/git_config.py b/git_config.py index 7bc6f77d..70b22ce1 100644 --- a/git_config.py +++ b/git_config.py | |||
@@ -306,7 +306,9 @@ class GitConfig(object): | |||
306 | d = self._do('--null', '--list') | 306 | d = self._do('--null', '--list') |
307 | if d is None: | 307 | if d is None: |
308 | return c | 308 | return c |
309 | for line in d.decode('utf-8').rstrip('\0').split('\0'): | 309 | if not is_python3(): |
310 | d = d.decode('utf-8') | ||
311 | for line in d.rstrip('\0').split('\0'): | ||
310 | if '\n' in line: | 312 | if '\n' in line: |
311 | key, val = line.split('\n', 1) | 313 | key, val = line.split('\n', 1) |
312 | else: | 314 | else: |
diff --git a/platform_utils.py b/platform_utils.py index 33cb2ec3..a3e96531 100644 --- a/platform_utils.py +++ b/platform_utils.py | |||
@@ -20,7 +20,12 @@ import select | |||
20 | import shutil | 20 | import shutil |
21 | import stat | 21 | import stat |
22 | 22 | ||
23 | from Queue import Queue | 23 | from pyversion import is_python3 |
24 | if is_python3(): | ||
25 | from queue import Queue | ||
26 | else: | ||
27 | from Queue import Queue | ||
28 | |||
24 | from threading import Thread | 29 | from threading import Thread |
25 | 30 | ||
26 | 31 | ||