Skip to content

Commit 5bbb651

Browse files
committed
update: proactively patch xrange, iteritems, itervalues
1 parent 0c1429b commit 5bbb651

1 file changed

Lines changed: 92 additions & 4 deletions

File tree

sdk.patch

Lines changed: 92 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,19 @@ index a7693a3..1a250aa 100644
8787
if kw.get('flat',False):
8888
return' '.join([x.path_from(self)for x in ret])
8989
return ret
90+
diff --git a/SDKs/4.3/sdk-core/pebble/.waf3-1.7.11-951087d39789950ed009f0c86ce75e7b/waflib/Tools/tex.py b/SDKs/4.3/sdk-core/pebble/.waf3-1.7.11-951087d39789950ed009f0c86ce75e7b/waflib/Tools/tex.py
91+
index 6813022..1160eb7 100644
92+
--- a/SDKs/4.3/sdk-core/pebble/.waf3-1.7.11-951087d39789950ed009f0c86ce75e7b/waflib/Tools/tex.py
93+
+++ b/SDKs/4.3/sdk-core/pebble/.waf3-1.7.11-951087d39789950ed009f0c86ce75e7b/waflib/Tools/tex.py
94+
@@ -119,7 +119,7 @@ class tex(Task.Task):
95+
Logs.error('error bibunitscan')
96+
else:
97+
if bibunits:
98+
- fn=['bu'+str(i)for i in xrange(1,len(bibunits)+1)]
99+
+ fn=['bu'+str(i)for i in range(1,len(bibunits)+1)]
100+
if fn:
101+
Logs.warn('calling bibtex on bibunits')
102+
for f in fn:
90103
diff --git a/SDKs/4.3/sdk-core/pebble/.waf3-1.7.11-951087d39789950ed009f0c86ce75e7b/waflib/ansiterm.py b/SDKs/4.3/sdk-core/pebble/.waf3-1.7.11-951087d39789950ed009f0c86ce75e7b/waflib/ansiterm.py
91104
index 0de6171..40c63d1 100644
92105
--- a/SDKs/4.3/sdk-core/pebble/.waf3-1.7.11-951087d39789950ed009f0c86ce75e7b/waflib/ansiterm.py
@@ -401,7 +414,7 @@ index 4fac4c8..b2399b8 100644
401414
+ os.chmod(xcscript_path, 0o755)
402415
f.close()
403416
diff --git a/SDKs/4.3/sdk-core/pebble/common/tools/binutils.py b/SDKs/4.3/sdk-core/pebble/common/tools/binutils.py
404-
index 5543bba..5f0ef8d 100644
417+
index 5543bba..5609906 100644
405418
--- a/SDKs/4.3/sdk-core/pebble/common/tools/binutils.py
406419
+++ b/SDKs/4.3/sdk-core/pebble/common/tools/binutils.py
407420
@@ -43,14 +43,14 @@ class FileInfo(object):
@@ -411,7 +424,8 @@ index 5543bba..5f0ef8d 100644
411424
- print ' %s: size %u' % (self.filename, self.size)
412425
+ print(' %s: size %u' % (self.filename, self.size))
413426
if verbose:
414-
l = sorted(self.symbols.itervalues(), key=lambda x: -x.size)
427+
- l = sorted(self.symbols.itervalues(), key=lambda x: -x.size)
428+
+ l = sorted(self.symbols.values(), key=lambda x: -x.size)
415429
for s in l:
416430
- print ' %6u %-36s' % (s.size, s.name)
417431
+ print(' %6u %-36s' % (s.size, s.name))
@@ -453,7 +467,7 @@ index 5543bba..5f0ef8d 100644
453467
return 0
454468
# text, data, bss
455469
diff --git a/SDKs/4.3/sdk-core/pebble/common/tools/bitmapgen.py b/SDKs/4.3/sdk-core/pebble/common/tools/bitmapgen.py
456-
index 56b0d51..88ac32c 100644
470+
index 56b0d51..3469599 100644
457471
--- a/SDKs/4.3/sdk-core/pebble/common/tools/bitmapgen.py
458472
+++ b/SDKs/4.3/sdk-core/pebble/common/tools/bitmapgen.py
459473
@@ -1,6 +1,6 @@
@@ -482,6 +496,27 @@ index 56b0d51..88ac32c 100644
482496
self.info_flags(),
483497
self.x,
484498
self.y,
499+
@@ -166,7 +166,7 @@ class PebbleBitmap(object):
500+
501+
def pack_pixels_to_bitblt_word(pixels, x_offset, x_max):
502+
word = 0
503+
- for column in xrange(0, 32):
504+
+ for column in range(0, 32):
505+
x = x_offset + column
506+
if (x < x_max):
507+
pixel = pixels[x]
508+
@@ -178,9 +178,9 @@ class PebbleBitmap(object):
509+
out_pixels = []
510+
row_size_words = self.row_size_bytes() / 4
511+
512+
- for row in xrange(self.y, self.y + self.h):
513+
+ for row in range(self.y, self.y + self.h):
514+
x_max = self._im_size[0]
515+
- for column_word in xrange(0, row_size_words):
516+
+ for column_word in range(0, row_size_words):
517+
x_offset = self.x + column_word * 32
518+
out_pixels.append(pack_pixels_to_bitblt_word(src_pixels[row],
519+
x_offset,
485520
@@ -200,10 +200,10 @@ class PebbleBitmap(object):
486521

487522
assert self.bitdepth is not None
@@ -574,7 +609,7 @@ index 56b0d51..88ac32c 100644
574609
def process_cmd_line_args():
575610
parser = argparse.ArgumentParser(description="Generate pebble-usable files from png images")
576611
diff --git a/SDKs/4.3/sdk-core/pebble/common/tools/font/fontgen.py b/SDKs/4.3/sdk-core/pebble/common/tools/font/fontgen.py
577-
index 142d3af..7df5fdf 100755
612+
index 142d3af..cb6d11f 100755
578613
--- a/SDKs/4.3/sdk-core/pebble/common/tools/font/fontgen.py
579614
+++ b/SDKs/4.3/sdk-core/pebble/common/tools/font/fontgen.py
580615
@@ -89,7 +89,7 @@ MAX_GLYPHS = 256
@@ -606,6 +641,15 @@ index 142d3af..7df5fdf 100755
606641
raise Exception("Supplied filter argument was not a valid regular expression."
607642
"Font: {}".format(self.ttf_path))
608643
else:
644+
@@ -224,7 +224,7 @@ class Font:
645+
src_ptr = self.max_glyph_size - len(glyph_packed)
646+
647+
def glyph_packed_iterator(tbl, num):
648+
- for i in xrange(0, num):
649+
+ for i in range(0, num):
650+
yield struct.unpack('<B', tbl[i])[0]
651+
652+
# Generate glyph buffer. Ignore the header
609653
@@ -282,7 +282,7 @@ class Font:
610654
self.face.load_glyph(gindex, flags)
611655
# Font metrics
@@ -686,6 +730,19 @@ index 4884bd3..6c857d9 100644
686730

687731
PEBBLE_APP_INFO_TEMPLATE = string.Template("""
688732
const PebbleProcessInfo __pbl_app_info __attribute__ ((section (".pbl_header"))) = {
733+
diff --git a/SDKs/4.3/sdk-core/pebble/common/tools/generate_c_byte_array.py b/SDKs/4.3/sdk-core/pebble/common/tools/generate_c_byte_array.py
734+
index 8a5047c..819a6db 100644
735+
--- a/SDKs/4.3/sdk-core/pebble/common/tools/generate_c_byte_array.py
736+
+++ b/SDKs/4.3/sdk-core/pebble/common/tools/generate_c_byte_array.py
737+
@@ -1,7 +1,7 @@
738+
739+
def write(output_file, bytes, var_name):
740+
output_file.write("static const uint8_t {var_name}[] = {{\n ".format(var_name=var_name))
741+
- for byte, index in zip(bytes, xrange(0, len(bytes))):
742+
+ for byte, index in zip(bytes, range(0, len(bytes))):
743+
if index != 0 and index % 16 == 0:
744+
output_file.write("/* bytes {0} - {1} */\n ".format(index - 16, index))
745+
output_file.write("0x%02x, " % ord(byte))
689746
diff --git a/SDKs/4.3/sdk-core/pebble/common/tools/inject_metadata.py b/SDKs/4.3/sdk-core/pebble/common/tools/inject_metadata.py
690747
index 132a3d5..d411883 100755
691748
--- a/SDKs/4.3/sdk-core/pebble/common/tools/inject_metadata.py
@@ -855,6 +912,37 @@ index 78abaee..138b9de 100644
855912

856913
return r, g, b, a
857914

915+
diff --git a/SDKs/4.3/sdk-core/pebble/common/tools/pebble_package.py b/SDKs/4.3/sdk-core/pebble/common/tools/pebble_package.py
916+
index ba6dc4b..e55d31b 100644
917+
--- a/SDKs/4.3/sdk-core/pebble/common/tools/pebble_package.py
918+
+++ b/SDKs/4.3/sdk-core/pebble/common/tools/pebble_package.py
919+
@@ -41,7 +41,7 @@ class PebblePackage(object):
920+
921+
def pack(self, package_path=None):
922+
with zipfile.ZipFile(os.path.join(package_path, self.package_filename), 'w') as zip_file:
923+
- for filename, file_path in self.package_files.iteritems():
924+
+ for filename, file_path in self.package_files.items():
925+
zip_file.write(file_path, filename)
926+
zip_file.comment = type(self).__name__
927+
928+
@@ -74,13 +74,13 @@ class LibraryPackage(PebblePackage):
929+
super(LibraryPackage, self).__init__(package_filename)
930+
931+
def add_files(self, includes, binaries, resources, js):
932+
- for include, include_path in includes.iteritems():
933+
+ for include, include_path in includes.items():
934+
self.add_file(os.path.join('include', include), include_path)
935+
- for binary, binary_path in binaries.iteritems():
936+
+ for binary, binary_path in binaries.items():
937+
self.add_file(os.path.join('binaries', binary), binary_path)
938+
- for resource, resource_path in resources.iteritems():
939+
+ for resource, resource_path in resources.items():
940+
self.add_file(os.path.join('resources', resource), resource_path)
941+
- for js_file, js_file_path in js.iteritems():
942+
+ for js_file, js_file_path in js.items():
943+
self.add_file(os.path.join('js', js_file), js_file_path)
944+
945+
def unpack(self, package_path='dist'):
858946
diff --git a/SDKs/4.3/sdk-core/pebble/common/tools/png2pblpng.py b/SDKs/4.3/sdk-core/pebble/common/tools/png2pblpng.py
859947
index d30427f..0ee8e1d 100644
860948
--- a/SDKs/4.3/sdk-core/pebble/common/tools/png2pblpng.py

0 commit comments

Comments
 (0)