Skip to content

Commit

Permalink
build cleanup
Browse files Browse the repository at this point in the history
- caching
- adop stages
- auto-release on tag
- switched to hacking linting
  • Loading branch information
ssbarnea committed Apr 4, 2018
1 parent cc77e81 commit 614ad53
Show file tree
Hide file tree
Showing 16 changed files with 153 additions and 206 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,4 @@ test-distribute.sh
.idea/tendo.iml
/ChangeLog
/AUTHORS
/.pytest_cache
17 changes: 0 additions & 17 deletions .pep8

This file was deleted.

149 changes: 69 additions & 80 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,88 +1,77 @@
language: python
cache:
- pip
sudo: false
matrix:
fast_finish: false
os:
- linux
matrix:
include:
- python: 2.7
env: TOXENV=py27
- python: 3.4
env: TOXENV=py34
- python: 3.5
env: TOXENV=py35
- python: 3.6
env: TOXENV=py36
- python: pypy
env: TOXENV=pypy
- python: 2.7
env: TOXENV=docs
# https://docs.travis-ci.com/user/customizing-the-build
branches:
only:
- master
- develop
- /^\d+\.\d+(\.\d+)?(-\S*)?$/
stages:
- lint
- docs
- test
- deploy
install:
- pip -q --log dist/pip.log install --upgrade pip setuptools tox-travis py wheel
- python setup.py sdist bdist_wheel install
- pip install ./dist/*.whl
- pip --version
script:
- export PACKAGE_NAME=$(python setup.py --name)
- export PACKAGE_VERSION=$(python setup.py --version)
- python setup.py --version
- tox --installpkg ./dist/*.whl --travis-after
# validates that the build source distribution is installable using the old easy_install
- pip uninstall -y $PACKAGE_NAME && easy_install ./dist/$PACKAGE_NAME-*.tar.gz
after_success:
- coveralls
- bash <(curl -s https://codecov.io/bash)
- requires.io update-site -t ac3bbcca32ae03237a6aae2b02eb9411045489bb -r
notifications:
email:
- [email protected]
- [email protected]

deploy:
- provider: releases
api_key:
secure: FdDsSx1GhjAcvNPtdDhNtlIlAVFDWv+hXu1HGLnDVdAzFVnJt96z7ORTjKuUnTDNPKvyxOtAx67xE5K2pR9UV8MK4rz3qyRNoNbUKz9IHqs8BCdm7NTUV1GgoTxlFvbez5K/B8IdEge37ru+qE5zJslQYSBAxA1y+lUaNAhugiA=
file_glob: true
file:
- dist/$PACKAGE_NAME-$PACKAGE_VERSION*
- ChangeLog
skip_cleanup: true
on:
repo: pycontribs/tendo
tags: true
- pip install -q tox-travis tox-pyenv virtualenv wheel | cat
jobs:
include:
- stage: lint
script: python -m tox
python: 2.7
condition: $TOXENV == py27
- provider: pypi
user: pycontribs
password:
secure: "ZvNpERuRpiPb5+mML/nm16UTI3DwEZEVOLmz9kDfaJU5+9hy1mvhwkIBWEEEBvy3NA5zk64i1uBORSwp+WPnwWNsurksZwgmSp1k2M6FzE0l2tRt7VQ4Lle6CfhLJ7vo0mZS7GdfWwcw4DEOV7guh3VtD200TNK6o/AuRRXztpM="
distributions: sdist bdist_wheel
skip_cleanup: true
on:
tags: true
env: TOXENV=lint
- stage: docs
script: python -m tox
python: 2.7
condition: $TOXENV == py27
branch: master
- provider: pypi
server: https://testpypi.python.org/pypi
user: pycontribs
password:
secure: "ZvNpERuRpiPb5+mML/nm16UTI3DwEZEVOLmz9kDfaJU5+9hy1mvhwkIBWEEEBvy3NA5zk64i1uBORSwp+WPnwWNsurksZwgmSp1k2M6FzE0l2tRt7VQ4Lle6CfhLJ7vo0mZS7GdfWwcw4DEOV7guh3VtD200TNK6o/AuRRXztpM="
distributions: sdist bdist_wheel
skip_cleanup: true
on:
tags: false
env: TOXENV=docs
- stage: test
script: python -m tox
python: 2.7
condition: $TOXENV == py27
branch: develop
env:
global:
- secure: fuXwQL+KHQ96XkAFl2uQc8eK8dAjrgkup46tck/UGjVpdv1PT/yHmBKrvpFjDa50ueGbtBwTdKAwhyAmYuiZCk2IYHzdvBylCZBBji2FSpaTM59CVwgkVT6tx3HHO83X0mEX6ih9TJvZD5XhX+YUjopnseRXRq3ey3JZJXWN4RM=
- secure: "pGQGM5YmHvOgaKihOyzb3k6bdqLQnZQ2OXO9QrfXlXwtop3zvZQi80Q+01l230x2psDWlwvqWTknAjAt1w463fYXPwpoSvKVCsLSSbjrf2l56nrDqnoir+n0CBy288+eIdaGEfzcxDiuULeKjlg08zrqjcjLjW0bDbBrlTXsb5U="
env: TOXENV=py27
after_success:
- coveralls
- bash <(curl -s https://codecov.io/bash) -e TOX_ENV
- stage: test
script: python -m tox
python: 3.4
env: TOXENV=py34
after_success:
- coveralls
- bash <(curl -s https://codecov.io/bash) -e TOX_ENV
- stage: test
script: python -m tox
python: 3.5
env: TOXENV=py35
after_success:
- coveralls
- bash <(curl -s https://codecov.io/bash) -e TOX_ENV
- stage: test
script: python -m tox
python: 3.6
env: TOXENV=py36 PYTHON='3.6' PYENV_VERSION='system'
after_success:
- coveralls
- bash <(curl -s https://codecov.io/bash) -e TOX_ENV
- stage: deploy
script:
- export PACKAGE_NAME=$(python setup.py --name)
- export PACKAGE_VERSION=$(python setup.py --version)
- python setup.py sdist bdist_wheel
deploy:
- provider: pypi
user: pycontribs
password:
secure: beq1+egB93Y9a51NOdrG0ja9zKb+g3/JejoM6kUpm2FU37a9+AU3fAAoGdYcrRqF2fmrBGuYNW29vJEzaDT4YK/FSMNrcipt8U3yyNXJ0oFbVsi0FLeDlBzEFarhY71BguEoJlf+nwCphPXCj/aJPxNiAKYnNCfBdfP0WKH/N5M=
distributions: sdist bdist_wheel
skip_cleanup: true
on:
tags: true
repo: pycontribs/tendo
- provider: releases
api_key:
secure: Dz7yMcIBxTKD2zYi0ph9qTz2N0AdmOWD9eI/CMW3DdXh15e4fQqL7O5cr4Sn+FSKHMbUCUoztXwJsYLbrCPB2tH8HliPhSuNzb0CwScRD9wSzQzhli10YPj+Oe2UlPOcIWQFRYTUQ1tfpvfDcvRL7klLDiKUpghJ+xf7crXzqGE=
file:
- dist/$PACKAGE_NAME-$PACKAGE_VERSION.tar.gz
- dist/$PACKAGE_NAME-$PACKAGE_VERSION-py2.py3-none-any.whl
- ChangeLog
skip_cleanup: true
on:
tags: true
repo: pycontribs/tendo
2 changes: 0 additions & 2 deletions demo/demo_colorer.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#!/usr/bin/env python
# encoding: utf-8
# Author: sorin sbarnea
# License: public domain

from tendo import colorer # noqa

Expand Down
11 changes: 5 additions & 6 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,13 @@
# All configuration values have a default; values that are commented out
# serve to show the default.

import sys
import os
import inspect
import os
import sys
cmd_folder = os.path.realpath(os.path.join(os.path.abspath(os.path.split(inspect.getfile(inspect.currentframe()))[0]), ".."))
if cmd_folder not in sys.path:
sys.path.insert(0, cmd_folder)
from tendo import version as tendo_version # noqa

from tendo import __version__ # noqa:E402

# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
Expand Down Expand Up @@ -57,9 +56,9 @@
# The short X.Y version.

# realpath() with make your script run, even if you symlink it :)
version = tendo_version.__version__
version = __version__
# The full version, including alpha/beta/rc tags.
release = tendo_version.__version__
release = __version__

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand Down
5 changes: 2 additions & 3 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
hacking>=1.0.0

Sphinx
autopep8
coveralls
pep8
flake8
flake8-docstrings
pytest>=2.6.0
pytest-cov
pytest-pep8
pytest-xdist
pytest-instafail
wheel
Expand Down
39 changes: 10 additions & 29 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ packages =
[entry_points]
pbr.config.drivers =
plain = pbr.cfg.driver:Plain

[bdist_wheel]
universal = 1

Expand All @@ -52,7 +53,7 @@ upload-dir = docs/build/html
[tool:pytest]
norecursedirs = . .svn _build tmp* lib/third lib *.egg bin distutils build docs demo
python_files = *.py
addopts = -p no:xdist --ignore=setup.py --tb=long --capture=fd -rxX --maxfail=10 --pep8 tendo
addopts = -p no:xdist --ignore=setup.py --tb=long --capture=fd -rxX --maxfail=10 tendo
# --maxfail=2 -n4
# -n4 runs up to 4 parallel procs
# --maxfail=2 fail fast, dude
Expand All @@ -61,34 +62,14 @@ addopts = -p no:xdist --ignore=setup.py --tb=long --capture=fd -rxX --maxfail=1
# these are important for distributed testing, to speedup their execution we minimize what we sync
rsyncdirs = . tendo demo docs
rsyncignore = .hg .git
pep8ignore = E501 E265 E127 E901 E128 E402
filterwarnings = default
ignore:.*mode is deprecated:Warning
ignore:unclosed file.*:Warning
ignore:can't resolve package from.*:Warning
filterwarnings =
default
ignore:.*mode is deprecated:Warning
ignore:unclosed file.*:Warning
ignore:can't resolve package from.*:Warning
[flake8]
exclude = migrations,__pycache__,build,bmll/config.py,env,src,.tox
# the only additional ignores are the docstrings ones Dxx, the other.
# ones are the default ones.
# see http://pep8.readthedocs.io/en/latest/intro.html
ignore = E121,E123,E126,E133,E226,E241,E242,E704,W503,D100,D101,D102,D103,D104,D105,D200,D202,D203,D204,D205,D207,D210,D211,D300,D301,D400,D401
max-line-length=1024
[pep8]
exclude=build,lib,.tox,third,*.egg,docs,packages
;filename=
;select
ignore=E501,E265,E402
enable-extensions = H106,H203,H204,H205,H210,H904
exclude = __pycache__,build,src,.tox
ignore = D
max-line-length=1024
count=1
;format
;quiet
;show-pep8
;show-source
statistics=1
;verbose=1
;PEP8_OPTS="--filename=*.py --exclude=lib --ignore=E501 scripts"
;pep8 $PEP8_OPTS --show-source --repeat
;pep8 --statistics -qq $PEP8_OPTS
16 changes: 9 additions & 7 deletions tendo/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,22 @@
# Licensed to PSF under a Contributor Agreement.
# See http://www.python.org/psf/license for licensing details.
from __future__ import absolute_import
from .version import __version__
import sys

from pbr.version import VersionInfo


_v = VersionInfo('wstools').semantic_version()
__version__ = _v.release_string()
version_info = _v.version_tuple()

__author__ = "Sorin Sbarnea"
__copyright__ = "Copyright 2010-2015, Sorin Sbarnea"
__copyright__ = "Copyright 2010-2018, Sorin Sbarnea"
__email__ = "[email protected]"
__status__ = "Production"
__date__ = "2015-07-28"
__all__ = ('tee', 'colorer', 'unicode',
'execfile2', 'singleton', 'ansiterm', 'version', '__version__')
'execfile2', 'singleton', 'ansiterm', '__version__')

"""
Tendo is tested with Python 2.5-3.4
"""

if sys.hexversion < 0x02050000:
sys.exit("Python 2.5 or newer is required by tendo module.")
4 changes: 2 additions & 2 deletions tendo/ansiterm.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env python
# Originally from http://waf.googlecode.com/svn/trunk/waflib/ansiterm.py
import sys
import os
import sys
try:
if (not sys.stderr.isatty()) or (not sys.stdout.isatty()):
raise ValueError('not a tty')
Expand Down Expand Up @@ -37,7 +37,7 @@ class CONSOLE_CURSOR_INFO(Structure):

try:
_type = unicode
except:
except Exception:
_type = str

def to_int(number, default):
Expand Down
6 changes: 2 additions & 4 deletions tendo/colorer.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#!/usr/bin/env python
# encoding: utf-8
# Author: sorin sbarnea
# License: public domain

"""
Colorer does enable colored logging messages by using `ANSI escape sequences <http://en.wikipedia.org/wiki/ANSI_escape_code>`_.
Expand All @@ -16,13 +14,13 @@
... logging.info("gray line")
... logging.debug("magenta line")
"""
import logging
import copy
import logging
import os
import six
import sys
import tempfile
import unittest
import six

if (hasattr(sys.stderr, "isatty") and sys.stderr.isatty()) or \
('TERM' in os.environ.keys() and os.environ['TERM'] in ['linux']) or \
Expand Down
Loading

0 comments on commit 614ad53

Please sign in to comment.