# 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/commands/cancel.py
# 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
# 
# Path: dput/profile.py
# def load_profile(host):
#     """
#     Load a profile, for a given host ``host``. In the case where
#     ``host`` has a ":", that'll be treated as an expansion for
#     config strings. For instance:
# 
#     ``ppa:paultag/fluxbox`` will expand any ``%(ppa)s`` strings to
#     ``paultag/fluxbox``. Comes in super handy.
#     """
#     global _multi_config
# 
#     repls = {}
#     if host and ":" in host:
#         host, arg = host.split(":", 1)
#         repls[host] = arg
# 
#     if _multi_config is None:
#         _multi_config = MultiConfig()
#     config = _multi_config
#     config.set_replacements(repls)
#     configs = config.get_config_blocks()
# 
#     if host in configs:
#         return config.get_config(host)
# 
#     if host is not None:
#         raise DputConfigurationError("Error, was given host, "
#                                      "but we don't know about it.")
# 
#     for block in configs:
#         try:
#             obj = config.get_config(block)
#         except DputConfigurationError:
#             continue  # We don't have fully converted blocks.
# 
#         host_main = obj.get('default_host_main')
#         if host_main:  # If we have a default_host_main, let's return that.
#             return config.get_config(host_main)
#     return config.get_config("ftp-master")


from dput.command import AbstractCommand
from dput.exceptions import DcutError
from dput.commands.cancel import generate_debianqueued_commands_name
from dput.profile import load_profile

# Copyright (c) 2013 Luca Falavigna <dktrkranz@debian.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.    See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301, USA.



class DebomaticCommandError(DcutError):
    pass

class BinNMUCommand(AbstractCommand):
    def __init__(self, interface):
        super(BinNMUCommand, self).__init__(interface)
        self.cmd_name = "debomatic-binnmu"
        self.cmd_purpose = ("generate a binNMU upload with Deb-o-Matic")

    def generate_commands_name(self, profile):

# 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/commands/cancel.py
# 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
# 
# Path: dput/profile.py
# def load_profile(host):
#     """
#     Load a profile, for a given host ``host``. In the case where
#     ``host`` has a ":", that'll be treated as an expansion for
#     config strings. For instance:
# 
#     ``ppa:paultag/fluxbox`` will expand any ``%(ppa)s`` strings to
#     ``paultag/fluxbox``. Comes in super handy.
#     """
#     global _multi_config
# 
#     repls = {}
#     if host and ":" in host:
#         host, arg = host.split(":", 1)
#         repls[host] = arg
# 
#     if _multi_config is None:
#         _multi_config = MultiConfig()
#     config = _multi_config
#     config.set_replacements(repls)
#     configs = config.get_config_blocks()
# 
#     if host in configs:
#         return config.get_config(host)
# 
#     if host is not None:
#         raise DputConfigurationError("Error, was given host, "
#                                      "but we don't know about it.")
# 
#     for block in configs:
#         try:
#             obj = config.get_config(block)
#         except DputConfigurationError:
#             continue  # We don't have fully converted blocks.
# 
#         host_main = obj.get('default_host_main')
#         if host_main:  # If we have a default_host_main, let's return that.
#             return config.get_config(host_main)
#     return config.get_config("ftp-master")


# Path: dput/commands/contrib/debomatic.py
from dput.command import AbstractCommand
from dput.exceptions import DcutError
from dput.commands.cancel import generate_debianqueued_commands_name
from dput.profile import load_profile


# Copyright (c) 2013 Luca Falavigna <dktrkranz@debian.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.    See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301, USA.



class DebomaticCommandError(DcutError):
    pass

class BinNMUCommand(AbstractCommand):
    def __init__(self, interface):
        super(BinNMUCommand, self).__init__(interface)
        self.cmd_name = "debomatic-binnmu"
        self.cmd_purpose = ("generate a binNMU upload with Deb-o-Matic")

    def generate_commands_name(self, profile):

        return generate_debianqueued_commands_name(profile)