Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(74)

Side by Side Diff: pylib/gyp/mac_tool.py

Issue 1887703004: Fix header map nextPowerOf2 method. (Closed) Base URL: https://chromium.googlesource.com/external/gyp.git@master
Patch Set: Add comment Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | test/ios/framework/framework.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright (c) 2012 Google Inc. All rights reserved. 2 # Copyright (c) 2012 Google Inc. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 """Utility functions to perform Xcode-style build steps. 6 """Utility functions to perform Xcode-style build steps.
7 7
8 These functions are executed via gyp-mac-tool when using the Makefile generator. 8 These functions are executed via gyp-mac-tool when using the Makefile generator.
9 """ 9 """
10 10
(...skipping 621 matching lines...) Expand 10 before | Expand all | Expand 10 after
632 for key, value in substitutions.iteritems(): 632 for key, value in substitutions.iteritems():
633 data = data.replace('$(%s)' % key, value) 633 data = data.replace('$(%s)' % key, value)
634 return data 634 return data
635 if isinstance(data, list): 635 if isinstance(data, list):
636 return [self._ExpandVariables(v, substitutions) for v in data] 636 return [self._ExpandVariables(v, substitutions) for v in data]
637 if isinstance(data, dict): 637 if isinstance(data, dict):
638 return {k: self._ExpandVariables(data[k], substitutions) for k in data} 638 return {k: self._ExpandVariables(data[k], substitutions) for k in data}
639 return data 639 return data
640 640
641 def NextGreaterPowerOf2(x): 641 def NextGreaterPowerOf2(x):
642 return 2**(x-1).bit_length() 642 return 2**(x).bit_length()
643 643
644 def WriteHmap(output_name, filelist): 644 def WriteHmap(output_name, filelist):
645 """Generates a header map based on |filelist|. 645 """Generates a header map based on |filelist|.
646 646
647 Per Mark Mentovai: 647 Per Mark Mentovai:
648 A header map is structured essentially as a hash table, keyed by names used 648 A header map is structured essentially as a hash table, keyed by names used
649 in #includes, and providing pathnames to the actual files. 649 in #includes, and providing pathnames to the actual files.
650 650
651 The implementation below and the comment above comes from inspecting: 651 The implementation below and the comment above comes from inspecting:
652 http://www.opensource.apple.com/source/distcc/distcc-2503/distcc_dist/includ e_server/headermap.py?txt 652 http://www.opensource.apple.com/source/distcc/distcc-2503/distcc_dist/includ e_server/headermap.py?txt
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
699 out.write(struct.pack('<s', '\0')) 699 out.write(struct.pack('<s', '\0'))
700 base = os.path.dirname(path) + os.sep 700 base = os.path.dirname(path) + os.sep
701 out.write(struct.pack('<%ds' % len(base), base)) 701 out.write(struct.pack('<%ds' % len(base), base))
702 out.write(struct.pack('<s', '\0')) 702 out.write(struct.pack('<s', '\0'))
703 path = os.path.basename(path) 703 path = os.path.basename(path)
704 out.write(struct.pack('<%ds' % len(path), path)) 704 out.write(struct.pack('<%ds' % len(path), path))
705 out.write(struct.pack('<s', '\0')) 705 out.write(struct.pack('<s', '\0'))
706 706
707 if __name__ == '__main__': 707 if __name__ == '__main__':
708 sys.exit(main(sys.argv[1:])) 708 sys.exit(main(sys.argv[1:]))
OLDNEW
« no previous file with comments | « no previous file | test/ios/framework/framework.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698