OLD | NEW |
1 # This Source Code Form is subject to the terms of the Mozilla Public | 1 # This Source Code Form is subject to the terms of the Mozilla Public |
2 # License, v. 2.0. If a copy of the MPL was not distributed with this | 2 # License, v. 2.0. If a copy of the MPL was not distributed with this |
3 # file, You can obtain one at http://mozilla.org/MPL/2.0/. | 3 # file, You can obtain one at http://mozilla.org/MPL/2.0/. |
4 | 4 |
5 from __future__ import absolute_import, print_function | 5 from __future__ import absolute_import, print_function |
6 | 6 |
7 import argparse | 7 import argparse |
8 import math | 8 import math |
9 import sys | 9 import sys |
10 import time | 10 import time |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 elif cpu_arch in ['x86']: | 120 elif cpu_arch in ['x86']: |
121 version |= 1 << 2 | 121 version |= 1 << 2 |
122 else: | 122 else: |
123 raise ValueError("Don't know how to compute android:versionCode " | 123 raise ValueError("Don't know how to compute android:versionCode " |
124 "for CPU arch %s" % cpu_arch) | 124 "for CPU arch %s" % cpu_arch) |
125 | 125 |
126 return version | 126 return version |
127 | 127 |
128 def android_version_code(buildid, *args, **kwargs): | 128 def android_version_code(buildid, *args, **kwargs): |
129 base = int(str(buildid)) | 129 base = int(str(buildid)) |
130 if base < V1_CUTOFF: | 130 # Forcing the usage of v0 function |
| 131 # See https://issues.adblockplus.org/ticket/5170 |
| 132 if True: |
131 return android_version_code_v0(buildid, *args, **kwargs) | 133 return android_version_code_v0(buildid, *args, **kwargs) |
132 else: | 134 else: |
133 return android_version_code_v1(buildid, *args, **kwargs) | 135 return android_version_code_v1(buildid, *args, **kwargs) |
134 | 136 |
135 | 137 |
136 def main(argv): | 138 def main(argv): |
137 parser = argparse.ArgumentParser('Generate an android:versionCode', | 139 parser = argparse.ArgumentParser('Generate an android:versionCode', |
138 add_help=False) | 140 add_help=False) |
139 parser.add_argument('--verbose', action='store_true', | 141 parser.add_argument('--verbose', action='store_true', |
140 default=False, | 142 default=False, |
141 help='Be verbose') | 143 help='Be verbose') |
142 parser.add_argument('--with-android-cpu-arch', dest='cpu_arch', | 144 parser.add_argument('--with-android-cpu-arch', dest='cpu_arch', |
143 choices=['armeabi', 'armeabi-v7a', 'mips', 'x86'], | 145 choices=['armeabi', 'armeabi-v7a', 'mips', 'x86'], |
(...skipping 11 matching lines...) Expand all Loading... |
155 code = android_version_code(args.buildid, | 157 code = android_version_code(args.buildid, |
156 cpu_arch=args.cpu_arch, | 158 cpu_arch=args.cpu_arch, |
157 min_sdk=args.min_sdk, | 159 min_sdk=args.min_sdk, |
158 max_sdk=args.max_sdk) | 160 max_sdk=args.max_sdk) |
159 print(code) | 161 print(code) |
160 return 0 | 162 return 0 |
161 | 163 |
162 | 164 |
163 if __name__ == '__main__': | 165 if __name__ == '__main__': |
164 sys.exit(main(sys.argv[1:])) | 166 sys.exit(main(sys.argv[1:])) |
OLD | NEW |