#!/usr/bin/env python
# -*- coding: utf-8 -*-

"""
.. currentmodule:: pre_gen_project
.. moduleauthor:: Pat Daburu <pat@daburu.net>

This is the script that runs before template generation.
"""
import re
import sys

MODULE_REGEX = r"^[_a-zA-Z][_a-zA-Z0-9]+$"

module_name = "{{ cookiecutter.package_name }}"

if not re.match(MODULE_REGEX, module_name):
    print("ERROR: %s is not a valid Python module name!" % module_name)

    # exits with status 1 to indicate failure
    sys.exit(1)
