From 88f28556a183e3ac82ea460c4bd2ab78cb727176 Mon Sep 17 00:00:00 2001 From: Matt Bogosian Date: Sun, 12 Mar 2017 16:59:36 -0700 Subject: [PATCH] More cleanup --- .gitignore | 10 +++--- .pylintrc | 11 +++++++ .travis.yml | 7 +++-- CREDITS | 5 +-- MANIFEST.in | 11 ------- dimgx.py | 6 ++-- {doc => docs}/CREDITS.rst | 0 {doc => docs}/LICENSE.rst | 0 {doc => docs}/cli.rst | 0 {doc => docs}/conf.py | 0 {doc => docs}/contrib.rst | 14 +++++---- {doc => docs}/index.rst | 0 {doc => docs}/intro.rst | 1 + {doc => docs}/py.rst | 0 {doc => docs}/release_checklist.md | 4 +-- {doc => docs}/requirements.txt | 0 release.sh => helpers/release.sh | 6 ++-- runtests.sh => helpers/runtests.sh | 6 ++-- setup.cfg | 2 ++ setup.py | 8 ++++- test/requirements.txt | 1 - tox.ini | 49 ++++++++++++------------------ 22 files changed, 72 insertions(+), 69 deletions(-) rename {doc => docs}/CREDITS.rst (100%) rename {doc => docs}/LICENSE.rst (100%) rename {doc => docs}/cli.rst (100%) rename {doc => docs}/conf.py (100%) rename {doc => docs}/contrib.rst (90%) rename {doc => docs}/index.rst (100%) rename {doc => docs}/intro.rst (98%) rename {doc => docs}/py.rst (100%) rename {doc => docs}/release_checklist.md (93%) rename {doc => docs}/requirements.txt (100%) rename release.sh => helpers/release.sh (85%) rename runtests.sh => helpers/runtests.sh (75%) diff --git a/.gitignore b/.gitignore index c7762a9..395d2c2 100644 --- a/.gitignore +++ b/.gitignore @@ -16,11 +16,11 @@ /.tox/ /build/ /dist/ -/doc/_build/ -/doc/_static/ -/doc/modules.rst -/doc/dimgx.rst -/doc/dimgx.*.rst +/docs/_build/ +/docs/_static/ +/docs/modules.rst +/docs/dimgx.rst +/docs/dimgx.*.rst /htmlcov/ __pycache__/ _trial_temp diff --git a/.pylintrc b/.pylintrc index 264ddf2..e0b4c70 100644 --- a/.pylintrc +++ b/.pylintrc @@ -1,3 +1,14 @@ +# -*- encoding: utf-8; mode: ini -*- + +# ======================================================================== +# Copyright and other protections apply. Please see the accompanying +# ``LICENSE`` and ``CREDITS`` files for rights and restrictions governing +# use of this software. All rights not expressly waived or licensed are +# reserved. If those files are missing or appear to be modified from their +# originals, then please contact the author before viewing or using this +# software in any capacity. +# ======================================================================== + [MESSAGES CONTROL] disable=C,R,fixme,locally-disabled,missing-super-argument,no-init,no-member enable=useless-suppression diff --git a/.travis.yml b/.travis.yml index 8abd9a8..15b3a35 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,16 +9,17 @@ # software in any capacity. # ======================================================================== +sudo: false language: python python: - "2.7" - - pypy - "3.3" - "3.4" - "3.5" - "3.6" - - pypy3 + - "pypy" + - "pypy3" install: - pip install coveralls tox-travis @@ -29,7 +30,7 @@ matrix: - python: "3.6" # PyPy3 is experimental - - python: pypy3 + - python: "pypy3" script: - tox diff --git a/CREDITS b/CREDITS index 600ec47..5c6bc71 100644 --- a/CREDITS +++ b/CREDITS @@ -1,6 +1,9 @@ ``CREDITS`` =========== +Contributors +------------ + The following individuals or entities have contributed to this software. By adding your name to this list, you grant a nonexclusive, perpetual @@ -13,7 +16,5 @@ by a third party for this software's owner's otherwise lawful use of your contribution, whether or not such use was contemplated by you at the time you made it. -Contributors: - .. Entry format: .. * `NAME `__ (see `REPO_URL `__) diff --git a/MANIFEST.in b/MANIFEST.in index c33a0eb..7710f90 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -12,17 +12,6 @@ include \ CREDITS \ LICENSE \ - doc/CREDITS.rst \ - doc/LICENSE.rst \ - doc/Makefile \ - doc/cli.rst \ - doc/conf.py \ - doc/contrib.rst \ - doc/index.rst \ - doc/intro.rst \ - doc/py.rst \ - doc/release_checklist.md \ - doc/requirements.txt \ test/requirements.txt graft test/data diff --git a/dimgx.py b/dimgx.py index d185d7c..8cd26df 100755 --- a/dimgx.py +++ b/dimgx.py @@ -503,15 +503,15 @@ def _is_broken(): _LOGGER.debug('patching broken %s from %s, %s', tarfile.TarFile.next, tarfile.__file__, sys_version) - def _wrap_next(_f): + def _wrap_next(f): from functools import wraps - @wraps(_f) + @wraps(f) def __patched_next(self, *args, **kw): if self.offset < self.fileobj.tell(): self.fileobj.seek(self.offset) - return _f(self, *args, **kw) + return f(self, *args, **kw) return __patched_next diff --git a/doc/CREDITS.rst b/docs/CREDITS.rst similarity index 100% rename from doc/CREDITS.rst rename to docs/CREDITS.rst diff --git a/doc/LICENSE.rst b/docs/LICENSE.rst similarity index 100% rename from doc/LICENSE.rst rename to docs/LICENSE.rst diff --git a/doc/cli.rst b/docs/cli.rst similarity index 100% rename from doc/cli.rst rename to docs/cli.rst diff --git a/doc/conf.py b/docs/conf.py similarity index 100% rename from doc/conf.py rename to docs/conf.py diff --git a/doc/contrib.rst b/docs/contrib.rst similarity index 90% rename from doc/contrib.rst rename to docs/contrib.rst index a968ad0..c14d067 100644 --- a/doc/contrib.rst +++ b/docs/contrib.rst @@ -36,11 +36,13 @@ Submission Guidelines If you're willing and able, consider `submitting a pull request `__ (PR) with a fix. There are only a few guidelines: -* If it isn't already there, please add your name (and optionally your GitHub username, email, website address, or other contact information) to the ``CREDITS`` file:: +* If it isn't already there, please add your name (and optionally your GitHub username, email, website address, or other contact information) to the ``CREDITS`` file: - ... - * Gordon the Turtle - ... + .. code-block:: rst + + ... + * `Gordon the Turtle `_ + ... * Try to follow the source conventions as you observe them. (Note: I have purposely avoided aspects of `PEP8 `_, in part because I have adopted conventions developed from my experiences with other languages, but mostly because I'm growing older and more stubborn.) @@ -50,9 +52,9 @@ There are only a few guidelines: * Provide unit tests where feasible and appropriate. At the very least, existing tests should not fail. (There are exceptions, but if there is any doubt, they probably don't apply.) - Tests can be run with ``./runtests.sh`` (requires `tox `__) or ``python setup.py test``. -.. + Unit tests live in ``./test``. + Tests can be run with ``./helpers/runtests.sh`` (requires `tox `__) or ``python setup.py test``. * If you need me, mention me (|@posita|_) in your comment, and describe specifically how I can help. diff --git a/doc/index.rst b/docs/index.rst similarity index 100% rename from doc/index.rst rename to docs/index.rst diff --git a/doc/intro.rst b/docs/intro.rst similarity index 98% rename from doc/intro.rst rename to docs/intro.rst index d7e1dab..505e11a 100644 --- a/doc/intro.rst +++ b/docs/intro.rst @@ -26,6 +26,7 @@ License ------- ``dimgx`` is licensed under the `MIT License `_. +See the :doc:`LICENSE ` file for details. Source code is `available on GitHub `__. Installation diff --git a/doc/py.rst b/docs/py.rst similarity index 100% rename from doc/py.rst rename to docs/py.rst diff --git a/doc/release_checklist.md b/docs/release_checklist.md similarity index 93% rename from doc/release_checklist.md rename to docs/release_checklist.md index 3335c69..edaa223 100644 --- a/doc/release_checklist.md +++ b/docs/release_checklist.md @@ -11,9 +11,9 @@ Please see the accompanying [`LICENSE`](../LICENSE) and [`CREDITS`](../CREDITS) All rights not expressly waived or licensed are reserved. If those files are missing or appear to be modified from their originals, then please contact the author before viewing or using this software in any capacity. -- [ ] If necessary, update copyright in [`LICENSE`](../LICENSE) and [`doc/conf.py`](../doc/conf.py) +- [ ] If necessary, update copyright in [`LICENSE`](../LICENSE) and [`docs/conf.py`](../docs/conf.py) -- [ ] [`./release.sh`](../release.sh) +- [ ] [`./helpers/release.sh`](../helpers/release.sh) - [ ] `git push --tags` diff --git a/doc/requirements.txt b/docs/requirements.txt similarity index 100% rename from doc/requirements.txt rename to docs/requirements.txt diff --git a/release.sh b/helpers/release.sh similarity index 85% rename from release.sh rename to helpers/release.sh index 01751f4..f7b6f86 100755 --- a/release.sh +++ b/helpers/release.sh @@ -1,14 +1,14 @@ #!/usr/bin/env sh -#-*- encoding: utf-8; mode: sh; grammar-ext: sh -*- +# -*- encoding: utf-8; grammar-ext: sh; mode: shell-script -*- -#========================================================================= +# ======================================================================== # Copyright and other protections apply. Please see the accompanying # ``LICENSE`` and ``CREDITS`` files for rights and restrictions governing # use of this software. All rights not expressly waived or licensed are # reserved. If those files are missing or appear to be modified from their # originals, then please contact the author before viewing or using this # software in any capacity. -#========================================================================= +# ======================================================================== if [ "${#}" -ne 3 ] ; then echo 1>&2 "usage: $( basename "${0}" ) MAJOR MINOR PATCH" diff --git a/runtests.sh b/helpers/runtests.sh similarity index 75% rename from runtests.sh rename to helpers/runtests.sh index efca1f3..2f205c5 100755 --- a/runtests.sh +++ b/helpers/runtests.sh @@ -1,14 +1,14 @@ #!/usr/bin/env sh -#-*- encoding: utf-8; mode: sh; grammar-ext: sh -*- +# -*- encoding: utf-8; grammar-ext: sh; mode: shell-script -*- -#========================================================================= +# ======================================================================== # Copyright and other protections apply. Please see the accompanying # ``LICENSE`` and ``CREDITS`` files for rights and restrictions governing # use of this software. All rights not expressly waived or licensed are # reserved. If those files are missing or appear to be modified from their # originals, then please contact the author before viewing or using this # software in any capacity. -#========================================================================= +# ======================================================================== _MY_DIR="$( cd "$( dirname "${0}" )" && pwd )" set -ex diff --git a/setup.cfg b/setup.cfg index a42a7f1..a310de2 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,3 +1,5 @@ +# -*- encoding: utf-8; mode: ini -*- + # ======================================================================== # Copyright and other protections apply. Please see the accompanying # ``LICENSE`` and ``CREDITS`` files for rights and restrictions governing diff --git a/setup.py b/setup.py index 7041ea3..95156f6 100755 --- a/setup.py +++ b/setup.py @@ -50,11 +50,15 @@ 'python-dateutil', ) +TESTS_REQUIRE = [ + 'pytest', +] + # WARNING: This imposes limitations on test/requirements.txt such that the # full Pip syntax is not supported. See also # . with open(ospath_join(_MY_DIR, 'test', 'requirements.txt')) as f: - TESTS_REQUIRE = f.read().splitlines() + TESTS_REQUIRE.extend(f.read().splitlines()) # ---- Initialization ---------------------------------------------------- @@ -94,6 +98,8 @@ 'Programming Language :: Python :: 2.7', 'Programming Language :: Python :: 3.3', 'Programming Language :: Python :: 3.4', + 'Programming Language :: Python :: 3.5', + 'Programming Language :: Python :: 3.6', 'Programming Language :: Python :: Implementation :: CPython', 'Programming Language :: Python :: Implementation :: PyPy', 'Topic :: System :: Archiving :: Packaging', diff --git a/test/requirements.txt b/test/requirements.txt index e079f8a..e69de29 100644 --- a/test/requirements.txt +++ b/test/requirements.txt @@ -1 +0,0 @@ -pytest diff --git a/tox.ini b/tox.ini index efcb98e..3441be9 100644 --- a/tox.ini +++ b/tox.ini @@ -11,18 +11,19 @@ [tox] # ----------------------------------------------------------------- -envlist = reset,py{27,33,34,35,36,py,py3},lint,check +envlist = py{27,33,34,35,36,py,py3}, lint, check skip_missing_interpreters = true -[tox:travis] # ---------------------------------------------------------- +[travis] # -------------------------------------------------------------- -# "check" permanently broken for 3.3. TODO: Add back "check" to py27 and -# py34 after Travis updates Python -2.7 = py27, lint +# "check" permanently broken for 3.3 +2.7 = py27, lint, check 3.3 = py33, lint -3.4 = py34, lint +3.4 = py34, lint, check 3.5 = py35, lint, check 3.6 = py36, lint, check +pypy = pypy, lint, check +pypy3 = pypy3, lint, check [testenv] # ------------------------------------------------------------- @@ -30,13 +31,16 @@ commands = coverage run --append -m py.test {posargs} deps = - py36: pytest >= 2.0 coverage + pytest # This probably breaks on Windows. See # . -rtest/requirements.txt -passenv = COVERAGE_PROCESS_START LOG_FMT LOG_LVL +passenv = + COVERAGE_PROCESS_START + LOG_FMT + LOG_LVL setenv = PYTHONWARNINGS = all @@ -47,18 +51,21 @@ basepython = {env:PYTHON:python} commands = python setup.py check -m -r -s -v - rm -frv doc/modules.rst doc/dimgx.rst doc/_dimgx.*.rst - sphinx-build -b html -d doc/_build/doctrees doc doc/_build/html + rm -frv docs/modules.rst docs/dimgx.rst docs/_dimgx.*.rst + sphinx-build -b html -d docs/_build/doctrees docs docs/_build/html deps = - docutils + # TODO: Unpin this after Travis updates Python + docutils <= 0.12.0 sphinx - -rdoc/requirements.txt + # This probably breaks on Windows. See + # . + -rdocs/requirements.txt setenv = PYTHONWARNINGS = -usedevelop = true +skip_install = true whitelist_externals = rm @@ -83,22 +90,6 @@ setenv = usedevelop = true -[testenv:reset] # ------------------------------------------------------- - -basepython = {env:PYTHON:python} - -commands = - coverage erase - rm -frv doc/modules.rst doc/dimgx.rst doc/_dimgx.*.rst - -deps = - coverage - -skip_install = true - -whitelist_externals = - rm - [flake8] # -------------------------------------------------------------- ignore = E201,E202,E302,E305,E501