| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright 2014 The Swarming Authors. All rights reserved. | 2 # Copyright 2014 The Swarming Authors. All rights reserved. |
| 3 # Use of this source code is governed by the Apache v2.0 license that can be | 3 # Use of this source code is governed by the Apache v2.0 license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 | 5 |
| 6 """Generates the swarming_bot.zip archive for the bot. | 6 """Generates the swarming_bot.zip archive for the bot. |
| 7 | 7 |
| 8 Unlike the other scripts, this file can be run stand-alone to generate a | 8 Unlike the other scripts, this file can be run stand-alone to generate a |
| 9 swarming_bot.zip so it doesn't import anything from the AppEngine SDK. | 9 swarming_bot.zip so it doesn't import anything from the AppEngine SDK. |
| 10 | 10 |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 'utils/logging_utils.py', | 149 'utils/logging_utils.py', |
| 150 'utils/lru.py', | 150 'utils/lru.py', |
| 151 'utils/net.py', | 151 'utils/net.py', |
| 152 'utils/oauth.py', | 152 'utils/oauth.py', |
| 153 'utils/on_error.py', | 153 'utils/on_error.py', |
| 154 'utils/subprocess42.py', | 154 'utils/subprocess42.py', |
| 155 'utils/threading_utils.py', | 155 'utils/threading_utils.py', |
| 156 'utils/tools.py', | 156 'utils/tools.py', |
| 157 'utils/zip_package.py', | 157 'utils/zip_package.py', |
| 158 'xsrf_client.py', | 158 'xsrf_client.py', |
| 159 |
| 160 # TODO(maruel): Find a way to only include these on linux platforms but it's |
| 161 # not that large so it is not a big deal. |
| 162 'adb/__init__.py', |
| 163 'adb/adb_commands.py', |
| 164 'adb/adb_protocol.py', |
| 165 'adb/common.py', |
| 166 'adb/fastboot.py', |
| 167 'adb/filesync_protocol.py', |
| 168 'adb/usb_exceptions.py', |
| 169 'libusb1.py', |
| 170 'usb1.py', |
| 159 ) | 171 ) |
| 160 | 172 |
| 161 def resolve_symlink(path): | 173 def resolve_symlink(path): |
| 162 """Processes path containing symlink on Windows. | 174 """Processes path containing symlink on Windows. |
| 163 | 175 |
| 164 This is needed to make ../swarming_bot/main_test.py pass on Windows because | 176 This is needed to make ../swarming_bot/main_test.py pass on Windows because |
| 165 git on Windows renders symlinks as normal files. | 177 git on Windows renders symlinks as normal files. |
| 166 """ | 178 """ |
| 167 if sys.platform != 'win32' or os.path.isfile(path): | 179 if sys.platform != 'win32' or os.path.isfile(path): |
| 180 # This means that symlinks to file will not be resolved properly. In our |
| 181 # case this is fine because the only 2 instances of this issue are |
| 182 # libusb1.py and usb1.py, which are only used on Ubuntu. |
| 168 return path | 183 return path |
| 169 parts = os.path.normpath(path).split(os.path.sep) | 184 parts = os.path.normpath(path).split(os.path.sep) |
| 170 for i in xrange(2, len(parts)): | 185 for i in xrange(2, len(parts)): |
| 171 partial = os.path.sep.join(parts[:i]) | 186 partial = os.path.sep.join(parts[:i]) |
| 172 if os.path.isfile(partial): | 187 if os.path.isfile(partial): |
| 173 with open(partial) as f: | 188 with open(partial) as f: |
| 174 link = f.read() | 189 link = f.read() |
| 175 assert '\n' not in link and link, link | 190 assert '\n' not in link and link, link |
| 176 parts[i-1] = link | 191 parts[i-1] = link |
| 177 return os.path.normpath(os.path.sep.join(parts)) | 192 return os.path.normpath(os.path.sep.join(parts)) |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 264 with open(os.path.join(swarming_bot_dir, 'bot_config.py'), 'rb') as f: | 279 with open(os.path.join(swarming_bot_dir, 'bot_config.py'), 'rb') as f: |
| 265 additionals = {'bot_config.py': f.read()} | 280 additionals = {'bot_config.py': f.read()} |
| 266 with open(zip_file, 'wb') as f: | 281 with open(zip_file, 'wb') as f: |
| 267 f.write( | 282 f.write( |
| 268 get_swarming_bot_zip(swarming_bot_dir, config['server'], additionals)) | 283 get_swarming_bot_zip(swarming_bot_dir, config['server'], additionals)) |
| 269 return 0 | 284 return 0 |
| 270 | 285 |
| 271 | 286 |
| 272 if __name__ == '__main__': | 287 if __name__ == '__main__': |
| 273 sys.exit(main()) | 288 sys.exit(main()) |
| OLD | NEW |