How to use the hacking.build_library.build_ansible.errors.DependencyError function in hacking

To help you get started, we’ve selected a few hacking examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ansible / ansible / hacking / build_library / build_ansible / command_plugins / release_announcement.py View on Github external
def main(cls, args):
        if sys.version_info < (3, 6):
            raise errors.DependencyError('The {0} subcommand needs Python-3.6+'
                                         ' to run'.format(cls.name))

        # Import here because these functions are invalid on Python-3.5 and the command plugins and
        # init_parser() method need to be compatible with Python-3.4+ for now.
        # Pylint doesn't understand Python3 namespace modules.
        from .. announce import create_short_message, create_long_message  # pylint: disable=relative-beyond-top-level

        args = transform_args(args)

        twitter_message = create_short_message(args.versions)
        email_message = create_long_message(args.versions, args.name)

        write_message(args.twitter_out, twitter_message)
        write_message(args.email_out, email_message)
        return 0