# Path: diffoscope/exc.py
# class RequiredToolNotFound(Exception):
#     def __init__(self, command):
#         self.command = command
# 
#     def get_package(self):
#         try:
#             providers = EXTERNAL_TOOLS[self.command]
#         except KeyError:  # noqa
#             return None
# 
#         return providers.get(get_current_os(), None)
# 
# Path: diffoscope/tools.py
# def tool_required(command):
#     """
#     Decorator that checks if the specified tool is installed
#     """
#     if not hasattr(tool_required, 'all'):
#         tool_required.all = set()
#     tool_required.all.add(command)
#     def wrapper(original_function):
#         if find_executable(command):
#             @functools.wraps(original_function)
#             def tool_check(*args, **kwargs):
#                 with profile('command', command):
#                     return original_function(*args, **kwargs)
#         else:
#             @functools.wraps(original_function)
#             def tool_check(*args, **kwargs):
#                 from .exc import RequiredToolNotFound
#                 raise RequiredToolNotFound(command)
#         return tool_check
#     return wrapper


import re
import logging
from diffoscope.exc import RequiredToolNotFound
from diffoscope.tools import tool_required
from diffoscope.difference import Difference
from .text import TextFile
from .utils.command import Command
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# diffoscope 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 diffoscope.  If not, see <https://www.gnu.org/licenses/>.




logger = logging.getLogger(__name__)


class Pstotext(Command):
    @tool_required('ps2ascii')
    def cmdline(self):
        return ['ps2ascii', self.path]


class PsFile(TextFile):
    RE_FILE_TYPE = re.compile(r'^PostScript document\b')

    def compare(self, other, source=None):
        differences = super().compare(other, source)
        details = None

# Path: diffoscope/exc.py
# class RequiredToolNotFound(Exception):
#     def __init__(self, command):
#         self.command = command
# 
#     def get_package(self):
#         try:
#             providers = EXTERNAL_TOOLS[self.command]
#         except KeyError:  # noqa
#             return None
# 
#         return providers.get(get_current_os(), None)
# 
# Path: diffoscope/tools.py
# def tool_required(command):
#     """
#     Decorator that checks if the specified tool is installed
#     """
#     if not hasattr(tool_required, 'all'):
#         tool_required.all = set()
#     tool_required.all.add(command)
#     def wrapper(original_function):
#         if find_executable(command):
#             @functools.wraps(original_function)
#             def tool_check(*args, **kwargs):
#                 with profile('command', command):
#                     return original_function(*args, **kwargs)
#         else:
#             @functools.wraps(original_function)
#             def tool_check(*args, **kwargs):
#                 from .exc import RequiredToolNotFound
#                 raise RequiredToolNotFound(command)
#         return tool_check
#     return wrapper


# Path: diffoscope/comparators/ps.py
import re
import logging
from diffoscope.exc import RequiredToolNotFound
from diffoscope.tools import tool_required
from diffoscope.difference import Difference
from .text import TextFile
from .utils.command import Command

# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# diffoscope 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 diffoscope.  If not, see <https://www.gnu.org/licenses/>.




logger = logging.getLogger(__name__)


class Pstotext(Command):
    @tool_required('ps2ascii')
    def cmdline(self):
        return ['ps2ascii', self.path]


class PsFile(TextFile):
    RE_FILE_TYPE = re.compile(r'^PostScript document\b')

    def compare(self, other, source=None):
        differences = super().compare(other, source)
        details = None

        try: