Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions hooks/pre_gen_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"""

EXCEPTION_MSG_PYTHONVERSION = """
ERROR: The python version must be >= {PYTHONVERSION_MIN}, got {pythonversion}.
ERROR: The python version must be >= {min_python_version}, got {python_version}.
"""


Expand All @@ -30,18 +30,22 @@ def main() -> None:
module_name = "{{ cookiecutter.project_slug}}"

if not re.match(MODULE_REGEX, module_name):
raise ValueError(EXCEPTION_MSG_MODULE_NAME.format(module_name))
raise ValueError(EXCEPTION_MSG_MODULE_NAME.format(module_name=module_name))

environment_name = "{{ cookiecutter.conda_environment_name }}"

if not re.match(ENVIRON_REGEX, environment_name):
raise ValueError(EXCEPTION_MSG_ENVIRON_NAME.format(environment_name))
raise ValueError(
EXCEPTION_MSG_ENVIRON_NAME.format(environment_name=environment_name)
)

python_version = "{{ cookiecutter.python_version }}"

if not re.match(PYTHONVERSION_REGEX, python_version):
raise ValueError(
EXCEPTION_MSG_PYTHONVERSION.format(PYTHONVERSION_MIN, python_version)
EXCEPTION_MSG_PYTHONVERSION.format(
min_python_version=PYTHONVERSION_MIN, python_version=python_version
)
)


Expand Down