| 229 | return True |
| 230 | |
| 231 | def check_dependencies(verbose = False, optional = False): |
| 232 | if verbose: |
| 233 | logger.setLevel(logging.INFO) |
| 234 | |
| 235 | has_all_dependencies = True |
| 236 | |
| 237 | #Python 2.7.3 is the required minimum. Python 3+ is not supported, but it is |
| 238 | #still useful to provide information about our other requirements. |
| 239 | logger.info('Python version: %s', sys.version) |
| 240 | if sys.hexversion < 0x20703F0: |
| 241 | logger.error('PyBitmessage requires Python 2.7.3 or greater (but not Python 3+)') |
| 242 | has_all_dependencies = False |
| 243 | if sys.hexversion >= 0x3000000: |
| 244 | logger.error('PyBitmessage does not support Python 3+. Python 2.7.3 or greater is required.') |
| 245 | has_all_dependencies = False |
| 246 | |
| 247 | check_functions = [check_hashlib, check_sqlite, check_openssl, check_msgpack] |
| 248 | if optional: |
| 249 | check_functions.extend([check_pyqt, check_curses]) |
| 250 | |
| 251 | #Unexpected exceptions are handled here |
| 252 | for check in check_functions: |
| 253 | try: |
| 254 | has_all_dependencies &= check() |
| 255 | except: |
| 256 | logger.exception(check.__name__ + ' failed unexpectedly.') |
| 257 | has_all_dependencies = False |
| 258 | |
| 259 | if not has_all_dependencies: |
| 260 | logger.critical('PyBitmessage cannot start. One or more dependencies are unavailable.') |
| 261 | sys.exit() |
| 262 | |
| 263 | if __name__ == '__main__': |
| 264 | check_dependencies(True, True) |