Exemplo n.º 1
0
def main():
    install_and_import('rlbot')
    from rlbot.utils import public_utils, logging_utils
    logger = logging_utils.get_logger(DEFAULT_LOGGER)
    if not public_utils.have_internet():
        logger.log(logging_utils.logging_level, 'Skipping upgrade check for now since it looks like you have no internet')
    elif public_utils.is_safe_to_upgrade():
        pipmain(['install', '-r', 'requirements.txt', '--upgrade', '--upgrade-strategy=eager'])

    try:
        import sys
        import os

        path = os.path.dirname(os.path.abspath(__file__))
        sys.path.insert(0, path)  # this is for first process imports

        if len(sys.argv) > 1 and sys.argv[1] == 'gui':
            from rlbot.gui.qt_root import RLBotQTGui
            RLBotQTGui.main()
        else:
            from rlbot import runner
            runner.main()
    except Exception as e:
        print("Encountered exception: ", e)
        print("Press enter to close.")
        input()
Exemplo n.º 2
0
def upgrade():
    package = 'rlbot'

    import importlib
    import os
    folder = os.path.dirname(os.path.realpath(__file__))

    try:
        # https://stackoverflow.com/a/24773951
        importlib.import_module(package)

        from rlbot.utils import public_utils, logging_utils

        logger = logging_utils.get_logger(DEFAULT_LOGGER)
        if not public_utils.have_internet():
            logger.log(logging_utils.logging_level,
                       'Skipping upgrade check for now since it looks like you have no internet')
        elif public_utils.is_safe_to_upgrade():
            # Upgrade only the rlbot-related stuff.
            rlbot_requirements = os.path.join(folder, 'rlbot-requirements.txt')
            pipmain(['install', '-r', rlbot_requirements, '--upgrade'])

    except (ImportError, ModuleNotFoundError):
        # First time installation, install lots of stuff
        all_requirements = os.path.join(folder, 'requirements.txt')
        pipmain(['install', '-r', all_requirements])
Exemplo n.º 3
0
    except ImportError:
        pipmain(['install', package])
    finally:
        globals()[package] = importlib.import_module(package)


if __name__ == '__main__':
    install_and_import('rlbot')
    from rlbot.utils import public_utils, logging_utils
    logger = logging_utils.get_logger(DEFAULT_LOGGER)
    if not public_utils.have_internet():
        logger.log(
            logging_utils.logging_level,
            'Skipping upgrade check for now since it looks like you have no internet'
        )
    elif public_utils.is_safe_to_upgrade():
        pipmain([
            'install', '-r', 'requirements.txt', '--upgrade',
            '--upgrade-strategy=eager'
        ])

    try:
        import sys
        if len(sys.argv) > 1 and sys.argv[1] == 'gui':
            from rlbot.gui.qt_root import RLBotQTGui
            RLBotQTGui.main()
        else:
            from rlbot import runner
            runner.main()
    except Exception as e:
        print("Encountered exception: ", e)
Exemplo n.º 4
0
    from pip import main as pipmain
except ImportError:
    from pip._internal import main as pipmain

DEFAULT_LOGGER = 'rlbot'

if __name__ == '__main__':

    try:
        from rlbot.utils import public_utils, logging_utils

        logger = logging_utils.get_logger(DEFAULT_LOGGER)
        if not public_utils.have_internet():
            logger.log(logging_utils.logging_level,
                       'Skipping upgrade check for now since it looks like you have no internet')
        elif public_utils.is_safe_to_upgrade():
            pipmain(['install', '-r', 'requirements.txt', '--upgrade', '--upgrade-strategy=eager'])

            # https://stackoverflow.com/a/44401013
            rlbots = [module for module in sys.modules if module.startswith('rlbot')]
            for rlbot_module in rlbots:
                sys.modules.pop(rlbot_module)

    except ImportError:
        pipmain(['install', '-r', 'requirements.txt', '--upgrade', '--upgrade-strategy=eager'])

    try:
        if len(sys.argv) > 1 and sys.argv[1] == 'gui':
            from rlbot.gui.qt_root import RLBotQTGui

            RLBotQTGui.main()