# Path: stoq/exceptions.py
# class StoqException(Exception):
#     pass
# 
# class StoqPluginException(Exception):
#     pass


import os
import sys
import logging
import requests
import subprocess
from tempfile import NamedTemporaryFile
from .exceptions import StoqException, StoqPluginException
                            '--quiet',
                            '-r',
                            temp_file.name,
                        ]
                    )
                elif response.status_code == 404:
                    pass
                else:
                    log.info(f'Failed to install requirements from {requirements}')
        else:
            requirements = f'{plugin_path}/requirements.txt'
            if os.path.isfile(requirements):
                subprocess.check_call(
                    [
                        sys.executable,
                        '-m',
                        'pip',
                        'install',
                        '--quiet',
                        '-r',
                        requirements,
                    ]
                )

        cmd = [sys.executable, '-m', 'pip', 'install', plugin_path, '-t', install_dir]
        if upgrade:
            cmd.append('--upgrade')
        try:
            output = subprocess.check_output(cmd, stderr=subprocess.STDOUT)
            if f'WARNING: Target directory {install_dir}' in output.decode():

# Path: stoq/exceptions.py
# class StoqException(Exception):
#     pass
# 
# class StoqPluginException(Exception):
#     pass


# Path: stoq/installer.py
import os
import sys
import logging
import requests
import subprocess
from tempfile import NamedTemporaryFile
from .exceptions import StoqException, StoqPluginException

                            '--quiet',
                            '-r',
                            temp_file.name,
                        ]
                    )
                elif response.status_code == 404:
                    pass
                else:
                    log.info(f'Failed to install requirements from {requirements}')
        else:
            requirements = f'{plugin_path}/requirements.txt'
            if os.path.isfile(requirements):
                subprocess.check_call(
                    [
                        sys.executable,
                        '-m',
                        'pip',
                        'install',
                        '--quiet',
                        '-r',
                        requirements,
                    ]
                )

        cmd = [sys.executable, '-m', 'pip', 'install', plugin_path, '-t', install_dir]
        if upgrade:
            cmd.append('--upgrade')
        try:
            output = subprocess.check_output(cmd, stderr=subprocess.STDOUT)
            if f'WARNING: Target directory {install_dir}' in output.decode():

                raise StoqPluginException(