# Path: valohai_cli/exceptions.py
# class ConfigurationError(CLIException, RuntimeError):
#     kind = 'Configuration Error'
# 
# class NoCommit(ValueError, CLIException):
#     color = 'yellow'
# 
#     def __init__(self, directory: str) -> None:
#         self.directory = directory
#         super().__init__(f'{directory} has no commits')
# 
# class PackageTooLarge(CLIException):
#     pass
# 
# Path: valohai_cli/git.py
# def describe_current_commit(directory: str) -> str:
#     """
#     (Try to) describe the lineage and status of the Git working copy in `directory`.
#     :param directory: Directory path.
#     :return: Git description string
#     """
#     return check_git_output(['git', 'describe', '--always', '--long', '--dirty', '--all'], directory).strip().decode()


import os
import pytest
import valohai_cli.packager as pkg
from subprocess import check_call, check_output
from typing import Set
from click import termui
from valohai_cli.exceptions import ConfigurationError, NoCommit, PackageTooLarge
from valohai_cli.git import describe_current_commit




def write_temp_files(
    tmpdir,
    *,
    with_yaml: bool = True,
    with_gitignore: bool = True,
    with_vhignore: bool = False,
    large_file_size: int = 0,
):
    if with_gitignore:
        tmpdir.join('.gitignore').write_text('a*\n', 'utf8')  # ignore all files starting with a
    if with_vhignore:
        tmpdir.join('.vhignore').write_text('kah*\n', 'utf8')  # ignore all files starting with kah

    tmpdir.join('asbestos').write_text('scary', 'utf8')
    tmpdir.join('kahvikuppi').write_text('mmmm, coffee', 'utf8')

# Path: valohai_cli/exceptions.py
# class ConfigurationError(CLIException, RuntimeError):
#     kind = 'Configuration Error'
# 
# class NoCommit(ValueError, CLIException):
#     color = 'yellow'
# 
#     def __init__(self, directory: str) -> None:
#         self.directory = directory
#         super().__init__(f'{directory} has no commits')
# 
# class PackageTooLarge(CLIException):
#     pass
# 
# Path: valohai_cli/git.py
# def describe_current_commit(directory: str) -> str:
#     """
#     (Try to) describe the lineage and status of the Git working copy in `directory`.
#     :param directory: Directory path.
#     :return: Git description string
#     """
#     return check_git_output(['git', 'describe', '--always', '--long', '--dirty', '--all'], directory).strip().decode()


# Path: tests/test_packaging.py
import os
import pytest
import valohai_cli.packager as pkg
from subprocess import check_call, check_output
from typing import Set
from click import termui
from valohai_cli.exceptions import ConfigurationError, NoCommit, PackageTooLarge
from valohai_cli.git import describe_current_commit





def write_temp_files(
    tmpdir,
    *,
    with_yaml: bool = True,
    with_gitignore: bool = True,
    with_vhignore: bool = False,
    large_file_size: int = 0,
):
    if with_gitignore:
        tmpdir.join('.gitignore').write_text('a*\n', 'utf8')  # ignore all files starting with a
    if with_vhignore:
        tmpdir.join('.vhignore').write_text('kah*\n', 'utf8')  # ignore all files starting with kah

    tmpdir.join('asbestos').write_text('scary', 'utf8')
    tmpdir.join('kahvikuppi').write_text('mmmm, coffee', 'utf8')

    tmpdir.join('.hiddenfile').write_text('where is it', 'utf8')