# Path: dput/command.py
# class AbstractCommand(object):
#     """
#     Abstract base class for all concrete dcut command implementations.
#     """
# 
#     __metaclass__ = abc.ABCMeta
# 
#     def __init__(self, interface):
#         self.cmd_name = None
#         self.cmd_purpose = None
#         self.interface = interface
# 
#     @abc.abstractmethod
#     def register(self, parser, **kwargs):
#         pass
# 
#     @abc.abstractmethod
#     def produce(self, fh, args):
#         pass
# 
#     @abc.abstractmethod
#     def validate(self, args):
#         pass
# 
#     @abc.abstractmethod
#     def name_and_purpose(self):
#         pass
# 
#     @abc.abstractmethod
#     def generate_commands_name(self, profile):
#         pass
# 
# Path: dput/exceptions.py
# class DcutError(Exception):
#     pass
# 
# Path: dput/core.py
# CONFIG_LOCATIONS = {
#     "/usr/share/dput-ng/": 30,
#     "/etc/dput.d/": 20,
#     os.path.expanduser("~/.dput.d"): 10,
#     "skel/": 100
# }
# DPUT_CONFIG_LOCATIONS = {
#     "/etc/dput.cf": 15,
#     os.path.expanduser("~/.dput.cf"): 5
# }
# SCHEMA_DIRS = [
#     "/usr/share/dput-ng/schemas",
#     "skel/schemas"
# ]
# def _write_upload_log(logfile, full_log):
# def _enable_debugging(level):
# def mangle_sys():
# def maybe_print_traceback(debug_level, stack):
# def get_local_username():


import time
from dput.command import AbstractCommand
from dput.exceptions import DcutError
from dput.core import logger, get_local_username
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301, USA.




class CancelCommandError(DcutError):
    pass


def generate_debianqueued_commands_name(profile):
    # for debianqueued: $login-$timestamp.commands
    # for dak: $login-$timestamp.dak-commands
    the_file = "%s-%s.commands" % (get_local_username(), int(time.time()))
    logger.trace("Commands file will be named %s" % (the_file))
    return the_file


class CancelCommand(AbstractCommand):
    def __init__(self, interface):
        super(CancelCommand, self).__init__(interface)
        self.cmd_name = "cancel"
        self.cmd_purpose = "cancel a deferred upload"

    def generate_commands_name(self, profile):
        return generate_debianqueued_commands_name(profile)

    def register(self, parser, **kwargs):
        parser.add_argument('-f', '--file', metavar="FILENAME", action='store',
                            default=None, help="file name to be removed",

# Path: dput/command.py
# class AbstractCommand(object):
#     """
#     Abstract base class for all concrete dcut command implementations.
#     """
# 
#     __metaclass__ = abc.ABCMeta
# 
#     def __init__(self, interface):
#         self.cmd_name = None
#         self.cmd_purpose = None
#         self.interface = interface
# 
#     @abc.abstractmethod
#     def register(self, parser, **kwargs):
#         pass
# 
#     @abc.abstractmethod
#     def produce(self, fh, args):
#         pass
# 
#     @abc.abstractmethod
#     def validate(self, args):
#         pass
# 
#     @abc.abstractmethod
#     def name_and_purpose(self):
#         pass
# 
#     @abc.abstractmethod
#     def generate_commands_name(self, profile):
#         pass
# 
# Path: dput/exceptions.py
# class DcutError(Exception):
#     pass
# 
# Path: dput/core.py
# CONFIG_LOCATIONS = {
#     "/usr/share/dput-ng/": 30,
#     "/etc/dput.d/": 20,
#     os.path.expanduser("~/.dput.d"): 10,
#     "skel/": 100
# }
# DPUT_CONFIG_LOCATIONS = {
#     "/etc/dput.cf": 15,
#     os.path.expanduser("~/.dput.cf"): 5
# }
# SCHEMA_DIRS = [
#     "/usr/share/dput-ng/schemas",
#     "skel/schemas"
# ]
# def _write_upload_log(logfile, full_log):
# def _enable_debugging(level):
# def mangle_sys():
# def maybe_print_traceback(debug_level, stack):
# def get_local_username():


# Path: dput/commands/cancel.py
import time
from dput.command import AbstractCommand
from dput.exceptions import DcutError
from dput.core import logger, get_local_username

# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301, USA.




class CancelCommandError(DcutError):
    pass


def generate_debianqueued_commands_name(profile):
    # for debianqueued: $login-$timestamp.commands
    # for dak: $login-$timestamp.dak-commands
    the_file = "%s-%s.commands" % (get_local_username(), int(time.time()))
    logger.trace("Commands file will be named %s" % (the_file))
    return the_file


class CancelCommand(AbstractCommand):
    def __init__(self, interface):
        super(CancelCommand, self).__init__(interface)
        self.cmd_name = "cancel"
        self.cmd_purpose = "cancel a deferred upload"

    def generate_commands_name(self, profile):
        return generate_debianqueued_commands_name(profile)

    def register(self, parser, **kwargs):
        parser.add_argument('-f', '--file', metavar="FILENAME", action='store',
                            default=None, help="file name to be removed",

                            nargs="+", required=True)