forked from pebble/pebble-tool
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathsdk.patch
1063 lines (972 loc) · 50.4 KB
/
sdk.patch
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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
diff --git a/SDKs/4.3/sdk-core/pebble/.waf3-1.7.11-951087d39789950ed009f0c86ce75e7b/waflib/ConfigSet.py b/SDKs/4.3/sdk-core/pebble/.waf3-1.7.11-951087d39789950ed009f0c86ce75e7b/waflib/ConfigSet.py
index f9fdcc7..72466ec 100644
--- a/SDKs/4.3/sdk-core/pebble/.waf3-1.7.11-951087d39789950ed009f0c86ce75e7b/waflib/ConfigSet.py
+++ b/SDKs/4.3/sdk-core/pebble/.waf3-1.7.11-951087d39789950ed009f0c86ce75e7b/waflib/ConfigSet.py
@@ -134,7 +134,7 @@ class ConfigSet(object):
Utils.writef(filename,''.join(buf))
def load(self,filename):
tbl=self.table
- code=Utils.readf(filename,m='rU')
+ code=Utils.readf(filename,m='r')
for m in re_imp.finditer(code):
g=m.group
tbl[g(2)]=eval(g(3))
diff --git a/SDKs/4.3/sdk-core/pebble/.waf3-1.7.11-951087d39789950ed009f0c86ce75e7b/waflib/Context.py b/SDKs/4.3/sdk-core/pebble/.waf3-1.7.11-951087d39789950ed009f0c86ce75e7b/waflib/Context.py
index ecf0d53..1aea1a2 100644
--- a/SDKs/4.3/sdk-core/pebble/.waf3-1.7.11-951087d39789950ed009f0c86ce75e7b/waflib/Context.py
+++ b/SDKs/4.3/sdk-core/pebble/.waf3-1.7.11-951087d39789950ed009f0c86ce75e7b/waflib/Context.py
@@ -2,7 +2,7 @@
# encoding: utf-8
# WARNING! Do not edit! http://waf.googlecode.com/git/docs/wafbook/single.html#_obtaining_the_waf_file
-import os,imp,sys
+import os,sys,types
from waflib import Utils,Errors,Logs
import waflib.Node
HEXVERSION=0x1070b00
@@ -28,6 +28,7 @@ STDOUT=1
STDERR=-1
BOTH=0
classes=[]
+from waflib.Node import Node as node_class
def create_context(cmd_name,*k,**kw):
global classes
for x in classes:
@@ -60,8 +61,6 @@ class Context(ctx):
except KeyError:
global run_dir
rd=run_dir
- class node_class(waflib.Node.Node):
- pass
self.node_class=node_class
self.node_class.__module__="waflib.Node"
self.node_class.__name__="Nod3"
@@ -108,7 +107,7 @@ class Context(ctx):
cache[node]=True
self.pre_recurse(node)
try:
- function_code=node.read('rU')
+ function_code=node.read('r')
exec(compile(function_code,node.abspath(),'exec'),self.exec_dict)
finally:
self.post_recurse(node)
@@ -271,9 +270,9 @@ def load_module(path):
return cache_modules[path]
except KeyError:
pass
- module=imp.new_module(WSCRIPT_FILE)
+ module=types.ModuleType(WSCRIPT_FILE)
try:
- code=Utils.readf(path,m='rU')
+ code=Utils.readf(path,m='r')
except(IOError,OSError):
raise Errors.WafError('Could not read the file %r'%path)
module_dir=os.path.dirname(path)
diff --git a/SDKs/4.3/sdk-core/pebble/.waf3-1.7.11-951087d39789950ed009f0c86ce75e7b/waflib/Node.py b/SDKs/4.3/sdk-core/pebble/.waf3-1.7.11-951087d39789950ed009f0c86ce75e7b/waflib/Node.py
index a7693a3..1a250aa 100644
--- a/SDKs/4.3/sdk-core/pebble/.waf3-1.7.11-951087d39789950ed009f0c86ce75e7b/waflib/Node.py
+++ b/SDKs/4.3/sdk-core/pebble/.waf3-1.7.11-951087d39789950ed009f0c86ce75e7b/waflib/Node.py
@@ -279,7 +279,7 @@ class Node(object):
if maxdepth:
for k in node.ant_iter(accept=accept,maxdepth=maxdepth-1,pats=npats,dir=dir,src=src,remove=remove):
yield k
- raise StopIteration
+ # raise StopIteration
def ant_glob(self,*k,**kw):
src=kw.get('src',True)
dir=kw.get('dir',False)
@@ -328,7 +328,10 @@ class Node(object):
if[]in nrej:
nacc=[]
return[nacc,nrej]
- ret=[x for x in self.ant_iter(accept=accept,pats=[to_pat(incl),to_pat(excl)],maxdepth=25,dir=dir,src=src,remove=kw.get('remove',True))]
+ ret = []
+ # rebble hack: gather into array
+ for x in self.ant_iter(accept=accept,pats=[to_pat(incl),to_pat(excl)],maxdepth=25,dir=dir,src=src,remove=kw.get('remove',True)):
+ ret.append(x)
if kw.get('flat',False):
return' '.join([x.path_from(self)for x in ret])
return ret
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
index 6813022..1160eb7 100644
--- 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
@@ -119,7 +119,7 @@ class tex(Task.Task):
Logs.error('error bibunitscan')
else:
if bibunits:
- fn=['bu'+str(i)for i in xrange(1,len(bibunits)+1)]
+ fn=['bu'+str(i)for i in range(1,len(bibunits)+1)]
if fn:
Logs.warn('calling bibtex on bibunits')
for f in fn:
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
index 0de6171..40c63d1 100644
--- 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
@@ -26,10 +26,7 @@ except Exception:
else:
import re,threading
is_vista=getattr(sys,"getwindowsversion",None)and sys.getwindowsversion()[0]>=6
- try:
- _type=unicode
- except NameError:
- _type=str
+ _type=str
to_int=lambda number,default:number and int(number)or default
wlock=threading.Lock()
STD_OUTPUT_HANDLE=-11
diff --git a/SDKs/4.3/sdk-core/pebble/.waf3-1.7.11-951087d39789950ed009f0c86ce75e7b/waflib/extras/ldscript.py b/SDKs/4.3/sdk-core/pebble/.waf3-1.7.11-951087d39789950ed009f0c86ce75e7b/waflib/extras/ldscript.py
index 60780d8..2d0c962 100644
--- a/SDKs/4.3/sdk-core/pebble/.waf3-1.7.11-951087d39789950ed009f0c86ce75e7b/waflib/extras/ldscript.py
+++ b/SDKs/4.3/sdk-core/pebble/.waf3-1.7.11-951087d39789950ed009f0c86ce75e7b/waflib/extras/ldscript.py
@@ -10,11 +10,11 @@ def process_ldscript(self):
if not getattr(self,'ldscript',None)or self.env.CC_NAME!='gcc':
return
def convert_to_node(node_or_path_str):
- if isinstance(node_or_path_str,basestring):
+ if isinstance(node_or_path_str,str):
return self.path.make_node(node_or_path_str)
else:
return node_or_path_str
- if isinstance(self.ldscript,basestring)or isinstance(self.ldscript,list):
+ if isinstance(self.ldscript,str)or isinstance(self.ldscript,list):
ldscripts=Utils.to_list(self.ldscript)
else:
ldscripts=[self.ldscript]
diff --git a/SDKs/4.3/sdk-core/pebble/.waf3-1.7.11-951087d39789950ed009f0c86ce75e7b/waflib/extras/pebble_sdk.py b/SDKs/4.3/sdk-core/pebble/.waf3-1.7.11-951087d39789950ed009f0c86ce75e7b/waflib/extras/pebble_sdk.py
index e94f134..ad21d57 100644
--- a/SDKs/4.3/sdk-core/pebble/.waf3-1.7.11-951087d39789950ed009f0c86ce75e7b/waflib/extras/pebble_sdk.py
+++ b/SDKs/4.3/sdk-core/pebble/.waf3-1.7.11-951087d39789950ed009f0c86ce75e7b/waflib/extras/pebble_sdk.py
@@ -6,11 +6,11 @@ import json
from waflib.Configure import conf
from waflib.Errors import ConfigurationError
from waflib import Logs
-import sdk_paths
+from . import sdk_paths
from generate_appinfo import generate_appinfo_c
-from process_sdk_resources import generate_resources
-import report_memory_usage
-from sdk_helpers import(configure_libraries,configure_platform,find_sdk_component,get_target_platforms,truncate_to_32_bytes,validate_message_keys_object)
+from .process_sdk_resources import generate_resources
+from . import report_memory_usage
+from .sdk_helpers import(configure_libraries,configure_platform,find_sdk_component,get_target_platforms,truncate_to_32_bytes,validate_message_keys_object)
def _extract_project_info(conf,info_json,json_filename):
if'pebble'in info_json:
project_info=info_json['pebble']
@@ -21,7 +21,7 @@ def _extract_project_info(conf,info_json,json_filename):
conf.fatal("Project is missing a version")
version=_validate_version(conf,info_json['version'])
project_info['versionLabel']=version
- if isinstance(info_json['author'],basestring):
+ if isinstance(info_json['author'],str):
project_info['companyName']=(info_json['author'].split('(',1)[0].split('<',1)[0].strip())
elif isinstance(info_json['author'],dict)and'name'in info_json['author']:
project_info['companyName']=info_json['author']['name']
diff --git a/SDKs/4.3/sdk-core/pebble/.waf3-1.7.11-951087d39789950ed009f0c86ce75e7b/waflib/extras/pebble_sdk_common.py b/SDKs/4.3/sdk-core/pebble/.waf3-1.7.11-951087d39789950ed009f0c86ce75e7b/waflib/extras/pebble_sdk_common.py
index 59dfe14..9a89424 100644
--- a/SDKs/4.3/sdk-core/pebble/.waf3-1.7.11-951087d39789950ed009f0c86ce75e7b/waflib/extras/pebble_sdk_common.py
+++ b/SDKs/4.3/sdk-core/pebble/.waf3-1.7.11-951087d39789950ed009f0c86ce75e7b/waflib/extras/pebble_sdk_common.py
@@ -10,9 +10,9 @@ from waflib.Configure import conf
from waflib.Task import Task
from waflib.TaskGen import after_method,before_method,feature
from waflib.Tools import c,c_preproc
-import ldscript,process_bundle,process_headers,process_js,report_memory_usage,xcode_pebble
+from . import ldscript,process_bundle,process_headers,process_js,report_memory_usage,xcode_pebble
from pebble_sdk_platform import maybe_import_internal
-from sdk_helpers import(append_to_attr,find_sdk_component,get_node_from_abspath,wrap_task_name_with_platform)
+from .sdk_helpers import(append_to_attr,find_sdk_component,get_node_from_abspath,wrap_task_name_with_platform)
Task.__str__=wrap_task_name_with_platform
def options(opt):
opt.load('gcc')
@@ -84,7 +84,7 @@ def setup_pebble_c(task_gen):
def fix_pebble_h_dependencies(task_gen):
for task in task_gen.tasks:
if type(task)==c.c:
- task.scan=types.MethodType(_wrap_c_preproc_scan,task,c.c)
+ task.scan=types.MethodType(_wrap_c_preproc_scan,task)
@feature('pebble_cprogram')
@before_method('process_source')
def setup_pebble_cprogram(task_gen):
diff --git a/SDKs/4.3/sdk-core/pebble/.waf3-1.7.11-951087d39789950ed009f0c86ce75e7b/waflib/extras/pebble_sdk_lib.py b/SDKs/4.3/sdk-core/pebble/.waf3-1.7.11-951087d39789950ed009f0c86ce75e7b/waflib/extras/pebble_sdk_lib.py
index 1ceb4ae..70e779a 100644
--- a/SDKs/4.3/sdk-core/pebble/.waf3-1.7.11-951087d39789950ed009f0c86ce75e7b/waflib/extras/pebble_sdk_lib.py
+++ b/SDKs/4.3/sdk-core/pebble/.waf3-1.7.11-951087d39789950ed009f0c86ce75e7b/waflib/extras/pebble_sdk_lib.py
@@ -5,7 +5,7 @@
import json
import sdk_paths
from process_sdk_resources import generate_resources
-from sdk_helpers import(configure_libraries,configure_platform,get_target_platforms,validate_message_keys_object)
+from .sdk_helpers import(configure_libraries,configure_platform,get_target_platforms,validate_message_keys_object)
def options(opt):
opt.load('pebble_sdk_common')
opt.add_option('-t','--timestamp',dest='timestamp',help="Use a specific timestamp to label this package (ie, your repository's last commit time), ""defaults to time of build")
diff --git a/SDKs/4.3/sdk-core/pebble/.waf3-1.7.11-951087d39789950ed009f0c86ce75e7b/waflib/extras/process_bundle.py b/SDKs/4.3/sdk-core/pebble/.waf3-1.7.11-951087d39789950ed009f0c86ce75e7b/waflib/extras/process_bundle.py
index 57fd6a5..86f308d 100644
--- a/SDKs/4.3/sdk-core/pebble/.waf3-1.7.11-951087d39789950ed009f0c86ce75e7b/waflib/extras/process_bundle.py
+++ b/SDKs/4.3/sdk-core/pebble/.waf3-1.7.11-951087d39789950ed009f0c86ce75e7b/waflib/extras/process_bundle.py
@@ -7,7 +7,7 @@ from waflib import Task
from waflib.TaskGen import feature
import mkbundle
from pebble_package import LibraryPackage
-from process_elf import generate_bin_file
+from .process_elf import generate_bin_file
from resources.types.resource_ball import ResourceBall
@Task.update_outputs
class lib_package(Task.Task):
diff --git a/SDKs/4.3/sdk-core/pebble/.waf3-1.7.11-951087d39789950ed009f0c86ce75e7b/waflib/extras/process_elf.py b/SDKs/4.3/sdk-core/pebble/.waf3-1.7.11-951087d39789950ed009f0c86ce75e7b/waflib/extras/process_elf.py
index 8ea5438..a0322be 100644
--- a/SDKs/4.3/sdk-core/pebble/.waf3-1.7.11-951087d39789950ed009f0c86ce75e7b/waflib/extras/process_elf.py
+++ b/SDKs/4.3/sdk-core/pebble/.waf3-1.7.11-951087d39789950ed009f0c86ce75e7b/waflib/extras/process_elf.py
@@ -2,8 +2,8 @@
# encoding: utf-8
# WARNING! Do not edit! http://waf.googlecode.com/git/docs/wafbook/single.html#_obtaining_the_waf_file
-import objcopy
-import pebble_sdk_gcc
+from . import objcopy
+from . import pebble_sdk_gcc
def generate_bin_file(task_gen,bin_type,elf_file,has_pkjs,has_worker):
platform_build_node=task_gen.bld.path.get_bld().find_node(task_gen.bld.env.BUILD_DIR)
packaged_files=[elf_file]
diff --git a/SDKs/4.3/sdk-core/pebble/.waf3-1.7.11-951087d39789950ed009f0c86ce75e7b/waflib/extras/process_headers.py b/SDKs/4.3/sdk-core/pebble/.waf3-1.7.11-951087d39789950ed009f0c86ce75e7b/waflib/extras/process_headers.py
index bf45317..e9b26a6 100644
--- a/SDKs/4.3/sdk-core/pebble/.waf3-1.7.11-951087d39789950ed009f0c86ce75e7b/waflib/extras/process_headers.py
+++ b/SDKs/4.3/sdk-core/pebble/.waf3-1.7.11-951087d39789950ed009f0c86ce75e7b/waflib/extras/process_headers.py
@@ -4,7 +4,7 @@
from waflib.TaskGen import before_method,feature
from waflib import Context,Task
-from sdk_helpers import get_node_from_abspath
+from .sdk_helpers import get_node_from_abspath
@feature('headers')
@before_method('make_lib_bundle')
def process_headers(task_gen):
diff --git a/SDKs/4.3/sdk-core/pebble/.waf3-1.7.11-951087d39789950ed009f0c86ce75e7b/waflib/extras/process_js.py b/SDKs/4.3/sdk-core/pebble/.waf3-1.7.11-951087d39789950ed009f0c86ce75e7b/waflib/extras/process_js.py
index 6c1fd53..1d5c694 100644
--- a/SDKs/4.3/sdk-core/pebble/.waf3-1.7.11-951087d39789950ed009f0c86ce75e7b/waflib/extras/process_js.py
+++ b/SDKs/4.3/sdk-core/pebble/.waf3-1.7.11-951087d39789950ed009f0c86ce75e7b/waflib/extras/process_js.py
@@ -9,8 +9,8 @@ from string import Template
from waflib.Errors import WafError
from waflib.TaskGen import before_method,feature
from waflib import Context,Logs,Node,Task
-from sdk_helpers import find_sdk_component,get_node_from_abspath
-from sdk_helpers import process_package
+from .sdk_helpers import find_sdk_component,get_node_from_abspath
+from .sdk_helpers import process_package
@feature('rockyjs')
@before_method('process_sdk_resources')
def process_rocky_js(task_gen):
diff --git a/SDKs/4.3/sdk-core/pebble/.waf3-1.7.11-951087d39789950ed009f0c86ce75e7b/waflib/extras/process_message_keys.py b/SDKs/4.3/sdk-core/pebble/.waf3-1.7.11-951087d39789950ed009f0c86ce75e7b/waflib/extras/process_message_keys.py
index bda8822..4efd37b 100644
--- a/SDKs/4.3/sdk-core/pebble/.waf3-1.7.11-951087d39789950ed009f0c86ce75e7b/waflib/extras/process_message_keys.py
+++ b/SDKs/4.3/sdk-core/pebble/.waf3-1.7.11-951087d39789950ed009f0c86ce75e7b/waflib/extras/process_message_keys.py
@@ -6,7 +6,7 @@ import json
from re import findall
from waflib.TaskGen import before_method,feature
from waflib import Logs,Task
-from sdk_helpers import get_node_from_abspath
+from .sdk_helpers import get_node_from_abspath
header=("""#pragma once
#include <stdint.h>
@@ -47,7 +47,7 @@ def configure(conf):
key_dict=keys
else:
conf.fatal("You have specified an invalid messageKeys object in your project JSON ""file.")
- combined_key_list=key_list+key_dict.keys()
+ combined_key_list=key_list+list(key_dict.keys())
for lib in conf.env.LIB_JSON:
if not'pebble'in lib or not'messageKeys'in lib['pebble']:
continue
diff --git a/SDKs/4.3/sdk-core/pebble/.waf3-1.7.11-951087d39789950ed009f0c86ce75e7b/waflib/extras/process_sdk_resources.py b/SDKs/4.3/sdk-core/pebble/.waf3-1.7.11-951087d39789950ed009f0c86ce75e7b/waflib/extras/process_sdk_resources.py
index dc60ce7..06f10e0 100644
--- a/SDKs/4.3/sdk-core/pebble/.waf3-1.7.11-951087d39789950ed009f0c86ce75e7b/waflib/extras/process_sdk_resources.py
+++ b/SDKs/4.3/sdk-core/pebble/.waf3-1.7.11-951087d39789950ed009f0c86ce75e7b/waflib/extras/process_sdk_resources.py
@@ -14,7 +14,7 @@ import resources.resource_map.resource_generator_js
import resources.resource_map.resource_generator_pbi
import resources.resource_map.resource_generator_png
import resources.resource_map.resource_generator_raw
-from sdk_helpers import is_sdk_2x,validate_resource_not_larger_than
+from .sdk_helpers import is_sdk_2x,validate_resource_not_larger_than
def _preprocess_resource_ids(bld,resources_list,has_published_media=False):
resource_id_mapping={}
next_id=1
diff --git a/SDKs/4.3/sdk-core/pebble/.waf3-1.7.11-951087d39789950ed009f0c86ce75e7b/waflib/extras/process_timeline_resources.py b/SDKs/4.3/sdk-core/pebble/.waf3-1.7.11-951087d39789950ed009f0c86ce75e7b/waflib/extras/process_timeline_resources.py
index 7cd7655..18b58ce 100644
--- a/SDKs/4.3/sdk-core/pebble/.waf3-1.7.11-951087d39789950ed009f0c86ce75e7b/waflib/extras/process_timeline_resources.py
+++ b/SDKs/4.3/sdk-core/pebble/.waf3-1.7.11-951087d39789950ed009f0c86ce75e7b/waflib/extras/process_timeline_resources.py
@@ -8,11 +8,11 @@ from waflib import Node,Task,TaskGen
from waflib.TaskGen import before_method,feature
from resources.types.resource_definition import ResourceDefinition
from resources.types.resource_object import ResourceObject
-from sdk_helpers import validate_resource_not_larger_than
+from .sdk_helpers import validate_resource_not_larger_than
class layouts_json(Task.Task):
def run(self):
published_media_dict={m['id']:m['name']for m in self.published_media}
- timeline_entries=[{'id':media_id,'name':media_name}for media_id,media_name in published_media_dict.iteritems()]
+ timeline_entries=[{'id':media_id,'name':media_name}for media_id,media_name in published_media_dict.items()]
image_uris={'resources':{'app://images/'+r['name']:r['id']for r in timeline_entries}}
with open(self.outputs[0].abspath(),'w')as f:
json.dump(image_uris,f,indent=8)
@@ -60,11 +60,11 @@ class timeline_reso(Task.Task):
bld.fatal("Resource {} in publishedMedia is missing values for ['glance'] ""and ['timeline']['tiny'].".format(published_media_name))
if timeline_id>=len(timeline_resources):
timeline_resources.extend({'tiny':0,'small':0,'large':0}for x in range(len(timeline_resources),timeline_id+1))
- for size,res_id in item['timeline'].iteritems():
+ for size,res_id in item['timeline'].items():
if res_id not in resource_id_mapping:
bld.fatal("Invalid resource ID {} specified in publishedMedia".format(res_id))
timeline_resources[timeline_id][size]=resource_id_mapping[res_id]
- table=TLUT_SIGNATURE
+ table=TLUT_SIGNATURE.encode('ascii')
for r in timeline_resources:
table+=struct.pack(TIMELINE_RESOURCE_TABLE_ENTRY_FMT,r['tiny'],r['small'],r['large'])
r=ResourceObject(ResourceDefinition('raw','TIMELINE_LUT',''),table)
diff --git a/SDKs/4.3/sdk-core/pebble/.waf3-1.7.11-951087d39789950ed009f0c86ce75e7b/waflib/extras/report_memory_usage.py b/SDKs/4.3/sdk-core/pebble/.waf3-1.7.11-951087d39789950ed009f0c86ce75e7b/waflib/extras/report_memory_usage.py
index dff0442..fb90103 100644
--- a/SDKs/4.3/sdk-core/pebble/.waf3-1.7.11-951087d39789950ed009f0c86ce75e7b/waflib/extras/report_memory_usage.py
+++ b/SDKs/4.3/sdk-core/pebble/.waf3-1.7.11-951087d39789950ed009f0c86ce75e7b/waflib/extras/report_memory_usage.py
@@ -7,7 +7,7 @@ from waflib import Logs,Task
from waflib.TaskGen import after_method,feature
from binutils import size
from memory_reports import(app_memory_report,app_resource_memory_error,app_appstore_resource_memory_error,bytecode_memory_report,simple_memory_report)
-from sdk_helpers import is_sdk_2x
+from .sdk_helpers import is_sdk_2x
class memory_usage_report(Task.Task):
def run(self):
bin_type=self.bin_type
diff --git a/SDKs/4.3/sdk-core/pebble/.waf3-1.7.11-951087d39789950ed009f0c86ce75e7b/waflib/extras/sdk_helpers.py b/SDKs/4.3/sdk-core/pebble/.waf3-1.7.11-951087d39789950ed009f0c86ce75e7b/waflib/extras/sdk_helpers.py
index d49a40b..2fec055 100644
--- a/SDKs/4.3/sdk-core/pebble/.waf3-1.7.11-951087d39789950ed009f0c86ce75e7b/waflib/extras/sdk_helpers.py
+++ b/SDKs/4.3/sdk-core/pebble/.waf3-1.7.11-951087d39789950ed009f0c86ce75e7b/waflib/extras/sdk_helpers.py
@@ -9,18 +9,18 @@ import re
from waflib import Logs
from pebble_package import LibraryPackage
from pebble_sdk_platform import pebble_platforms,maybe_import_internal
-from pebble_sdk_version import set_env_sdk_version
+from .pebble_sdk_version import set_env_sdk_version
from resources.types.resource_object import ResourceObject
def _get_pbi_size(data):
width=struct.unpack('<h',data[8:10])[0]
height=struct.unpack('<h',data[10:12])[0]
return width,height
def _get_pdc_size(data):
- width=struct.unpack('>I',data[6:8])[0]
- height=struct.unpack('>I',data[8:10])[0]
+ width=struct.unpack('<H',data[6:8])[0]
+ height=struct.unpack('<H',data[8:10])[0]
return width,height
def _get_png_size(data):
- assert data[:4]=='IHDR'
+ assert data[:4]==b'IHDR'
width=struct.unpack('>I',data[4:8])[0]
height=struct.unpack('>I',data[8:12])[0]
return width,height
@@ -48,7 +48,7 @@ def append_to_attr(self,attr,new_values):
values.extend(new_values)
setattr(self,attr,values)
def configure_libraries(ctx,libraries):
- dependencies=libraries.keys()
+ dependencies=list(libraries.keys())
lib_json=[]
lib_resources_json={}
index=0
@@ -91,7 +91,7 @@ def get_target_platforms(ctx):
target_platforms=list(set(supported_platforms)&set(ctx.env.REQUESTED_PLATFORMS))
if not target_platforms:
ctx.fatal("No valid targetPlatforms specified in appinfo.json. Valid options are {}".format(supported_platforms))
- ctx.env.TARGET_PLATFORMS=sorted([p.encode('utf-8')for p in target_platforms],reverse=True)
+ ctx.env.TARGET_PLATFORMS=sorted([p for p in target_platforms],reverse=True)
return target_platforms
def is_sdk_2x(major,minor):
LAST_2X_MAJOR_VERSION=5
@@ -169,16 +169,16 @@ def validate_resource_not_larger_than(ctx,resource_file,dimensions=None,width=No
resource_size=_get_png_size(reso.data[12:])
elif storage_format=='raw':
try:
- assert reso.data[4:]=='PDCI'
+ assert reso.data[4:]==b'PDCI'
except AssertionError:
ctx.fatal("Unsupported published resource type for {}".format(resource_file))
else:
resource_size=_get_pdc_size(reso.data[4:])
else:
data=f.read(24)
- if data[1:4]=='PNG':
+ if data[1:4]==b'PNG':
resource_size=_get_png_size(data[12:])
- elif data[:4]=='PDCI':
+ elif data[:4]==b'PDCI':
resource_size=_get_pdc_size(data[4:])
else:
ctx.fatal("Unsupported published resource type for {}".format(resource_file))
diff --git a/SDKs/4.3/sdk-core/pebble/.waf3-1.7.11-951087d39789950ed009f0c86ce75e7b/waflib/extras/xcode_pebble.py b/SDKs/4.3/sdk-core/pebble/.waf3-1.7.11-951087d39789950ed009f0c86ce75e7b/waflib/extras/xcode_pebble.py
index 4fac4c8..b2399b8 100644
--- a/SDKs/4.3/sdk-core/pebble/.waf3-1.7.11-951087d39789950ed009f0c86ce75e7b/waflib/extras/xcode_pebble.py
+++ b/SDKs/4.3/sdk-core/pebble/.waf3-1.7.11-951087d39789950ed009f0c86ce75e7b/waflib/extras/xcode_pebble.py
@@ -298,5 +298,5 @@ else\n\
pypy waf $ACTION\n\
fi\n\
")
- os.chmod(xcscript_path,0755)
+ os.chmod(xcscript_path, 0o755)
f.close()
diff --git a/SDKs/4.3/sdk-core/pebble/common/tools/binutils.py b/SDKs/4.3/sdk-core/pebble/common/tools/binutils.py
index 5543bba..5609906 100644
--- a/SDKs/4.3/sdk-core/pebble/common/tools/binutils.py
+++ b/SDKs/4.3/sdk-core/pebble/common/tools/binutils.py
@@ -43,14 +43,14 @@ class FileInfo(object):
return result
def pprint(self, verbose):
- print ' %s: size %u' % (self.filename, self.size)
+ print(' %s: size %u' % (self.filename, self.size))
if verbose:
- l = sorted(self.symbols.itervalues(), key=lambda x: -x.size)
+ l = sorted(self.symbols.values(), key=lambda x: -x.size)
for s in l:
- print ' %6u %-36s' % (s.size, s.name)
+ print(' %6u %-36s' % (s.size, s.name))
def __str__(self):
- return '<FileInfo %s: %u>' % (self.filename, self.size)
+ return('<FileInfo %s: %u>' % (self.filename, self.size))
class SectionInfo(object):
@@ -81,7 +81,7 @@ class SectionInfo(object):
return self.files.values()
def pprint(self, summary, verbose):
- print '%s: count %u size %u' % (self.name, self.count, self.size)
+ print('%s: count %u size %u' % (self.name, self.count, self.size))
if not summary:
l = self.files.values()
@@ -197,9 +197,9 @@ def _get_symbols_table(f):
# This method is quite slow, but works around a bug in nm.
def _nm_generator_slow(f):
- print "Getting list of symbols..."
+ print("Getting list of symbols...")
symbols = _get_symbols_table(f)
- print "Aggregating..."
+ print("Aggregating...")
infile = sh.arm_none_eabi_nm('-S', f)
line_pattern = re.compile(r"""([0-9a-f]+)\s+ # address
@@ -274,7 +274,7 @@ def size(elf_path):
lines = output.splitlines()
if len(lines) < 2:
return 0
- match = re.match("^\s*([0-9]+)\s+([0-9]+)\s+([0-9]+)", lines[1])
+ match = re.match(b"^\s*([0-9]+)\s+([0-9]+)\s+([0-9]+)", lines[1])
if not match:
return 0
# text, data, bss
diff --git a/SDKs/4.3/sdk-core/pebble/common/tools/bitmapgen.py b/SDKs/4.3/sdk-core/pebble/common/tools/bitmapgen.py
index 56b0d51..3469599 100644
--- a/SDKs/4.3/sdk-core/pebble/common/tools/bitmapgen.py
+++ b/SDKs/4.3/sdk-core/pebble/common/tools/bitmapgen.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
-import StringIO
+from io import StringIO, BytesIO
import argparse
import os
import struct
@@ -79,7 +79,7 @@ class PebbleBitmap(object):
self.color_reduction_method = color_reduction_method
width, height, pixels, metadata = png.Reader(filename=path).asRGBA8()
- # convert planar boxed row flat pixel to 2d array of (R, G, B, A)
+ # convert planar boxed row flat pixel to 2d array of (R, G, B, A)
self._im_pixels = []
for row in pixels:
row_list = []
@@ -143,7 +143,7 @@ class PebbleBitmap(object):
def pbi_header(self):
return struct.pack('<HHhhhh',
- self.row_size_bytes(),
+ int(self.row_size_bytes()),
self.info_flags(),
self.x,
self.y,
@@ -166,7 +166,7 @@ class PebbleBitmap(object):
def pack_pixels_to_bitblt_word(pixels, x_offset, x_max):
word = 0
- for column in xrange(0, 32):
+ for column in range(0, 32):
x = x_offset + column
if (x < x_max):
pixel = pixels[x]
@@ -178,9 +178,9 @@ class PebbleBitmap(object):
out_pixels = []
row_size_words = self.row_size_bytes() / 4
- for row in xrange(self.y, self.y + self.h):
+ for row in range(self.y, self.y + self.h):
x_max = self._im_size[0]
- for column_word in xrange(0, row_size_words):
+ for column_word in range(0, row_size_words):
x_offset = self.x + column_word * 32
out_pixels.append(pack_pixels_to_bitblt_word(src_pixels[row],
x_offset,
@@ -200,10 +200,10 @@ class PebbleBitmap(object):
assert self.bitdepth is not None
out_pixels = []
- for row in xrange(self.y, self.y + self.h):
+ for row in range(self.y, self.y + self.h):
packed_count = 0
packed_value = 0
- for column in xrange(self.x, self.x + self.w):
+ for column in range(self.x, self.x + self.w):
pixel = self._im_pixels[row][column]
r, g, b, a = [pixel[i] for i in range(4)]
@@ -226,7 +226,7 @@ class PebbleBitmap(object):
# shift and store the color index in a packed value
packed_count = packed_count + 1 # pre-increment for calculation below
packed_value = packed_value | (color_index << \
- (self.bitdepth * (8 / self.bitdepth - (packed_count))))
+ int(self.bitdepth * (8 / self.bitdepth - (packed_count))))
if (packed_count == 8 / self.bitdepth):
out_pixels.append(struct.pack("B", packed_value))
@@ -237,7 +237,7 @@ class PebbleBitmap(object):
if (packed_count):
out_pixels.append(struct.pack("B", packed_value))
- return ''.join(out_pixels)
+ return b''.join(out_pixels)
def image_bits(self):
if self.bitmap_format == FORMAT_COLOR or self.bitmap_format == FORMAT_COLOR_RAW:
@@ -269,20 +269,20 @@ class PebbleBitmap(object):
return to_file
def convert_to_pbi(self):
- pbi_bits = []
+ pbi_bits = BytesIO()
image_data = self.image_bits() # compute before generating header
- pbi_bits.extend(self.pbi_header())
- pbi_bits.extend(image_data)
+ pbi_bits.write(self.pbi_header())
+ pbi_bits.write(image_data)
if self.palette and self.bitdepth < 8:
# write out palette, padded to the bitdepth
- for i in xrange(0, 2**self.bitdepth):
+ for i in range(0, 2**self.bitdepth):
value = 0
if i < len(self.palette):
value = self.palette[i]
- pbi_bits.extend(struct.pack('B', value))
+ pbi_bits.write(struct.pack('B', value))
- return b"".join(pbi_bits)
+ return pbi_bits.getvalue()
def convert_to_pbi_file(self, pbi_file=None):
to_file = pbi_file if pbi_file else (os.path.splitext(self.path)[0] + '.pbi')
@@ -294,8 +294,8 @@ class PebbleBitmap(object):
def generate_palette(self):
self.palette = []
- for row in xrange(self.y, self.y + self.h):
- for column in xrange(self.x, self.x + self.w):
+ for row in range(self.y, self.y + self.h):
+ for column in range(self.x, self.x + self.w):
pixel = self._im_pixels[row][column]
r, g, b, a = [pixel[i] for i in range(4)]
@@ -333,7 +333,7 @@ def cmd_pbi(args):
def cmd_header(args):
pb = PebbleBitmap(args.input_png, bitmap_format=args.format,
color_reduction_method=args.color_reduction_method, crop=not args.disable_crop)
- print pb.header()
+ print(pb.header())
def cmd_white_trans_pbi(args):
@@ -368,10 +368,10 @@ def process_all_bitmaps():
f.close()
def grouper(iterable, n, fillvalue=None):
- from itertools import izip_longest
+ from itertools import zip_longest
args = [iter(iterable)] * n
- return izip_longest(fillvalue=fillvalue, *args)
+ return zip_longest(fillvalue=fillvalue, *args)
def process_cmd_line_args():
parser = argparse.ArgumentParser(description="Generate pebble-usable files from png images")
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
index 142d3af..cb6d11f 100755
--- a/SDKs/4.3/sdk-core/pebble/common/tools/font/fontgen.py
+++ b/SDKs/4.3/sdk-core/pebble/common/tools/font/fontgen.py
@@ -89,7 +89,7 @@ MAX_GLYPHS = 256
def grouper(n, iterable, fillvalue=None):
"""grouper(3, 'ABCDEFG', 'x') --> ABC DEF Gxx"""
args = [iter(iterable)] * n
- return itertools.izip_longest(fillvalue=fillvalue, *args)
+ return itertools.zip_longest(fillvalue=fillvalue, *args)
def hasher(codepoint, num_glyphs):
return (codepoint % num_glyphs)
@@ -109,7 +109,7 @@ class Font:
self.legacy = legacy
self.face = freetype.Face(self.ttf_path)
self.face.set_pixel_sizes(0, self.max_height)
- self.name = self.face.family_name + "_" + self.face.style_name
+ self.name = self.face.family_name.decode() + "_" + self.face.style_name.decode()
self.wildcard_codepoint = WILDCARD_CODEPOINT
self.number_of_glyphs = 0
self.table_size = HASH_TABLE_SIZE
@@ -152,8 +152,8 @@ class Font:
def set_regex_filter(self, regex_string):
if regex_string != ".*":
try:
- self.regex = re.compile(unicode(regex_string, 'utf8'), re.UNICODE)
- except Exception, e:
+ self.regex = re.compile(str(regex_string, 'utf8'), re.UNICODE)
+ except Exception as e:
raise Exception("Supplied filter argument was not a valid regular expression."
"Font: {}".format(self.ttf_path))
else:
@@ -224,7 +224,7 @@ class Font:
src_ptr = self.max_glyph_size - len(glyph_packed)
def glyph_packed_iterator(tbl, num):
- for i in xrange(0, num):
+ for i in range(0, num):
yield struct.unpack('<B', tbl[i])[0]
# Generate glyph buffer. Ignore the header
@@ -282,7 +282,7 @@ class Font:
self.face.load_glyph(gindex, flags)
# Font metrics
bitmap = self.face.glyph.bitmap
- advance = self.face.glyph.advance.x / 64 # Convert 26.6 fixed float format to px
+ advance = self.face.glyph.advance.x // 64 # Convert 26.6 fixed float format to px
advance += self.tracking_adjust
width = bitmap.width
height = bitmap.rows
@@ -330,7 +330,7 @@ class Font:
glyph_header = struct.pack(self.glyph_header, width, height, left, bottom, advance)
- return glyph_header + ''.join(glyph_packed)
+ return glyph_header + b''.join(glyph_packed)
def fontinfo_bits(self):
if self.version == FONT_VERSION_2:
@@ -374,7 +374,7 @@ class Font:
struct.pack(offset_table_format, codepoint, offset))
bucket_sizes[glyph_hash] = bucket_sizes[glyph_hash] + 1
if bucket_sizes[glyph_hash] > OFFSET_TABLE_MAX_SIZE:
- print "error: %d > 127" % bucket_sizes[glyph_hash]
+ print("error: %d > 127" % bucket_sizes[glyph_hash])
return bucket_sizes
def add_glyph(codepoint, next_offset, gindex, glyph_indices_lookup):
@@ -396,7 +396,7 @@ class Font:
def codepoint_is_in_subset(codepoint):
if (codepoint not in (WILDCARD_CODEPOINT, ELLIPSIS_CODEPOINT)):
if self.regex is not None:
- if self.regex.match(unichr(codepoint)) is None:
+ if self.regex.match(chr(codepoint)) is None:
return False
if codepoint not in self.codepoints:
return False
@@ -425,7 +425,7 @@ class Font:
raise Exception('Wildcard codepoint is used for something else in this font.'
'Font {}'.format(self.ttf_path))
- if (gindex is 0):
+ if (gindex == 0):
raise Exception('0 index is reused by a non wildcard glyph. Font {}'.
format(self.ttf_path))
@@ -449,9 +449,9 @@ class Font:
def bitstring(self):
btstr = self.fontinfo_bits()
- btstr += ''.join(self.hash_table)
+ btstr += b''.join(self.hash_table)
for table in self.offset_tables:
- btstr += ''.join(table)
- btstr += ''.join(self.glyph_table)
+ btstr += b''.join(table)
+ btstr += b''.join(self.glyph_table)
return btstr
diff --git a/SDKs/4.3/sdk-core/pebble/common/tools/generate_appinfo.py b/SDKs/4.3/sdk-core/pebble/common/tools/generate_appinfo.py
index 4884bd3..6c857d9 100644
--- a/SDKs/4.3/sdk-core/pebble/common/tools/generate_appinfo.py
+++ b/SDKs/4.3/sdk-core/pebble/common/tools/generate_appinfo.py
@@ -24,7 +24,7 @@ def generate_appinfo_c(app_info, output_filename, platform_name=None):
app_uuid = uuid.UUID(app_info['uuid'])
except KeyError:
raise Exception('Could not find $.uuid in appinfo.json')
- uuid_initializer_string = '{ %s }' % ", ".join(["0x%02X" % ord(b) for b in app_uuid.bytes])
+ uuid_initializer_string = '{ %s }' % ", ".join(["0x%02X" % b for b in app_uuid.bytes])
try:
name = app_info['shortName']
@@ -124,7 +124,7 @@ def generate_appinfo_c(app_info, output_filename, platform_name=None):
company=company_name,
icon_resource_id=icon_resource_id,
flags=flags_string,
- uuid=uuid_initializer_string).encode('utf-8'))
+ uuid=uuid_initializer_string))
PEBBLE_APP_INFO_TEMPLATE = string.Template("""
const PebbleProcessInfo __pbl_app_info __attribute__ ((section (".pbl_header"))) = {
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
index 8a5047c..819a6db 100644
--- 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
@@ -1,7 +1,7 @@
def write(output_file, bytes, var_name):
output_file.write("static const uint8_t {var_name}[] = {{\n ".format(var_name=var_name))
- for byte, index in zip(bytes, xrange(0, len(bytes))):
+ for byte, index in zip(bytes, range(0, len(bytes))):
if index != 0 and index % 16 == 0:
output_file.write("/* bytes {0} - {1} */\n ".format(index - 16, index))
output_file.write("0x%02x, " % ord(byte))
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
index 132a3d5..d411883 100755
--- a/SDKs/4.3/sdk-core/pebble/common/tools/inject_metadata.py
+++ b/SDKs/4.3/sdk-core/pebble/common/tools/inject_metadata.py
@@ -100,7 +100,7 @@ def inject_metadata(target_binary, target_elf, resources_file, timestamp, allow_
# We don't care about the lines that only have two columns, they're not functions.
for sym in nm_output:
- if symbol == sym[-1] and len(sym) == 3:
+ if symbol == sym[-1].decode() and len(sym) == 3:
return int(sym[0], 16)
raise Exception("Could not locate symbol <%s> in binary! Failed to inject app metadata" %
@@ -139,11 +139,11 @@ def inject_metadata(target_binary, target_elf, resources_file, timestamp, allow_
if len(columns) < 6:
continue
- if columns[0] == '.bss':
+ if columns[0] == b'.bss':
addr = int(columns[2], 16)
size = int(columns[4], 16)
last_section_end_addr = addr + size
- elif columns[0] == '.data' and last_section_end_addr == 0:
+ elif columns[0] == b'.data' and last_section_end_addr == 0:
addr = int(columns[2], 16)
size = int(columns[4], 16)
last_section_end_addr = addr + size
@@ -170,7 +170,7 @@ def inject_metadata(target_binary, target_elf, resources_file, timestamp, allow_
while i < len(lines):
if not reading_section:
# look for the next section
- if lines[i].startswith("Relocation section '.rel.data"):
+ if lines[i].startswith(b"Relocation section '.rel.data"):
reading_section = True
i += 1 # skip the column title section
else:
@@ -178,7 +178,7 @@ def inject_metadata(target_binary, target_elf, resources_file, timestamp, allow_
# end of the section
reading_section = False
else:
- entries.append(int(lines[i].split(' ')[0], 16))
+ entries.append(int(lines[i].split(b' ')[0], 16))
i += 1
# get any Global Offset Table (.got) entries
@@ -189,11 +189,11 @@ def inject_metadata(target_binary, target_elf, resources_file, timestamp, allow_
for line in lines:
# We shouldn't need to do anything with the Procedure Linkage Table since we don't
# actually export functions
- if '.got' in line and '.got.plt' not in line:
- words = line.split(' ')
- while '' in words:
- words.remove('')
- section_label_idx = words.index('.got')
+ if b'.got' in line and b'.got.plt' not in line:
+ words = line.split(b' ')
+ while b'' in words:
+ words.remove(b'')
+ section_label_idx = words.index(b'.got')
addr = int(words[section_label_idx + 2], 16)
length = int(words[section_label_idx + 4], 16)
for i in range(addr, addr + length, 4):
diff --git a/SDKs/4.3/sdk-core/pebble/common/tools/pbpack.py b/SDKs/4.3/sdk-core/pebble/common/tools/pbpack.py
index 67389ac..653f964 100755
--- a/SDKs/4.3/sdk-core/pebble/common/tools/pbpack.py
+++ b/SDKs/4.3/sdk-core/pebble/common/tools/pbpack.py
@@ -65,12 +65,12 @@ class ResourcePack(object):
def serialize_table(self):
# Serialize these entries into table_data
cur_file_id = 1
- table_data = ''
+ table_data = b''
for cur_file_id, table_entry in enumerate(self.table_entries, start=1):
table_data += table_entry.serialize(cur_file_id)
# Pad the rest of the table_data up to table_size
- for i in xrange(cur_file_id, self.table_size):
+ for i in range(cur_file_id, self.table_size):
table_data += ResourcePackTableEntry(0, 0, 0, 0).serialize(0)
return table_data
@@ -105,7 +105,7 @@ class ResourcePack(object):
# Parse table entries:
resource_pack.table_entries = []
- for n in xrange(num_files):
+ for n in range(num_files):
table_entry = f_in.read(cls.TABLE_ENTRY_SIZE_BYTES)
file_id, entry = ResourcePackTableEntry.deserialize(table_entry)
@@ -200,8 +200,7 @@ class ResourcePack(object):
f_out.write(self.serialize_manifest(self.crc))
f_out.write(self.serialize_table())
- for c in self.serialize_content():
- f_out.write(c)
+ f_out.write(self.serialize_content())
return self.crc
@@ -230,11 +229,11 @@ class ResourcePack(object):
Dump a bunch of information about this pbpack to stdout
"""
- print 'Manifest CRC: 0x%x' % self.crc
- print 'Calculated CRC: 0x%x' % self.get_content_crc()
- print 'Num Items: %u' % len(self.table_entries)
+ print('Manifest CRC: 0x%x' % self.crc)
+ print('Calculated CRC: 0x%x' % self.get_content_crc())
+ print('Num Items: %u' % len(self.table_entries))
for i, entry in enumerate(self.table_entries, start=1):
- print ' %u: Offset %u Length %u CRC 0x%x' % (i, entry.offset, entry.length, entry.crc)
+ print(' %u: Offset %u Length %u CRC 0x%x' % (i, entry.offset, entry.length, entry.crc))
def __init__(self, is_system):
self.table_size = 512 if is_system else 256
diff --git a/SDKs/4.3/sdk-core/pebble/common/tools/pebble_image_routines.py b/SDKs/4.3/sdk-core/pebble/common/tools/pebble_image_routines.py
index 78abaee..138b9de 100644
--- a/SDKs/4.3/sdk-core/pebble/common/tools/pebble_image_routines.py
+++ b/SDKs/4.3/sdk-core/pebble/common/tools/pebble_image_routines.py
@@ -14,7 +14,7 @@ NEAREST = "nearest"
# Create pebble 64 colors-table (r, g, b - 2 bits per channel)
def _get_pebble64_palette():
pebble_palette = []
- for i in xrange(0, 64):
+ for i in range(0, 64):
pebble_palette.append((
((i >> 4) & 0x3) * 85, # R
((i >> 2) & 0x3) * 85, # G
@@ -28,15 +28,15 @@ def nearest_color_to_pebble64_palette(r, g, b, a):
returns closest rgba32 color triplet (r, g, b, a)
"""
- a = ((a + 42) / 85) * 85 # fast nearest alpha for 2bit color range
+ a = ((a + 42) // 85) * 85 # fast nearest alpha for 2bit color range
# clear transparent pixels (makes image more compress-able)
# and required for greyscale tests
if a == 0:
r, g, b = (0, 0, 0)
else:
- r = ((r + 42) / 85) * 85 # nearest for 2bit color range
- g = ((g + 42) / 85) * 85 # nearest for 2bit color range
- b = ((b + 42) / 85) * 85 # nearest for 2bit color range
+ r = ((r + 42) // 85) * 85 # nearest for 2bit color range
+ g = ((g + 42) // 85) * 85 # nearest for 2bit color range
+ b = ((b + 42) // 85) * 85 # nearest for 2bit color range
return r, g, b, a
@@ -67,15 +67,15 @@ def truncate_color_to_pebble64_palette(r, g, b, a):
returns the truncated color as a rgba32 color triplet (r, g, b, a)
"""
- a = (a / 85) * 85 # truncate alpha for 2bit color range
+ a = (a // 85) * 85 # truncate alpha for 2bit color range
# clear transparent pixels (makes image more compress-able)
# and required for greyscale tests
if a == 0:
r, g, b = (0, 0, 0)
else:
- r = (r / 85) * 85 # truncate for 2bit color range
- g = (g / 85) * 85 # truncate for 2bit color range
- b = (b / 85) * 85 # truncate for 2bit color range
+ r = (r // 85) * 85 # truncate for 2bit color range
+ g = (g // 85) * 85 # truncate for 2bit color range
+ b = (b // 85) * 85 # truncate for 2bit color range
return r, g, b, a
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
index ba6dc4b..e55d31b 100644
--- a/SDKs/4.3/sdk-core/pebble/common/tools/pebble_package.py
+++ b/SDKs/4.3/sdk-core/pebble/common/tools/pebble_package.py
@@ -41,7 +41,7 @@ class PebblePackage(object):
def pack(self, package_path=None):
with zipfile.ZipFile(os.path.join(package_path, self.package_filename), 'w') as zip_file:
- for filename, file_path in self.package_files.iteritems():
+ for filename, file_path in self.package_files.items():
zip_file.write(file_path, filename)
zip_file.comment = type(self).__name__
@@ -74,13 +74,13 @@ class LibraryPackage(PebblePackage):
super(LibraryPackage, self).__init__(package_filename)
def add_files(self, includes, binaries, resources, js):
- for include, include_path in includes.iteritems():
+ for include, include_path in includes.items():
self.add_file(os.path.join('include', include), include_path)
- for binary, binary_path in binaries.iteritems():
+ for binary, binary_path in binaries.items():
self.add_file(os.path.join('binaries', binary), binary_path)
- for resource, resource_path in resources.iteritems():
+ for resource, resource_path in resources.items():
self.add_file(os.path.join('resources', resource), resource_path)
- for js_file, js_file_path in js.iteritems():
+ for js_file, js_file_path in js.items():
self.add_file(os.path.join('js', js_file), js_file_path)
def unpack(self, package_path='dist'):
diff --git a/SDKs/4.3/sdk-core/pebble/common/tools/png2pblpng.py b/SDKs/4.3/sdk-core/pebble/common/tools/png2pblpng.py
index d30427f..0ee8e1d 100644
--- a/SDKs/4.3/sdk-core/pebble/common/tools/png2pblpng.py
+++ b/SDKs/4.3/sdk-core/pebble/common/tools/png2pblpng.py
@@ -2,7 +2,7 @@
import png
import itertools
-import StringIO
+from io import BytesIO
import pebble_image_routines
@@ -38,10 +38,10 @@ def convert_png_to_pebble_png_bytes(input_filename, palette_name,
output_png, image_data = _convert_png_to_pebble_png_writer(
input_filename, palette_name, color_reduction_method, force_bitdepth=bitdepth)
- output_str = StringIO.StringIO()
- output_png.write_array(output_str, image_data)
+ output_io = BytesIO()
+ output_png.write_array(output_io, image_data)
- return output_str.getvalue()
+ return output_io.getvalue()
# Implementation
@@ -197,10 +197,10 @@ def get_palette_for_png(input_filename, palette_name, color_reduction_method):
def grouper(iterable, n, fillvalue=None):
- from itertools import izip_longest
+ from itertools import zip_longest
args = [iter(iterable)] * n
- return izip_longest(fillvalue=fillvalue, *args)
+ return zip_longest(fillvalue=fillvalue, *args)
def get_ideal_palette(is_color=False):
diff --git a/SDKs/4.3/sdk-core/pebble/common/tools/stm32_crc.py b/SDKs/4.3/sdk-core/pebble/common/tools/stm32_crc.py
index 581b23b..3081d12 100644
--- a/SDKs/4.3/sdk-core/pebble/common/tools/stm32_crc.py
+++ b/SDKs/4.3/sdk-core/pebble/common/tools/stm32_crc.py
@@ -2,9 +2,9 @@ CRC_POLY = 0x04C11DB7
def precompute_table(bits):
lookup_table = []
- for i in xrange(2**bits):
+ for i in range(2**bits):
rr = i << (32 - bits)
- for x in xrange(bits):
+ for x in range(bits):
if rr & 0x80000000:
rr = (rr << 1) ^ CRC_POLY