# Path: setupbase.py
# class BuildStatic(Command):
#     user_options = []
# 
#     def initialize_options(self):
#         pass
# 
#     def finalize_options(self):
#         pass
# 
#     def run(self):
#         if not osp.isdir(COMPONENTS):
#             log.info("running [yarn install]")
#             run(['yarn', 'install'], cwd=repo_root)
#             log.info("installing webpack")
#             run(['npm', 'i', '-D', 'webpack'], cwd=repo_root)
#             run(['npm', 'i', 'webpack-cli', 'html-webpack-plugin', 'xterm',
#                  'xterm-addon-attach', 'xterm-addon-search',
#                  'xterm-addon-web-links', 'xterm-addon-fit'],
#                 cwd=repo_root)
#             log.info('running webpack')
#             run(['npm', 'run', 'webpack'], cwd=repo_root)
# 
# class CleanComponents(Command):
#     user_options = []
# 
#     def initialize_options(self):
#         pass
# 
#     def finalize_options(self):
#         pass
# 
#     def run(self):
#         log.info("Removing server components")
#         shutil.rmtree(COMPONENTS, ignore_errors=True)
# 
# COMPONENTS = osp.join(HERE, 'spyder_terminal', 'server', 'static',
#                       'components')
# 
# HERE = os.path.abspath(os.path.dirname(__file__))
# 
# class SdistWithBuildStatic(sdist):
#     def run(self):
#         self.run_command('build_static')
#         sdist.run(self)
# 
#     def make_distribution(self):
#         if not osp.isdir(COMPONENTS):
#             print("\nWARNING: Server components are missing!! We can't "
#                   "proceed further!\n")
#             sys.exit(1)
#         return sdist.make_distribution(self)


import ast
import os
import os.path as osp
import sys
from setuptools import find_packages, setup
from setupbase import (BuildStatic, CleanComponents, COMPONENTS, HERE,
                       SdistWithBuildStatic)
    return data


REQUIREMENTS = [
    'spyder>=5.2.0',
    'tornado',
    'terminado>=0.13.1',
    'coloredlogs',
    'requests'
]

EXTRAS_REQUIRE = {
    'test': [
        'pytest<6.0',
        'pytest-cov',
        'flaky',
        'pytest-qt==3.3.0',
        'pytest-timeout'
    ]
}

# Verify that COMPONENTS exist before trying to build wheels
if any([arg == 'bdist_wheel' for arg in sys.argv]):
    if not osp.isdir(COMPONENTS):
        print("\nWARNING: Server components are missing!! Please run "
              "'python setup.py sdist' first.\n")
        sys.exit(1)

cmdclass = {
    'build_static': BuildStatic,

# Path: setupbase.py
# class BuildStatic(Command):
#     user_options = []
# 
#     def initialize_options(self):
#         pass
# 
#     def finalize_options(self):
#         pass
# 
#     def run(self):
#         if not osp.isdir(COMPONENTS):
#             log.info("running [yarn install]")
#             run(['yarn', 'install'], cwd=repo_root)
#             log.info("installing webpack")
#             run(['npm', 'i', '-D', 'webpack'], cwd=repo_root)
#             run(['npm', 'i', 'webpack-cli', 'html-webpack-plugin', 'xterm',
#                  'xterm-addon-attach', 'xterm-addon-search',
#                  'xterm-addon-web-links', 'xterm-addon-fit'],
#                 cwd=repo_root)
#             log.info('running webpack')
#             run(['npm', 'run', 'webpack'], cwd=repo_root)
# 
# class CleanComponents(Command):
#     user_options = []
# 
#     def initialize_options(self):
#         pass
# 
#     def finalize_options(self):
#         pass
# 
#     def run(self):
#         log.info("Removing server components")
#         shutil.rmtree(COMPONENTS, ignore_errors=True)
# 
# COMPONENTS = osp.join(HERE, 'spyder_terminal', 'server', 'static',
#                       'components')
# 
# HERE = os.path.abspath(os.path.dirname(__file__))
# 
# class SdistWithBuildStatic(sdist):
#     def run(self):
#         self.run_command('build_static')
#         sdist.run(self)
# 
#     def make_distribution(self):
#         if not osp.isdir(COMPONENTS):
#             print("\nWARNING: Server components are missing!! We can't "
#                   "proceed further!\n")
#             sys.exit(1)
#         return sdist.make_distribution(self)


# Path: setup.py
import ast
import os
import os.path as osp
import sys
from setuptools import find_packages, setup
from setupbase import (BuildStatic, CleanComponents, COMPONENTS, HERE,
                       SdistWithBuildStatic)

    return data


REQUIREMENTS = [
    'spyder>=5.2.0',
    'tornado',
    'terminado>=0.13.1',
    'coloredlogs',
    'requests'
]

EXTRAS_REQUIRE = {
    'test': [
        'pytest<6.0',
        'pytest-cov',
        'flaky',
        'pytest-qt==3.3.0',
        'pytest-timeout'
    ]
}

# Verify that COMPONENTS exist before trying to build wheels
if any([arg == 'bdist_wheel' for arg in sys.argv]):
    if not osp.isdir(COMPONENTS):
        print("\nWARNING: Server components are missing!! Please run "
              "'python setup.py sdist' first.\n")
        sys.exit(1)

cmdclass = {
    'build_static': BuildStatic,

    'sdist': SdistWithBuildStatic,