Skip to content

Commit

Permalink
Merge pull request #86 from ccordoba12/fix-installation
Browse files Browse the repository at this point in the history
PR: Several installation fixes
  • Loading branch information
ccordoba12 committed Jul 7, 2017
2 parents a630135 + 524c117 commit 1359922
Show file tree
Hide file tree
Showing 7 changed files with 67 additions and 21 deletions.
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ include CHANGELOG.md
include CONTRIBUTORS.md
include LICENSE.txt
include README.rst
include setupbase.py
recursive-include spyder_terminal/server/static *.html *.js *.json *.css *.eot *.tff *.woff *.woff2
8 changes: 7 additions & 1 deletion RELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,15 @@ To release a new version of spyder-terminal:

* git add and git commit

* python setup.py clean_components

* python setup.py sdist upload

* python setup.py bdist_wheel upload
* python3 setup.py bdist_wheel --plat-name win_amd64 upload

* python3 setup.py bdist_wheel --plat-name win32 upload

* python setup.py bdist_wheel --universal upload

* git tag -a vX.X.X -m 'comment'

Expand Down
3 changes: 0 additions & 3 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,2 @@
[bdist_wheel]
universal=1

[aliases]
install = build_static install
34 changes: 25 additions & 9 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,34 @@
"""Setup script for spyder_terminal."""

# Standard library imports
import ast
import os
import sys

# Third party imports
from setuptools import find_packages, setup

from setupbase import (DevelopWithBuildStatic,
SdistWithBuildStatic,
BuildStatic)

# Loca imports
from spyder_terminal import __version__
from setupbase import (BuildStatic,
CleanComponents,
SdistWithBuildStatic)


HERE = os.path.abspath(os.path.dirname(__file__))


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:
Expand All @@ -34,16 +46,20 @@ def get_description():
REQUIREMENTS = ['spyder>=3.2.0.dev0', 'pexpect', 'tornado',
'coloredlogs', 'requests']

if os.name == 'nt' or any([arg.startswith('win') for arg in sys.argv]):
REQUIREMENTS.append('pywinpty')


cmdclass = {
'build_static': BuildStatic,
# 'develop': DevelopWithBuildStatic,
'sdist': SdistWithBuildStatic
'sdist': SdistWithBuildStatic,
'clean_components': CleanComponents
}


setup(
name='spyder_terminal',
version=__version__,
version=get_version(),
cmdclass=cmdclass,
keywords=['Spyder', 'Plugin'],
url='https://github.com/spyder-ide/spyder-terminal',
Expand Down
30 changes: 26 additions & 4 deletions setupbase.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@
"""

import os
import sys
import os.path as osp
import pipes
import shutil
import sys

from distutils import log
from distutils.core import Command
Expand All @@ -25,6 +27,11 @@ def list2cmdline(cmd_list):
return ' '.join(map(pipes.quote, cmd_list))


HERE = os.path.abspath(os.path.dirname(__file__))
COMPONENTS = osp.join(HERE, 'spyder_terminal', 'server', 'static',
'components')


repo_root = os.path.dirname(os.path.abspath(__file__))


Expand All @@ -35,6 +42,21 @@ def run(cmd, *args, **kwargs):
return check_call(cmd, *args, **kwargs)


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 [bower install]")
run(['bower', 'install', '--allow-root'], cwd=repo_root)


class DevelopWithBuildStatic(develop):
def install_for_development(self):
self.run_command('build_static')
Expand All @@ -47,7 +69,7 @@ def make_distribution(self):
return sdist.make_distribution(self)


class BuildStatic(Command):
class CleanComponents(Command):
user_options = []

def initialize_options(self):
Expand All @@ -57,5 +79,5 @@ def finalize_options(self):
pass

def run(self):
log.info("running [bower install]")
run(['bower', 'install', '--allow-root'], cwd=repo_root)
log.info("Removing server components")
shutil.rmtree(COMPONENTS)
1 change: 1 addition & 0 deletions spyder_terminal/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@
from .terminalplugin import TerminalPlugin as PLUGIN_CLASS

PLUGIN_CLASS

VERSION_INFO = (0, 2, 0, 'dev0')
__version__ = '.'.join(map(str, VERSION_INFO))
11 changes: 7 additions & 4 deletions spyder_terminal/terminalplugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import subprocess
import os.path as osp

from qtpy import PYQT5
from qtpy import PYQT4, PYSIDE
from qtpy.QtWidgets import (QApplication, QMessageBox, QVBoxLayout, QMenu,
QShortcut)

Expand All @@ -37,7 +37,7 @@
# from spyder.py3compat import is_text_string, to_text_string
from spyder.utils.misc import select_port

from spyder.py3compat import getcwd
from spyder.py3compat import PY2, getcwd
from spyder.config.base import DEV

LOCATION = osp.realpath(osp.join(os.getcwd(),
Expand Down Expand Up @@ -173,8 +173,11 @@ def check_compatibility(self):
"""Check if current Qt backend version is greater or equal to 5."""
message = ''
valid = True
if not PYQT5:
message = 'Spyder-terminal does not work with Qt4'
if PYQT4 or PYSIDE:
message = 'This plugin does not work with Qt 4'
valid = False
elif WINDOWS and PY2:
message = 'This plugin does not work with Python 2 on Windows'
valid = False
return valid, message

Expand Down

0 comments on commit 1359922

Please sign in to comment.