diff options
Diffstat (limited to 'third_party/waf/waflib/extras/netcache_client.py')
-rw-r--r-- | third_party/waf/waflib/extras/netcache_client.py | 35 |
1 files changed, 20 insertions, 15 deletions
diff --git a/third_party/waf/waflib/extras/netcache_client.py b/third_party/waf/waflib/extras/netcache_client.py index 63859b6a207..ffd40d87f42 100644 --- a/third_party/waf/waflib/extras/netcache_client.py +++ b/third_party/waf/waflib/extras/netcache_client.py @@ -1,5 +1,9 @@ #! /usr/bin/env python # encoding: utf-8 +# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file + +#! /usr/bin/env python +# encoding: utf-8 # Thomas Nagy, 2011-2015 (ita) """ @@ -40,7 +44,7 @@ all_sigs_in_cache = (0.0, []) def put_data(conn, data): if sys.hexversion > 0x3000000: - data = data.encode('iso8859-1') + data = data.encode('latin-1') cnt = 0 while cnt < len(data): sent = conn.send(data[cnt:]) @@ -107,8 +111,8 @@ def read_header(conn): buf.append(data) cnt += len(data) if sys.hexversion > 0x3000000: - ret = ''.encode('iso8859-1').join(buf) - ret = ret.decode('iso8859-1') + ret = ''.encode('latin-1').join(buf) + ret = ret.decode('latin-1') else: ret = ''.join(buf) return ret @@ -140,13 +144,13 @@ def check_cache(conn, ssig): cnt += len(data) if sys.hexversion > 0x3000000: - ret = ''.encode('iso8859-1').join(buf) - ret = ret.decode('iso8859-1') + ret = ''.encode('latin-1').join(buf) + ret = ret.decode('latin-1') else: ret = ''.join(buf) all_sigs_in_cache = (time.time(), ret.splitlines()) - Logs.debug('netcache: server cache has %r entries' % len(all_sigs_in_cache[1])) + Logs.debug('netcache: server cache has %r entries', len(all_sigs_in_cache[1])) if not ssig in all_sigs_in_cache[1]: raise ValueError('no file %s in cache' % ssig) @@ -215,26 +219,25 @@ def can_retrieve_cache(self): recv_file(conn, ssig, cnt, p) cnt += 1 except MissingFile as e: - Logs.debug('netcache: file is not in the cache %r' % e) + Logs.debug('netcache: file is not in the cache %r', e) err = True - except Exception as e: - Logs.debug('netcache: could not get the files %r' % e) + Logs.debug('netcache: could not get the files %r', self.outputs) + if Logs.verbose > 1: + Logs.debug('netcache: exception %r', e) err = True # broken connection? remove this one close_connection(conn) conn = None + else: + Logs.debug('netcache: obtained %r from cache', self.outputs) + finally: release_connection(conn) if err: return False - for node in self.outputs: - node.sig = sig - #if self.generator.bld.progress_bar < 1: - # self.generator.bld.to_log('restoring from cache %r\n' % node.abspath()) - self.cached = True return True @@ -263,8 +266,9 @@ def put_files_cache(self): if not conn: conn = get_connection(push=True) sock_send(conn, ssig, cnt, node.abspath()) + Logs.debug('netcache: sent %r', node) except Exception as e: - Logs.debug("netcache: could not push the files %r" % e) + Logs.debug('netcache: could not push the files %r', e) # broken connection? remove this one close_connection(conn) @@ -387,3 +391,4 @@ def build(bld): push_addr = None setup_netcache(bld, push_addr, pull_addr) + |