# 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)
# -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# Copyright (c) Spyder Project Contributors
#
# Licensed under the terms of the MIT License
# (see LICENSE.txt for details)
# -----------------------------------------------------------------------------
"""Setup script for spyder_terminal."""

# Standard library imports

# Third party imports



def get_version(module='spyder_terminal'):
    """Get version."""
    with open(os.path.join(HERE, module, '__init__.py'), 'r') as f:
        data = f.read()
    lines = data.split('\n')
    for line in lines:
        if line.startswith('VERSION_INFO'):
            version_tuple = ast.literal_eval(line.split('=')[-1].strip())
            version = '.'.join(map(str, version_tuple))
            break
    return version


def get_description():
    """Get long description."""

# 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)

# -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# Copyright (c) Spyder Project Contributors
#
# Licensed under the terms of the MIT License
# (see LICENSE.txt for details)
# -----------------------------------------------------------------------------
"""Setup script for spyder_terminal."""

# Standard library imports

# Third party imports



def get_version(module='spyder_terminal'):
    """Get version."""
    with open(os.path.join(HERE, module, '__init__.py'), 'r') as f:
        data = f.read()
    lines = data.split('\n')
    for line in lines:
        if line.startswith('VERSION_INFO'):
            version_tuple = ast.literal_eval(line.split('=')[-1].strip())
            version = '.'.join(map(str, version_tuple))
            break
    return version


def get_description():
    """Get long description."""

    with open(os.path.join(HERE, 'README.rst'), 'r') as f: