Skip to content

Commit

Permalink
chore: updated license, travis python version requirements, flake8, s…
Browse files Browse the repository at this point in the history
…treamlined setup.py
  • Loading branch information
simoncoulton committed Oct 2, 2019
1 parent ae8b082 commit 7e3271a
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 114 deletions.
44 changes: 23 additions & 21 deletions LICENSE
@@ -1,25 +1,27 @@
Copyright (c) 2012-2018 Bespohk, and is maintained by multiple
contributors including:
Copyright (c) Bespohk and individual contributors.
All rights reserved.

- Simon Coulton <simon@bespohk.com>
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:

Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
3. Neither the name of Watson nor the names of its contributors may be used
to endorse or promote products derived from this software without
specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2 changes: 2 additions & 0 deletions setup.cfg
@@ -0,0 +1,2 @@
[flake8]
ignore = E501
121 changes: 28 additions & 93 deletions setup.py
@@ -1,120 +1,55 @@
# -*- coding: utf-8 -*-
import os
from setuptools import setup, Command, find_packages
from setuptools import setup, find_packages
import watson.console

name = 'watson-console'
description = 'Create console commands with ease.'
version = watson.console.__version__

class BaseCommand(Command):
user_options = []

def initialize_options(self):
pass

def finalize_options(self):
pass


class PyTest(BaseCommand):
"""Runs all the unit tests.
"""
def run(self):
os.system('py.test')
clean()


class PyPiPublish(BaseCommand):
"""Publishes the code to PyPi.
"""
def run(self):
os.system('py.test')
if (confirm('Are you sure you want to push to PyPi?')):
os.system('python setup.py sdist bdist_wheel upload')
clean()


def clean():
"""Cleans the source directory of all non-source files.
"""
os.system('rm -rf .coverage')
os.system('find . -name "__pycache__" -print0|xargs -0 rm -rf')
os.system('find . -name "*.egg-info" -print0|xargs -0 rm -rf')
os.system('rm -rf dist')


def confirm(prompt):
prompt += ' (Y/N) [n]: '
while True:
answer = input(prompt).upper()
if not answer:
answer = 'N'
return False if answer != 'Y' else True

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

with open(os.path.join(path, 'LICENSE')) as f:
license = f.read()

with open(os.path.join(path, 'README.rst')) as f:
readme = f.read()

with open(os.path.join(path, 'requirements.txt')) as f:
requirements = f.read().splitlines()

with open(os.path.join(path, 'requirements-test.txt')) as f:
test_requirements = f.read().splitlines()
def read(filename, as_list=False):
with open(os.path.join(os.path.dirname(__file__), filename)) as f:
contents = f.read()
if as_list:
return contents.splitlines()
return contents


setup(
name='watson-console',
version=watson.console.__version__,
url='http://github.com/watsonpy/watson-console',
description='Create console commands with ease.',
long_description=readme,
name=name,
version=version,
url='http://github.com/watsonpy/' + name,
description=description,
long_description=read('README.rst'),

author='Simon Coulton',
author_email='simon at bespohk.com',
author_email='simon@bespohk.com',

license=license,
license=read('LICENSE'),
classifiers=[
'Development Status :: 5 - Production/Stable',
'Environment :: Web Environment',
'Intended Audience :: Developers',
'License :: OSI Approved :: MIT License',
'Natural Language :: English',
'License :: OSI Approved :: BSD License',
'Operating System :: OS Independent',
'Programming Language :: Python',
'Programming Language :: Python :: 3.3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: Implementation :: CPython',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3 :: Only',
'Topic :: Internet :: WWW/HTTP',
'Topic :: Internet :: WWW/HTTP :: Dynamic Content',
'Topic :: Internet :: WWW/HTTP :: WSGI',
'Topic :: Internet :: WWW/HTTP :: WSGI :: Application',
'Topic :: Internet :: WWW/HTTP :: WSGI :: Middleware',
'Topic :: Internet :: WWW/HTTP :: WSGI :: Server'
'Topic :: Software Development :: Libraries :: Application Frameworks',
'Topic :: Software Development :: Libraries :: Python Modules',
],
platforms=['Python 3.3'],
keywords=['watson',
'python3',
'web framework',
'framework',
'wsgi',
'web',
'console',
'command'],

packages=find_packages(exclude=["*.tests", "*.tests.*", "tests.*", "tests"]),
packages=find_packages(
exclude=["*.tests", "*.tests.*", "tests.*", "tests"]),
include_package_data=True,

zip_safe=False,
install_requires=requirements,
install_requires=read('requirements.txt', as_list=True),
extras_require={
'test': test_requirements
'test': read('requirements-test.txt', as_list=True)
},

cmdclass={
'test': PyTest,
'publish': PyPiPublish
}
)

0 comments on commit 7e3271a

Please sign in to comment.