From c6cd95bcb797373dd8bc01bd339e92d5d196a765 Mon Sep 17 00:00:00 2001 From: Kevin Phillips Date: Sun, 10 Feb 2019 22:45:42 -0400 Subject: [PATCH] updated to template spec --- .idea/codeStyles/Project.xml | 28 --- .travis.yml | 77 ++++----- README.rst | 40 ----- docs/conf.py | 25 ++- lock.sh | 25 +++ project.prop | 28 +++ requirements2.txt | 50 ------ requirements3.txt | 41 ----- setup.py | 294 +++++++++++++++++++++++++------- src/friendlyshell/__init__.py | 14 +- src/friendlyshell/base_shell.py | 2 +- src/friendlyshell/version.prop | 6 + tests/python2.reqs | 57 +++++++ tests/python3.reqs | 48 ++++++ tox.ini | 41 +++-- toxenv.sh | 8 + update_docs.bat | 7 - update_docs.sh | 7 - 18 files changed, 495 insertions(+), 303 deletions(-) delete mode 100644 .idea/codeStyles/Project.xml create mode 100755 lock.sh create mode 100644 project.prop delete mode 100644 requirements2.txt delete mode 100644 requirements3.txt create mode 100644 src/friendlyshell/version.prop create mode 100644 tests/python2.reqs create mode 100644 tests/python3.reqs create mode 100755 toxenv.sh delete mode 100644 update_docs.bat delete mode 100755 update_docs.sh diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml deleted file mode 100644 index 565c347..0000000 --- a/.idea/codeStyles/Project.xml +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/.travis.yml b/.travis.yml index f975c1f..98e73ca 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,54 +1,41 @@ language: python -# Generate a matrix for all Python versions we support -matrix: +python: + - 2.7 + - 3.4 + - 3.5 + - 3.6 + - pypy + - pypy3.5 + +install: + - pip install tox twine wheel python-coveralls + +script: + - echo $TRAVIS_PYTHON_VERSION + - export PYVER=`echo $TRAVIS_PYTHON_VERSION | tr "." "\n" | head -n 1 | sed 's/^py//'` + - echo $PYVER + - tox -e py$PYVER + +# Deploy to test.pypi.org for branches +# Deploy to pypi.org for tags +# NOTE: You can not replace builds published to pypi, even if you delete one +# so you must make sure your versions are always unique +jobs: include: - - name: "Python pypy 2 tests" - python: pypy - env: TOXENV=pypy - - name: "Python pypy 3 tests" - python: pypy3 - env: TOXENV=pypy3 - - name: "Python 2.7 tests" - python: 2.7 - env: TOXENV=py27 - - name: "Python 3.4 tests" - python: 3.4 - env: TOXENV=py34 - - name: "Python 3.5 tests" - python: 3.5 - env: TOXENV=py35 - - name: "Python 3.6 tests" - python: 3.6 - env: TOXENV=py36 - - name: "Python 3.7 tests" - python: 3.7 - env: TOXENV=py37 - # NOTE: Python 3.7 is currently not natively supported by Travis-CI so we - # have to hack around it here using Ubuntu 16.04 - dist: xenial - sudo: true - - name: "Deploy to PYPI" - # Only enable deploys when building from tags - if: tag IS present - # As a general convention we just package and deploy from Python 3.6 - # The version really shouldn't matter since our wheel file is version - # agnostic + - stage: deploy-release python: 3.6 - env: TOXENV=py36 - stage: deploy script: - python setup.py bdist_wheel - twine upload dist/*.whl -u $DEPLOY_USER -p $DEPLOY_PASS - -# Install all of our build-time dependencies -install: pip install wheel twine tox coveralls - -# Scripts for the default "test" stage -# one copy of this default job will be generated for each python -# version stated above -script: - - tox + if: tag IS true + - stage: deploy-snapshot + python: 3.6 + script: + - python setup.py bdist_wheel + - twine upload --repository-url https://test.pypi.org/legacy/ + dist/*.whl -u $DEPLOY_USER -p $DEPLOY_PASS + if: tag IS NOT true after_success: - - coveralls \ No newline at end of file + - coveralls diff --git a/README.rst b/README.rst index cc7f971..e0926aa 100644 --- a/README.rst +++ b/README.rst @@ -1,43 +1,3 @@ -.. This is a readme file encoded in reStructuredText format, intended for use on -.. the summary page for the FriendlyShell PyPI project. Care should be taken to -.. make sure the encoding is compatible with PyPI's markup syntax. See this site -.. for details: -.. http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html -.. - - -.. image:: https://img.shields.io/pypi/l/friendlyshell.svg - :target: https://github.com/TheFriendlyCoder/friendlyshell/blob/master/LICENSE - :alt: License - -.. image:: https://coveralls.io/repos/github/TheFriendlyCoder/friendlyshell/badge.svg?branch=master - :target: https://coveralls.io/github/TheFriendlyCoder/friendlyshell?branch=master - :alt: Test Coverage - -.. image:: https://readthedocs.org/projects/friendlyshell/badge/?version=latest - :target: http://friendlyshell.readthedocs.io/en/latest - :alt: Documentation Status - -.. image:: https://requires.io/github/TheFriendlyCoder/friendlyshell/requirements.svg?branch=master - :target: https://requires.io/github/TheFriendlyCoder/friendlyshell/requirements/?branch=master - :alt: Requirements Status - -.. image:: https://img.shields.io/pypi/pyversions/friendlyshell.svg - :target: https://pypi.org/project/friendlyshell/ - :alt: Python Versions - -.. image:: https://img.shields.io/pypi/format/friendlyshell.svg - :target: https://pypi.org/project/friendlyshell/ - :alt: Format - -.. image:: https://badge.fury.io/py/friendlyshell.svg - :target: https://pypi.org/project/friendlyshell/ - :alt: Latest Version - -.. image:: https://api.travis-ci.org/TheFriendlyCoder/friendlyshell.svg?branch=master - :target: https://travis-ci.org/TheFriendlyCoder/friendlyshell - :alt: Build status - ============= Overview ============= diff --git a/docs/conf.py b/docs/conf.py index b460f82..c37360a 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -12,20 +12,27 @@ # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.abspath to make it absolute, like shown here. # -import os -import sys -sys.path.insert(0, os.path.abspath(os.path.join('..', 'src'))) +import ast +# import os +# import sys +# sys.path.insert(0, os.path.abspath(os.path.join('..', 'src'))) # -- Project information ----------------------------------------------------- -project = 'friendlyshell' -copyright = '2018, Kevin S. Phillips' +copyright = '2019, Kevin S. Phillips' author = 'Kevin S. Phillips' - -# The short X.Y version -import friendlyshell -version = friendlyshell.__version__ +_proj_props = ast.literal_eval(open('../project.prop').read()) +_proj_props["VERSION"] = \ + ast.literal_eval(open("../src/" + _proj_props["NAME"] + "/version.prop").read()) +project = _proj_props["NAME"] +# The version info for the project you're documenting, acts as replacement for +# |version| and |release|, also used in various other places throughout the +# built documents. +# +# The short X.Y version. +version = _proj_props["VERSION"] +# The full version, including alpha/beta/rc tags. release = version diff --git a/lock.sh b/lock.sh new file mode 100755 index 0000000..16a0533 --- /dev/null +++ b/lock.sh @@ -0,0 +1,25 @@ +#!/bin/bash -e +# Generates pip dependency files for build and test purposes +# NOTE: The generated requirements files are named in a weird +# way here because we are trying to prevent requires.io +# from picking up test dependencies and reporting on them +# to our users. It seems to pick up quite a variety of +# file patterns, recursively within the repo. *.reqs +# seems to be a suitable exception +# NOTE: The requirements files generated by this script are +# referenced by the tox.ini config file at build time. +# Any changes to this pattern will need to be reflected +# there as well. +virtualenv -p python2 tmp +source ./tmp/bin/activate +pip install -e .[dev] +pip freeze --exclude-editable > ./tests/python2.reqs +deactivate +rm -rf tmp + +virtualenv -p python3 tmp +source ./tmp/bin/activate +pip install -e .[dev] +pip freeze --exclude-editable > ./tests/python3.reqs +deactivate +rm -rf tmp diff --git a/project.prop b/project.prop new file mode 100644 index 0000000..4629e3e --- /dev/null +++ b/project.prop @@ -0,0 +1,28 @@ +# This file contains a single dictionary definition containing all of the +# project-specific customization options supported by this template. It is +# parsed by the setup.py at build time. +{ + "NAME" : "friendlyshell", + "REPO" : "friendlyshell", + "DEPENDENCIES" : [ + "six", + "pyparsing", + "tabulate", + 'pyreadline; platform_system == "Windows"', + ], + "DEV_DEPENDENCIES" : [ + "twine", + "pytest", + "pytest-cov", + "pytest-timeout", + "mock", + "pylint", + "sphinx", + "tox", + ], + "DESCRIPTION" : "Framework for writing interactive Python command line " + "interfaces, similar to the 'cmd' built in class.", + "KEYWORDS" : "cmd command line shell interactive interpreter", + "SUPPORTED_PYTHON_VERSION" : + ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, <4", +} \ No newline at end of file diff --git a/requirements2.txt b/requirements2.txt deleted file mode 100644 index 1bb165e..0000000 --- a/requirements2.txt +++ /dev/null @@ -1,50 +0,0 @@ -alabaster==0.7.12 -astroid==1.6.5 -atomicwrites==1.2.1 -attrs==18.2.0 -Babel==2.6.0 -backports.functools-lru-cache==1.5 -certifi==2018.10.15 -chardet==3.0.4 -configparser==3.5.0 -coverage==4.5.1 -docutils==0.14 -enum34==1.1.6 -filelock==3.0.10 -funcsigs==1.0.2 -futures==3.2.0 -idna==2.7 -imagesize==1.1.0 -isort==4.3.4 -Jinja2==2.10 -lazy-object-proxy==1.3.1 -MarkupSafe==1.1.0 -mccabe==0.6.1 -mock==2.0.0 -more-itertools==4.3.0 -packaging==18.0 -pathlib2==2.3.2 -pbr==5.1.1 -pluggy==0.8.0 -py==1.7.0 -Pygments==2.2.0 -pylint==1.9.3 -pyparsing==2.3.0 -pytest==3.10.0 -pytest-cov==2.6.0 -pytest-timeout==1.3.2 -pytz==2018.7 -requests==2.20.1 -scandir==1.9.0 -singledispatch==3.4.0.3 -six==1.11.0 -snowballstemmer==1.2.1 -Sphinx==1.8.1 -sphinxcontrib-websupport==1.1.0 -tabulate==0.8.2 -toml==0.10.0 -tox==3.5.3 -typing==3.6.6 -urllib3==1.24.1 -virtualenv==16.1.0 -wrapt==1.10.11 diff --git a/requirements3.txt b/requirements3.txt deleted file mode 100644 index 1b15be4..0000000 --- a/requirements3.txt +++ /dev/null @@ -1,41 +0,0 @@ -alabaster==0.7.12 -astroid==2.0.4 -atomicwrites==1.2.1 -attrs==18.2.0 -Babel==2.6.0 -certifi==2018.10.15 -chardet==3.0.4 -coverage==4.5.1 -docutils==0.14 -filelock==3.0.10 -idna==2.7 -imagesize==1.1.0 -isort==4.3.4 -Jinja2==2.10 -lazy-object-proxy==1.3.1 -MarkupSafe==1.1.0 -mccabe==0.6.1 -mock==2.0.0 -more-itertools==4.3.0 -packaging==18.0 -pbr==5.1.1 -pluggy==0.8.0 -py==1.7.0 -Pygments==2.2.0 -pylint==2.1.1 -pyparsing==2.3.0 -pytest==3.10.0 -pytest-cov==2.6.0 -pytest-timeout==1.3.2 -pytz==2018.7 -requests==2.20.1 -six==1.11.0 -snowballstemmer==1.2.1 -Sphinx==1.8.1 -sphinxcontrib-websupport==1.1.0 -tabulate==0.8.2 -toml==0.10.0 -tox==3.5.3 -urllib3==1.24.1 -virtualenv==16.1.0 -wrapt==1.10.11 diff --git a/setup.py b/setup.py index 59052e2..6525bdf 100755 --- a/setup.py +++ b/setup.py @@ -1,101 +1,277 @@ #!/usr/bin/env python -"""Packaging script""" +"""Setuptools packaging script for the project""" import os +import ast from setuptools import setup, find_packages -def check_tag_name(tag_name): - """Ensures the name of the current SCM tag is correctly formatted +def load_console_scripts(project): + """Generates list of 'entry point' functions for use by Python setup tools - Tag should represent a version number of the form X.Y.Z + Each element in this list defines the name and entry point function for each + python script included with the current project that is to be exposed to + user's shells when the package is installed. - :returns: True if the tag name satisfies the expected format, false if not + This script assumes that any python script found in a folder named 'scripts' + under the project folder is to be exposed on the shell during deployment. + Further, this script assumes that all such scripts expose a public function + called 'main' which will act as the primary entry point for the script. This + function will then be responsible for parsing any supported command line + parameters and executing the appropriate functionality. + + The output from this function can be provided to the setuptools.setup() + function, something like this: + + entry_points={ + 'console_scripts': load_console_scripts(project_name) + } + + :param str project: + the name of the current project. It is also assumed that the project + sources will be located under a sub-folder of the same name. + :return: + list of shell scripts exposed by this project. Produces an empty + list if there are no shell scripts supported by the project. """ + scripts_path = os.path.join(project, 'scripts') + if not os.path.exists(scripts_path): + return [] + + scripts_namespace = "{0}.scripts".format(project) + retval = [] + + py_scripts = os.listdir(scripts_path) + for py_file in py_scripts: + file_parts = os.path.splitext(py_file) + if file_parts[1] == ".py" and file_parts[0] != '__init__': + script_config = "{0}={1}.{0}:main".format( + file_parts[0], + scripts_namespace + ) + retval.append(script_config) + + return retval - parts = tag_name.split(".") + +def _verify_src_version(version): + """Checks to make sure an arbitrary character string is a valid version id + + Version numbers are expected to be of the form X.Y.Z + + :param str version: string to validate + :returns: True if the string is a version number, else false + :rtype: :class:`bool` + """ + if not isinstance(version, str): + return False + if "." not in version: + return False + parts = version.split(".") if len(parts) != 3: return False - for cur_digit in parts: - if not cur_digit.isdigit(): + for cur_part in parts: + if not cur_part.isdigit(): return False - return True -def get_version_number(): +def _src_version(project): + """Parses the version number from the source project + + :param str project: the name of the project to get the version for + :returns: the version for the specified project + :rtype: :class:`str` + """ + ver_path = os.path.join(os.getcwd(), 'src', project, 'version.prop') + assert os.path.exists(ver_path) + + data = open(ver_path).read() + retval = ast.literal_eval(data) + + assert retval is not None + assert _verify_src_version(retval) + return retval + + +def get_version_number(project): """Retrieves the version number for a project""" - # If we are building from a tag using Travis-CI, - # set our version number to the tag name + retval = _src_version(project) + if 'TRAVIS_TAG' in os.environ and not os.environ['TRAVIS_TAG'] == '': - if not check_tag_name(os.environ['TRAVIS_TAG']): - raise Exception( - "Invalid tag name {0}. Must be of the form 'X.Y.Z'".format( - os.environ['TRAVIS_TAG'])) - return os.environ['TRAVIS_TAG'] - - # if we get here we know we're building a pre-release version - # so we set a fake version as a place holder - retval = "0.0" - - # If we are building from a branch using Travis-CI, - # append the build number so we know where the package came from + # HACK: Let us assume we're going to use the tag name + # when building the template project. Makes it + # easier to test release builds + if project == "ksp_sample": + return os.environ['TRAVIS_TAG'] + + # make sure the tag name matches our version number + if not os.environ['TRAVIS_TAG'] == retval: + raise Exception("Tag {0} is expected to be {1}".format( + os.environ['TRAVIS_TAG'], + retval + )) + # If we build from a tag, just use the version number verbatim + return retval + + # Pre release versions need a non-numeric suffix on the version number + retval += ".dev" if 'TRAVIS_BUILD_NUMBER' in os.environ: - retval += "." + os.environ['TRAVIS_BUILD_NUMBER'] + retval += os.environ['TRAVIS_BUILD_NUMBER'] else: - retval += ".0" + retval += "0" - # Pre release versions need a non-numeric suffix on the version number - retval += ".dev0" + return retval + + +def generate_readme(project, repo=None, version=None): + """Generates a readme for the Python package, based on the readme file + + :param str project: name of the project to generate the readme for + :param str repo: + optional name of the git repo for the project + if not provided, it is assumed the repo name matches the project name + :param str version: + optional version of the package being generated + when not provided, the " + :returns: readme text for the package + :rtype: :class:`str` + """ + if repo is None: + repo = project + + if not version or "dev" in version: + branch = "branch=master" + version = "latest" + + else: + branch = "tag=" + version + + headers = list() + headers.append({ + "image": + "https://travis-ci.org/TheFriendlyCoder/{0}.svg?{1}". + format(repo, branch), + "target": + "https://travis-ci.org/TheFriendlyCoder/{0}". + format(repo), + "text": "Build Automation" + }) + headers.append({ + "image": "https://coveralls.io/repos/github/TheFriendlyCoder/{0}/" + "badge.svg?{1}".format(repo, branch), + "target": + "https://coveralls.io/github/TheFriendlyCoder/{0}?{1}". + format(repo, branch), + "text": "Test Coverage" + }) + headers.append({ + "image": + "https://img.shields.io/pypi/pyversions/{0}.svg". + format(project), + "target": "https://pypi.python.org/pypi/{0}".format(project), + "text": "Python Versions" + }) + headers.append({ + "image": + "https://readthedocs.org/projects/{0}/badge/?version={1}". + format(project, version), + "target": "http://{0}.readthedocs.io/en/{1}".format(project, version), + "text": "Documentation Status" + }) + headers.append({ + "image": + "https://requires.io/github/TheFriendlyCoder/{0}/" + "requirements.svg?{1}".format(repo, branch), + "target": + "https://requires.io/github/TheFriendlyCoder/{0}/" + "requirements/?{1}".format(repo, branch), + "text": "Requirements Status" + }) + headers.append({ + "image": "https://img.shields.io/pypi/format/{0}.svg".format(project), + "target": "https://pypi.python.org/pypi/{0}/".format(project), + "text": "Package Format" + }) + headers.append({ + "image": "https://img.shields.io/pypi/dm/{0}.svg".format(project), + "target": "https://pypi.python.org/pypi/{0}/".format(project), + "text": "Download Count" + }) + headers.append({ + "image": "https://img.shields.io/pypi/l/{0}.svg".format(project), + "target": "https://www.gnu.org/licenses/gpl-3.0-standalone.html", + "text": "GPL License" + }) + + header_template = """.. image:: {0} + :target: {1} + :alt: {2} + + """ + + retval = "" + for cur_header in headers: + retval += header_template.format( + cur_header["image"], cur_header["target"], cur_header["text"]) + retval += "\n" + + retval += open('README.rst').read() return retval +def load_project_properties(): + """Loads project specific properties from the project.prop file + + :returns: project properties + :rtype: :class:`dict` + """ + cur_file = os.path.realpath(__file__) + cur_path = os.path.split(cur_file)[0] + props = open(os.path.join(cur_path, 'project.prop')).read() + return ast.literal_eval(props) + + +PROJECT = load_project_properties() +PROJECT["VERSION"] = get_version_number(PROJECT["NAME"]) + +# Execute packaging logic setup( - name='friendlyshell', - version=get_version_number(), + name=PROJECT["NAME"], + version=PROJECT["VERSION"], author='Kevin S. Phillips', - author_email='kevin@thefriendlycoder.com', - package_dir={'': 'src'}, + author_email='thefriendlycoder@gmail.com', packages=find_packages('src'), - description="Framework for writing interactive Python command line " - "interfaces, similar to the 'cmd' built in class.", - long_description=open('README.rst').read(), - url='https://github.com/TheFriendlyCoder/FriendlyShell', - install_requires=[ - 'pyparsing', - 'tabulate', - 'pyreadline; platform_system == "Windows"' - ], + package_dir={'': 'src'}, + description=PROJECT["DESCRIPTION"], + long_description= + generate_readme(PROJECT["NAME"], PROJECT["REPO"], PROJECT["VERSION"]), + url='https://github.com/TheFriendlyCoder/' + PROJECT["NAME"], + keywords=PROJECT["KEYWORDS"], + entry_points={ + 'console_scripts': load_console_scripts(PROJECT["NAME"]) + }, + install_requires=PROJECT["DEPENDENCIES"], + python_requires=PROJECT["SUPPORTED_PYTHON_VERSION"], extras_require={ - 'dev': [ - 'pytest', - 'pytest-cov', - 'pytest-timeout', - 'mock', - 'pylint', - 'sphinx', - 'tox'], + 'dev': PROJECT["DEV_DEPENDENCIES"] + }, + package_data={ + PROJECT["NAME"]: ["version.prop"] }, - keywords='cmd command line shell interactive interpreter', license="GPL", + # https://pypi.org/classifiers/ classifiers=[ "Development Status :: 3 - Alpha", "Environment :: Console", "License :: OSI Approved :: " "GNU General Public License v3 or later (GPLv3+)", + "Topic :: Software Development :: Libraries", "Natural Language :: English", - "Operating System :: MacOS", - "Operating System :: Microsoft", - "Operating System :: POSIX", + "Operating System :: OS Independent", "Programming Language :: Python :: 2", - "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.3", - "Programming Language :: Python :: 3.4", - "Programming Language :: Python :: 3.5", - "Programming Language :: Python :: 3.6", - "Topic :: Software Development :: Libraries" ] ) diff --git a/src/friendlyshell/__init__.py b/src/friendlyshell/__init__.py index 194a57d..04bbe0f 100644 --- a/src/friendlyshell/__init__.py +++ b/src/friendlyshell/__init__.py @@ -1,7 +1,11 @@ """Package initialization...""" -from pkg_resources import get_distribution, DistributionNotFound +import logging +import os +import ast -try: - __version__ = get_distribution(__name__).version -except DistributionNotFound: # pragma: no cover - __version__ = "0.0.0.dev0" +_CUR_FILE = os.path.realpath(__file__) +_CUR_PATH = os.path.split(_CUR_FILE)[0] +_PROPS = open(os.path.join(_CUR_PATH, 'version.prop')).read() +__version__ = ast.literal_eval(_PROPS) + +logging.getLogger(__name__).addHandler(logging.NullHandler()) diff --git a/src/friendlyshell/base_shell.py b/src/friendlyshell/base_shell.py index 507a3d5..2997477 100644 --- a/src/friendlyshell/base_shell.py +++ b/src/friendlyshell/base_shell.py @@ -486,7 +486,7 @@ class to customize this behavior. examples. :param str message: text to be displayed""" - pass + if __name__ == "__main__": diff --git a/src/friendlyshell/version.prop b/src/friendlyshell/version.prop new file mode 100644 index 0000000..127c19a --- /dev/null +++ b/src/friendlyshell/version.prop @@ -0,0 +1,6 @@ +# Unlike a typical Python script, this file is a properties file. It may +# only contain comments and a single Python literal declaration representing +# the version number of the project. This makes the property easy to parse +# from various tools, including Python using the "ast" library. See +# "ast.literal_eval()" for details. +"0.0.1" diff --git a/tests/python2.reqs b/tests/python2.reqs new file mode 100644 index 0000000..20ad5e3 --- /dev/null +++ b/tests/python2.reqs @@ -0,0 +1,57 @@ +alabaster==0.7.12 +astroid==1.6.5 +atomicwrites==1.3.0 +attrs==18.2.0 +Babel==2.6.0 +backports.functools-lru-cache==1.5 +bleach==3.1.0 +certifi==2018.11.29 +chardet==3.0.4 +configparser==3.7.1 +coverage==4.5.2 +docutils==0.14 +enum34==1.1.6 +filelock==3.0.10 +funcsigs==1.0.2 +futures==3.2.0 +idna==2.8 +imagesize==1.1.0 +isort==4.3.4 +Jinja2==2.10 +lazy-object-proxy==1.3.1 +MarkupSafe==1.1.0 +mccabe==0.6.1 +mock==2.0.0 +more-itertools==5.0.0 +packaging==19.0 +pathlib2==2.3.3 +pbr==5.1.2 +pkginfo==1.5.0.1 +pluggy==0.8.1 +py==1.7.0 +Pygments==2.3.1 +pylint==1.9.4 +pyparsing==2.3.1 +pytest==4.2.0 +pytest-cov==2.6.1 +pytest-timeout==1.3.3 +pytz==2018.9 +readme-renderer==24.0 +requests==2.21.0 +requests-toolbelt==0.9.1 +scandir==1.9.0 +singledispatch==3.4.0.3 +six==1.12.0 +snowballstemmer==1.2.1 +Sphinx==1.8.4 +sphinxcontrib-websupport==1.1.0 +tabulate==0.8.3 +toml==0.10.0 +tox==3.7.0 +tqdm==4.31.1 +twine==1.12.1 +typing==3.6.6 +urllib3==1.24.1 +virtualenv==16.4.0 +webencodings==0.5.1 +wrapt==1.11.1 diff --git a/tests/python3.reqs b/tests/python3.reqs new file mode 100644 index 0000000..2874109 --- /dev/null +++ b/tests/python3.reqs @@ -0,0 +1,48 @@ +alabaster==0.7.12 +astroid==2.1.0 +atomicwrites==1.3.0 +attrs==18.2.0 +Babel==2.6.0 +bleach==3.1.0 +certifi==2018.11.29 +chardet==3.0.4 +coverage==4.5.2 +docutils==0.14 +filelock==3.0.10 +idna==2.8 +imagesize==1.1.0 +isort==4.3.4 +Jinja2==2.10 +lazy-object-proxy==1.3.1 +MarkupSafe==1.1.0 +mccabe==0.6.1 +mock==2.0.0 +more-itertools==5.0.0 +packaging==19.0 +pbr==5.1.2 +pkginfo==1.5.0.1 +pluggy==0.8.1 +py==1.7.0 +Pygments==2.3.1 +pylint==2.2.2 +pyparsing==2.3.1 +pytest==4.2.0 +pytest-cov==2.6.1 +pytest-timeout==1.3.3 +pytz==2018.9 +readme-renderer==24.0 +requests==2.21.0 +requests-toolbelt==0.9.1 +six==1.12.0 +snowballstemmer==1.2.1 +Sphinx==1.8.4 +sphinxcontrib-websupport==1.1.0 +tabulate==0.8.3 +toml==0.10.0 +tox==3.7.0 +tqdm==4.31.1 +twine==1.12.1 +urllib3==1.24.1 +virtualenv==16.4.0 +webencodings==0.5.1 +wrapt==1.11.1 diff --git a/tox.ini b/tox.ini index 555fc96..e5c3570 100644 --- a/tox.ini +++ b/tox.ini @@ -1,17 +1,36 @@ [tox] -envlist=py2,py27,pypy,py3,py34,py35,py36,py37,pypy3 +envlist = py2,py3,pypy,pypy3 +skipsdist=true +skip_missing_interpreters=False [testenv] -skip_missing_interpreters = True -sitepackages = False -passenv=TRAVIS_* +whitelist_externals = + rm + bash +commands = + rm -rf dist + python setup.py bdist_wheel + /bin/bash -c 'pip install dist/*.whl' + pylint setup.py + bash -c "source toxenv.sh; pylint ./src/$PROJECT_NAME" + bash -c "source toxenv.sh; pytest ./tests -v --cov-report html --cov $PROJECT_NAME --no-cov-on-fail" + +[testenv:py2] +deps = -rtests/python2.reqs + +[testenv:pypy] +deps = -rtests/python2.reqs + +[testenv:py3] +deps = -rtests/python3.reqs -deps = - py{2,27,py}: -rrequirements2.txt - py{3,34,35,36,37,py3}: -rrequirements3.txt +[testenv:pypy3] +deps = -rtests/python3.reqs +[testenv:py3-docs] +deps = -rtests/python3.reqs +whitelist_externals = + bash commands = - python -m pylint src/friendlyshell - python -m pylint setup.py - python -m pytest -vv --cov=friendlyshell --cov-report=html \ - --cov-report=term {posargs} tests \ No newline at end of file + bash -c "source toxenv.sh; sphinx-apidoc -f -e -o ./docs/ src/$PROJECT_NAME" + python setup.py build_sphinx \ No newline at end of file diff --git a/toxenv.sh b/toxenv.sh new file mode 100755 index 0000000..eac7523 --- /dev/null +++ b/toxenv.sh @@ -0,0 +1,8 @@ +#!/bin/bash +# This is a helper script used to inject environment variables into the +# build environment, for use by the 'tox' build tool. See the tox.ini +# file for details + +# Inject the project name into the environment, dynamically parsed from +# the project.prop file +export PROJECT_NAME=`python -c "import ast; print(ast.literal_eval(open('project.prop').read())['NAME'])"` diff --git a/update_docs.bat b/update_docs.bat deleted file mode 100644 index d4687c1..0000000 --- a/update_docs.bat +++ /dev/null @@ -1,7 +0,0 @@ -setlocal -sphinx-apidoc -f -e -o .\docs\ src\friendlyshell -mkdir docs\_static -pushd docs -call make html -popd -start docs\_build\html\index.html \ No newline at end of file diff --git a/update_docs.sh b/update_docs.sh deleted file mode 100755 index 35cd4d7..0000000 --- a/update_docs.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/env bash -sphinx-apidoc -f -e -o $PWD/docs/ src/friendlyshell -mkdir docs/_static -pushd docs -make html -popd -open docs/_build/html/index.html \ No newline at end of file