|
28 | 28 | from functools import wraps
|
29 | 29 | from datetime import datetime
|
30 | 30 | from distutils.spawn import find_executable
|
31 |
| -from tempfile import mkdtemp |
32 | 31 | from math import log10
|
33 | 32 |
|
34 | 33 | import argparse
|
|
43 | 42 | from pythonforandroid.logger import (logger, info, debug, warning, error,
|
44 | 43 | Out_Style, Out_Fore, Err_Style, Err_Fore,
|
45 | 44 | info_notify, info_main, shprint)
|
46 |
| -from pythonforandroid.util import ensure_dir, current_directory, temp_directory |
| 45 | +from pythonforandroid.util import (ensure_dir, current_directory, temp_directory) |
47 | 46 |
|
48 | 47 | # monkey patch to show full output
|
49 | 48 | sh.ErrorReturnCode.truncate_cap = 999999
|
|
56 | 55 |
|
57 | 56 | DEFAULT_ANDROID_API = 15
|
58 | 57 |
|
59 |
| -IS_PY3 = sys.version_info[0] >= 3 |
60 | 58 |
|
61 | 59 | info(''.join(
|
62 | 60 | [Err_Style.BRIGHT, Err_Fore.RED,
|
@@ -201,57 +199,6 @@ def _cache_execution(self, *args, **kwargs):
|
201 | 199 |
|
202 | 200 |
|
203 | 201 |
|
204 |
| -class JsonStore(object): |
205 |
| - """Replacement of shelve using json, needed for support python 2 and 3. |
206 |
| - """ |
207 |
| - |
208 |
| - def __init__(self, filename): |
209 |
| - super(JsonStore, self).__init__() |
210 |
| - self.filename = filename |
211 |
| - self.data = {} |
212 |
| - if exists(filename): |
213 |
| - try: |
214 |
| - with io.open(filename, encoding='utf-8') as fd: |
215 |
| - self.data = json.load(fd) |
216 |
| - except ValueError: |
217 |
| - print("Unable to read the state.db, content will be replaced.") |
218 |
| - |
219 |
| - def __getitem__(self, key): |
220 |
| - return self.data[key] |
221 |
| - |
222 |
| - def __setitem__(self, key, value): |
223 |
| - self.data[key] = value |
224 |
| - self.sync() |
225 |
| - |
226 |
| - def __delitem__(self, key): |
227 |
| - del self.data[key] |
228 |
| - self.sync() |
229 |
| - |
230 |
| - def __contains__(self, item): |
231 |
| - return item in self.data |
232 |
| - |
233 |
| - def get(self, item, default=None): |
234 |
| - return self.data.get(item, default) |
235 |
| - |
236 |
| - def keys(self): |
237 |
| - return self.data.keys() |
238 |
| - |
239 |
| - def remove_all(self, prefix): |
240 |
| - for key in self.data.keys()[:]: |
241 |
| - if not key.startswith(prefix): |
242 |
| - continue |
243 |
| - del self.data[key] |
244 |
| - self.sync() |
245 |
| - |
246 |
| - def sync(self): |
247 |
| - # http://stackoverflow.com/questions/12309269/write-json-data-to-file-in-python/14870531#14870531 |
248 |
| - if IS_PY3: |
249 |
| - with open(self.filename, 'w') as fd: |
250 |
| - json.dump(self.data, fd, ensure_ascii=False) |
251 |
| - else: |
252 |
| - with io.open(self.filename, 'w', encoding='utf-8') as fd: |
253 |
| - fd.write(unicode(json.dumps(self.data, ensure_ascii=False))) |
254 |
| - |
255 | 202 |
|
256 | 203 | class Graph(object):
|
257 | 204 | # Taken from the old python-for-android/depsort
|
@@ -771,9 +718,6 @@ def __init__(self):
|
771 | 718 | self.env.pop("ARCHFLAGS", None)
|
772 | 719 | self.env.pop("CFLAGS", None)
|
773 | 720 |
|
774 |
| - # set the state |
775 |
| - self.state = JsonStore(join(self.dist_dir, "state.db")) |
776 |
| - |
777 | 721 | def set_archs(self, arch_names):
|
778 | 722 | all_archs = self.archs
|
779 | 723 | new_archs = set()
|
|
0 commit comments