diff -Nru check-manifest-0.37/appveyor.yml check-manifest-0.40/appveyor.yml --- check-manifest-0.37/appveyor.yml 2018-04-12 13:08:29.000000000 +0000 +++ check-manifest-0.40/appveyor.yml 2019-10-15 07:04:08.000000000 +0000 @@ -5,9 +5,10 @@ # https://www.appveyor.com/docs/installed-software#python lists available # versions - PYTHON: "C:\\Python27" - - PYTHON: "C:\\Python34" - PYTHON: "C:\\Python35" - PYTHON: "C:\\Python36" + - PYTHON: "C:\\Python37" + - PYTHON: "C:\\Python38" init: - "echo %PYTHON%" @@ -19,6 +20,9 @@ - choco install bzr - "set PATH=C:\\Program Files (x86)\\Bazaar;%PATH%" - bzr --version + - git --version + - svn --version + - hg --version build: off diff -Nru check-manifest-0.37/CHANGES.rst check-manifest-0.40/CHANGES.rst --- check-manifest-0.37/CHANGES.rst 2018-04-12 13:08:29.000000000 +0000 +++ check-manifest-0.40/CHANGES.rst 2019-10-15 07:04:08.000000000 +0000 @@ -2,6 +2,31 @@ ========= +0.40 (2019-10-15) +----------------- + +- Add Python 3.8 support. + + +0.39 (2019-06-06) +----------------- + +- You can now use check-manifest as a `pre-commit `_ + hook (`#100 `__). + + +0.38 (2019-04-23) +----------------- + +- Add Python 3.7 support. + +- Drop Python 3.4 support. + +- Added GitHub templates to default ignore patterns. + +- Added reading check-manifest config out of ``tox.ini`` or ``pyproject.toml``. + + 0.37 (2018-04-12) ----------------- diff -Nru check-manifest-0.37/check_manifest.py check-manifest-0.40/check_manifest.py --- check-manifest-0.37/check_manifest.py 2018-04-12 13:08:29.000000000 +0000 +++ check-manifest-0.40/check_manifest.py 2019-10-15 07:04:08.000000000 +0000 @@ -41,8 +41,10 @@ # Python 3.x import configparser as ConfigParser +import toml -__version__ = '0.37' + +__version__ = '0.40' __author__ = 'Marius Gedminas ' __licence__ = 'MIT' __url__ = 'https://github.com/mgedmin/check-manifest' @@ -281,6 +283,9 @@ >>> strip_toplevel_name(['a', 'a/b', 'a/c', 'a/c/d']) ['b', 'c', 'c/d'] + >>> strip_toplevel_name(['a', 'a/', 'a/b', 'a/c', 'a/c/d']) + ['b', 'c', 'c/d'] + >>> strip_toplevel_name(['a/b', 'a/c', 'a/c/d']) ['b', 'c', 'c/d'] @@ -298,7 +303,7 @@ if not name.startswith(prefix): raise Failure("File doesn't have the common prefix (%s): %s" % (name, prefix)) - return [name[len(prefix):] for name in names] + return [name[len(prefix):] for name in names if name != prefix] def add_prefix_to_each(prefix, filelist): @@ -529,6 +534,8 @@ # it's not a problem if the sdist is lacking these files: '.hgtags', '.hgsigs', '.hgignore', '.gitignore', '.bzrignore', '.gitattributes', + '.github', # GitHub template files + '.github/*', # GitHub template files '.travis.yml', 'Jenkinsfile', # it's convenient to ship compiled .mo files in sdists, but they shouldn't @@ -587,22 +594,59 @@ def read_config(): - """Read configuration from setup.cfg.""" + """Read configuration from file if possible.""" # XXX modifies global state, which is kind of evil - config = ConfigParser.ConfigParser() - config.read(['setup.cfg']) - if not config.has_section(CFG_SECTION_CHECK_MANIFEST): - return - if (config.has_option(*CFG_IGNORE_DEFAULT_RULES) - and config.getboolean(*CFG_IGNORE_DEFAULT_RULES)): + config = _load_config() + if config.get(CFG_IGNORE_DEFAULT_RULES[1], False): del IGNORE[:] - if config.has_option(*CFG_IGNORE): - patterns = [p.strip() for p in config.get(*CFG_IGNORE).splitlines()] - IGNORE.extend(p for p in patterns if p) - if config.has_option(*CFG_IGNORE_BAD_IDEAS): - lines = config.get(*CFG_IGNORE_BAD_IDEAS).splitlines() - patterns = [p.strip() for p in lines] - IGNORE_BAD_IDEAS.extend(p for p in patterns if p) + if CFG_IGNORE[1] in config: + IGNORE.extend(p for p in config[CFG_IGNORE[1]] if p) + if CFG_IGNORE_BAD_IDEAS[1] in config: + IGNORE_BAD_IDEAS.extend(p for p in config[CFG_IGNORE_BAD_IDEAS[1]] if p) + + +def _load_config(): + """Searches for config files, reads them and returns a dictionary + + Looks for a ``check-manifest`` section in ``pyproject.toml``, + ``setup.cfg``, and ``tox.ini``, in that order. The first file + that exists and has that section will be loaded and returned as a + dictionary. + + """ + if os.path.exists("pyproject.toml"): + config = toml.load("pyproject.toml") + if CFG_SECTION_CHECK_MANIFEST in config.get("tool", {}): + return config["tool"][CFG_SECTION_CHECK_MANIFEST] + + search_files = ['setup.cfg', 'tox.ini'] + config_parser = ConfigParser.ConfigParser() + for filename in search_files: + if (config_parser.read([filename]) + and config_parser.has_section(CFG_SECTION_CHECK_MANIFEST)): + config = {} + + if config_parser.has_option(*CFG_IGNORE_DEFAULT_RULES): + ignore_defaults = config_parser.getboolean(*CFG_IGNORE_DEFAULT_RULES) + config[CFG_IGNORE_DEFAULT_RULES[1]] = ignore_defaults + + if config_parser.has_option(*CFG_IGNORE): + patterns = [ + p.strip() + for p in config_parser.get(*CFG_IGNORE).splitlines() + ] + config[CFG_IGNORE[1]] = patterns + + if config_parser.has_option(*CFG_IGNORE_BAD_IDEAS): + patterns = [ + p.strip() + for p in config_parser.get(*CFG_IGNORE_BAD_IDEAS).splitlines() + ] + config[CFG_IGNORE_BAD_IDEAS[1]] = patterns + + return config + + return {} def read_manifest(): @@ -714,8 +758,8 @@ # of sub directories. We could use a regexp, but # two ignores seems easier. ignore.append(dirname + os.path.sep + pattern) - ignore.append(dirname + os.path.sep + '*' + os.path.sep + - pattern) + ignore.append( + dirname + os.path.sep + '*' + os.path.sep + pattern) elif cmd == 'prune': # rest is considered to be a directory name. It should # not contain a path separator, as it actually has no @@ -732,8 +776,8 @@ def file_matches(filename, patterns): """Does this filename match any of the patterns?""" - return any(fnmatch.fnmatch(filename, pat) or - fnmatch.fnmatch(os.path.basename(filename), pat) + return any(fnmatch.fnmatch(filename, pat) + or fnmatch.fnmatch(os.path.basename(filename), pat) for pat in patterns) diff -Nru check-manifest-0.37/.coveragerc check-manifest-0.40/.coveragerc --- check-manifest-0.37/.coveragerc 2018-04-12 13:08:29.000000000 +0000 +++ check-manifest-0.40/.coveragerc 2019-10-15 07:04:08.000000000 +0000 @@ -1,3 +1,6 @@ +[run] +source = check_manifest + [report] exclude_lines = pragma: nocover diff -Nru check-manifest-0.37/debian/changelog check-manifest-0.40/debian/changelog --- check-manifest-0.37/debian/changelog 2018-04-17 18:37:35.000000000 +0000 +++ check-manifest-0.40/debian/changelog 2019-10-20 00:11:56.000000000 +0000 @@ -1,3 +1,35 @@ +check-manifest (0.40-1) unstable; urgency=medium + + * New upstream version 0.40. + + -- Sergio Durigan Junior Sat, 19 Oct 2019 20:11:56 -0400 + +check-manifest (0.39-2) unstable; urgency=medium + + * Bump version for source-only upload. + + -- Sergio Durigan Junior Tue, 08 Oct 2019 00:02:25 -0400 + +check-manifest (0.39-1) unstable; urgency=medium + + [ Ondřej Nový ] + * Use debhelper-compat instead of debian/compat. + * d/control: Remove ancient X-Python3-Version field. + + [ Sergio Durigan Junior ] + * New upstream version 0.39. + * Depend on 'brz' (breezy) instead of 'bzr' (Bazaar). + Bazaar is being deprecated, and breezy is the replacement for it. We + now depend on 'brz' (breezy) for our testing purposes. + * Build-Depend on python3-toml. + * Make sure we create $HOME/.config/breezy when testing breezy. + (Closes: #941558) + * Bump Standards-Version to 4.4.1. + * Bump compat version to 12. + * Cleanup d/watch file. + + -- Sergio Durigan Junior Wed, 02 Oct 2019 10:10:14 -0400 + check-manifest (0.37-1) unstable; urgency=medium * Add d/tests/control. diff -Nru check-manifest-0.37/debian/compat check-manifest-0.40/debian/compat --- check-manifest-0.37/debian/compat 2018-02-17 17:30:45.000000000 +0000 +++ check-manifest-0.40/debian/compat 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -11 diff -Nru check-manifest-0.37/debian/control check-manifest-0.40/debian/control --- check-manifest-0.37/debian/control 2018-04-17 18:37:14.000000000 +0000 +++ check-manifest-0.40/debian/control 2019-10-02 14:08:45.000000000 +0000 @@ -3,19 +3,19 @@ Uploaders: Sergio Durigan Junior Section: utils Priority: optional -Build-Depends: debhelper (>= 11), +Build-Depends: debhelper-compat (= 12), dh-python, python3-all, python3-setuptools, + python3-toml, # Testsuite dependencies python3-mock, git, mercurial, - bzr, + brz, subversion, -Standards-Version: 4.1.4 +Standards-Version: 4.4.1 Homepage: https://github.com/mgedmin/check-manifest -X-Python3-Version: >= 3.5 Vcs-Git: https://salsa.debian.org/python-team/modules/check-manifest.git Vcs-Browser: https://salsa.debian.org/python-team/modules/check-manifest diff -Nru check-manifest-0.37/debian/patches/0001-Make-sure-we-create-HOME-.config-breezy-before-testi.patch check-manifest-0.40/debian/patches/0001-Make-sure-we-create-HOME-.config-breezy-before-testi.patch --- check-manifest-0.37/debian/patches/0001-Make-sure-we-create-HOME-.config-breezy-before-testi.patch 1970-01-01 00:00:00.000000000 +0000 +++ check-manifest-0.40/debian/patches/0001-Make-sure-we-create-HOME-.config-breezy-before-testi.patch 2019-10-02 14:02:11.000000000 +0000 @@ -0,0 +1,24 @@ +From: Sergio Durigan Junior +Date: Wed, 2 Oct 2019 02:23:30 -0400 +Subject: Make sure we create $HOME/.config/breezy/ before testing breezy. + +--- + tests.py | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/tests.py b/tests.py +index b5c499f..44a3e5e 100644 +--- a/tests.py ++++ b/tests.py +@@ -1073,6 +1073,11 @@ class BzrHelper(VCSHelper): + command = 'bzr' + + def _init_vcs(self): ++ # See Debian bug #941558. ++ bzrconfig = os.path.expanduser ("~/.config/breezy/") ++ if not os.path.exists (bzrconfig): ++ os.makedirs (bzrconfig) ++ + self._run('bzr', 'init') + self._run('bzr', 'whoami', '--branch', 'Unit Test ') + diff -Nru check-manifest-0.37/debian/patches/series check-manifest-0.40/debian/patches/series --- check-manifest-0.37/debian/patches/series 1970-01-01 00:00:00.000000000 +0000 +++ check-manifest-0.40/debian/patches/series 2019-10-02 14:02:11.000000000 +0000 @@ -0,0 +1 @@ +0001-Make-sure-we-create-HOME-.config-breezy-before-testi.patch diff -Nru check-manifest-0.37/debian/rules check-manifest-0.40/debian/rules --- check-manifest-0.37/debian/rules 2018-02-17 17:26:32.000000000 +0000 +++ check-manifest-0.40/debian/rules 2019-10-02 14:08:45.000000000 +0000 @@ -4,5 +4,8 @@ # Needed because the testsuite assumes we're on a UTF-8 environment. export LC_ALL = C.UTF-8 +# See bug #941558. +export HOME = /tmp + %: dh $@ --with python3 --buildsystem=pybuild diff -Nru check-manifest-0.37/debian/tests/control check-manifest-0.40/debian/tests/control --- check-manifest-0.37/debian/tests/control 2018-03-06 02:27:35.000000000 +0000 +++ check-manifest-0.40/debian/tests/control 2019-10-02 14:01:08.000000000 +0000 @@ -5,6 +5,6 @@ python3-mock, git, mercurial, - bzr, + brz, subversion, Restrictions: allow-stderr diff -Nru check-manifest-0.37/debian/tests/run-tests check-manifest-0.40/debian/tests/run-tests --- check-manifest-0.37/debian/tests/run-tests 2018-03-06 02:27:17.000000000 +0000 +++ check-manifest-0.40/debian/tests/run-tests 2019-10-02 14:08:45.000000000 +0000 @@ -2,6 +2,9 @@ set -efu +# See bug #941558. +export HOME=/tmp/ + PYTHONS_AVAILABLE=$(py3versions -i) for p in $PYTHONS_AVAILABLE ; do diff -Nru check-manifest-0.37/debian/watch check-manifest-0.40/debian/watch --- check-manifest-0.37/debian/watch 2018-02-16 02:38:32.000000000 +0000 +++ check-manifest-0.40/debian/watch 2019-10-02 14:09:38.000000000 +0000 @@ -1,4 +1,3 @@ version=4 -opts="filenamemangle=s%(?:.*?)?v?(\d[\d.]*)\.tar\.gz%-$1.tar.gz%" \ - https://github.com/mgedmin/check-manifest/tags \ - (?:.*?/)?v?(\d[\d.]*)\.tar\.gz debian uupdate +https://github.com/mgedmin/check-manifest/tags \ + (?:.*?/)?v?(\d[\d.]*)\.tar\.gz diff -Nru check-manifest-0.37/.github/FUNDING.yml check-manifest-0.40/.github/FUNDING.yml --- check-manifest-0.37/.github/FUNDING.yml 1970-01-01 00:00:00.000000000 +0000 +++ check-manifest-0.40/.github/FUNDING.yml 2019-10-15 07:04:08.000000000 +0000 @@ -0,0 +1 @@ +ko_fi: mgedmin diff -Nru check-manifest-0.37/.gitignore check-manifest-0.40/.gitignore --- check-manifest-0.37/.gitignore 2018-04-12 13:08:29.000000000 +0000 +++ check-manifest-0.40/.gitignore 2019-10-15 07:04:08.000000000 +0000 @@ -1,3 +1,5 @@ +.idea/ +.vscode/ *.pyc __pycache__/ .tox/ diff -Nru check-manifest-0.37/Makefile check-manifest-0.40/Makefile --- check-manifest-0.37/Makefile 2018-04-12 13:08:29.000000000 +0000 +++ check-manifest-0.40/Makefile 2019-10-15 07:04:08.000000000 +0000 @@ -8,7 +8,7 @@ .PHONY: check test test: - detox + tox -p auto check: SKIP_NO_TESTS=1 tox @@ -19,8 +19,10 @@ .PHONY: distcheck distcheck: distcheck-self # also release.mk will add other checks +DISTCHECK_DIFF_OPTS = $(DISTCHECK_DIFF_DEFAULT_OPTS) -x .github include release.mk .PHONY: distcheck-self distcheck-self: - $(PYTHON) check_manifest.py + tox -e py3 --notest + .tox/py3/bin/check-manifest diff -Nru check-manifest-0.37/MANIFEST.in check-manifest-0.40/MANIFEST.in --- check-manifest-0.37/MANIFEST.in 2018-04-12 13:08:29.000000000 +0000 +++ check-manifest-0.40/MANIFEST.in 2019-10-15 07:04:08.000000000 +0000 @@ -1,5 +1,6 @@ include *.rst include *.py +include *.yaml include tox.ini include Makefile include .gitignore diff -Nru check-manifest-0.37/.pre-commit-hooks.yaml check-manifest-0.40/.pre-commit-hooks.yaml --- check-manifest-0.37/.pre-commit-hooks.yaml 1970-01-01 00:00:00.000000000 +0000 +++ check-manifest-0.40/.pre-commit-hooks.yaml 2019-10-15 07:04:08.000000000 +0000 @@ -0,0 +1,7 @@ +- id: check-manifest + name: check-manifest + description: Check the completeness of MANIFEST.in for Python packages. + entry: check-manifest + language: python + pass_filenames: false + always_run: true diff -Nru check-manifest-0.37/README.rst check-manifest-0.40/README.rst --- check-manifest-0.37/README.rst 2018-04-12 13:08:29.000000000 +0000 +++ check-manifest-0.40/README.rst 2019-10-15 07:04:08.000000000 +0000 @@ -74,20 +74,30 @@ Configuration ------------- -You can tell check-manifest to ignore certain file patterns by adding a -``check-manifest`` section to your package's ``setup.cfg``. Example:: +You can configure check-manifest to ignore certain file patterns using +a ``[tool.check-manifest]`` section in your ``pyproject.toml`` file or +a ``[check-manifest]`` section in either ``setup.cfg`` or +``tox.ini``. Examples:: + + # pyproject.toml + [tool.check-manifest] + ignore = [".travis.yml"] + # setup.cfg or tox.ini [check-manifest] ignore = .travis.yml +Note that lists are newline separated in the ``setup.cfg`` and +``tox.ini`` files. + The following options are recognized: ignore - A list of newline separated filename patterns that will be ignored by - check-manifest. Use this if you want to keep files in your version - control system that shouldn't be included in your source distributions. - The default ignore list is :: + A list of filename patterns that will be ignored by check-manifest. + Use this if you want to keep files in your version control system + that shouldn't be included in your source distributions. The + default ignore list is :: PKG-INFO *.egg-info @@ -99,6 +109,7 @@ .gitignore .bzrignore .gitattributes + .github/* .travis.yml Jenkinsfile *.mo @@ -108,10 +119,25 @@ ignore list instead of adding to it. ignore-bad-ideas - A list of newline separated filename patterns that will be ignored by - check-manifest's generated files check. Use this if you want to keep - generated files in your version control system, even though it is generally - a bad idea. + A list of filename patterns that will be ignored by + check-manifest's generated files check. Use this if you want to + keep generated files in your version control system, even though + it is generally a bad idea. + + +Version control integration +--------------------------- + +With `pre-commit `_, check-manifest can be part of your +git-workflow. Add the following to your ``.pre-commit-config.yaml``. + +.. code-block:: yaml + + repos: + - repo: https://github.com/mgedmin/check-manifest + rev: "0.39" + hooks: + - id: check-manifest .. |buildstatus| image:: https://api.travis-ci.org/mgedmin/check-manifest.svg?branch=master @@ -122,4 +148,3 @@ .. |coverage| image:: https://coveralls.io/repos/mgedmin/check-manifest/badge.svg?branch=master .. _coverage: https://coveralls.io/r/mgedmin/check-manifest - diff -Nru check-manifest-0.37/release.mk check-manifest-0.40/release.mk --- check-manifest-0.37/release.mk 2018-04-12 13:08:29.000000000 +0000 +++ check-manifest-0.40/release.mk 2019-10-15 07:04:08.000000000 +0000 @@ -1,24 +1,31 @@ -# Makefile.rules version 1.0 (2017-12-19) +# release.mk version 1.4 (2019-04-23) # # Helpful Makefile rules for releasing Python packages. +# https://github.com/mgedmin/python-project-skel # You might want to change these FILE_WITH_VERSION ?= setup.py FILE_WITH_CHANGELOG ?= CHANGES.rst CHANGELOG_DATE_FORMAT ?= %Y-%m-%d CHANGELOG_FORMAT ?= $(changelog_ver) ($(changelog_date)) +DISTCHECK_DIFF_OPTS ?= $(DISTCHECK_DIFF_DEFAULT_OPTS) # These should be fine PYTHON ?= python -PYPI_PUBLISH ?= rm -rf dist && $(PYTHON) setup.py -q sdist bdist_wheel && twine upload dist/* && $(VCS_TAG) `$(PYTHON) setup.py --version` +PYPI_PUBLISH ?= rm -rf dist && $(PYTHON) setup.py -q sdist bdist_wheel && twine check dist/* && twine upload dist/* +LATEST_RELEASE_MK_URL = https://raw.githubusercontent.com/mgedmin/python-project-skel/master/release.mk +DISTCHECK_DIFF_DEFAULT_OPTS = -x PKG-INFO -x setup.cfg -x '*.egg-info' -I'^\#' # These should be fine, as long as you use Git VCS_GET_LATEST ?= git pull VCS_STATUS ?= git status --porcelain VCS_EXPORT ?= git archive --format=tar --prefix=tmp/tree/ HEAD | tar -xf - -VCS_TAG ?= git tag -s +VCS_TAG ?= git tag -s $(changelog_ver) -m \"Release $(changelog_ver)\" VCS_COMMIT_AND_PUSH ?= git commit -av -m "Post-release version bump" && git push && git push --tags +# These are internal implementation details +changelog_ver = `$(PYTHON) setup.py --version` +changelog_date = `LC_ALL=C date +'$(CHANGELOG_DATE_FORMAT)'` .PHONY: dist @@ -50,7 +57,7 @@ $(VCS_EXPORT) && \ cd tmp && \ tar -xzf ../dist/$$pkg_and_version.tar.gz && \ - diff -ur $$pkg_and_version tree -x PKG-INFO -x setup.cfg -x '*.egg-info' && \ + diff -ur $$pkg_and_version tree $(DISTCHECK_DIFF_OPTS) && \ cd $$pkg_and_version && \ make dist check && \ cd .. && \ @@ -60,13 +67,16 @@ cd ../two/ && \ tar -xzf ../$$pkg_and_version/dist/$$pkg_and_version.tar.gz && \ cd .. && \ - diff -ur one two -x SOURCES.txt && \ + diff -ur one two -x SOURCES.txt -I'^#:' && \ cd .. && \ rm -rf tmp && \ echo "sdist seems to be ok" -# NB: do not use $(MAKE) because then make -n releasechecklist will -# actually run the distcheck instead of just printing what it does +.PHONY: check-latest-rules +check-latest-rules: +ifndef FORCE + @curl -s $(LATEST_RELEASE_MK_URL) | cmp -s release.mk || { printf "\nYour release.mk does not match the latest version at\n$(LATEST_RELEASE_MK_URL)\n\n" 1>&2; exit 1; } +endif .PHONY: check-latest-version check-latest-version: @@ -81,17 +91,17 @@ check-long-description: @$(PYTHON) setup.py --long-description | rst2html --exit-status=2 > /dev/null -changelog_ver = `$(PYTHON) setup.py --version` -changelog_date = `LC_ALL=C date +'$(CHANGELOG_DATE_FORMAT)'` - .PHONY: check-changelog check-changelog: @ver_and_date="$(CHANGELOG_FORMAT)" && \ grep -q "^$$ver_and_date$$" $(FILE_WITH_CHANGELOG) || { \ echo "$(FILE_WITH_CHANGELOG) has no entry for $$ver_and_date"; exit 1; } +# NB: do not use $(MAKE) because then make -n releasechecklist will +# actually run the distcheck instead of just printing what it does + .PHONY: releasechecklist -releasechecklist: check-latest-version check-version-number check-long-description check-changelog +releasechecklist: check-latest-rules check-latest-version check-version-number check-long-description check-changelog make distcheck .PHONY: release @@ -106,6 +116,7 @@ @echo "Please run" @echo @echo " $(PYPI_PUBLISH)" + @echo " $(VCS_TAG)" @echo @echo "Please increment the version number in $(FILE_WITH_VERSION)" @echo "and add a new empty entry at the top of the changelog in $(FILE_WITH_CHANGELOG), then" diff -Nru check-manifest-0.37/setup.cfg check-manifest-0.40/setup.cfg --- check-manifest-0.37/setup.cfg 2018-04-12 13:08:29.000000000 +0000 +++ check-manifest-0.40/setup.cfg 2019-10-15 07:04:08.000000000 +0000 @@ -1,11 +1,14 @@ [bdist_wheel] universal = 1 +[metadata] +license_file = LICENSE.rst + [nosetests] with-doctest = 1 exe = 1 -[pytest] +[tool:pytest] norecursedirs = dist build tmp .* *.egg-info python_files = tests.py check_manifest.py addopts = --doctest-modules --ignore=setup.py @@ -14,7 +17,7 @@ python-file-with-version = check_manifest.py [flake8] -ignore=E241,E501,E261,E126,E127,E128,E302 +ignore = E241,E501,E261,E126,E127,E128,E302,W503 # E241: multiple spaces after ',' # E501: line too long # E261: at least two spaces before inline comment @@ -22,3 +25,4 @@ # E127: continuation line over-indented for visual indent # E128: continuation line under-indented for visual indent # E302: expected 2 blank lines, found 0 +# W503: line break before binary operator diff -Nru check-manifest-0.37/setup.py check-manifest-0.40/setup.py --- check-manifest-0.37/setup.py 2018-04-12 13:08:29.000000000 +0000 +++ check-manifest-0.40/setup.py 2019-10-15 07:04:08.000000000 +0000 @@ -1,12 +1,11 @@ #!/usr/bin/env python -import os, re, ast, email.utils, sys -from setuptools import setup +import ast +import email.utils +import os +import re -if sys.version_info < (2, 7): - sys.exit("Python 2.7 or newer is required for check-manifest") +from setuptools import setup -if (3, 0) <= sys.version_info < (3, 4): - sys.exit("Python 3.4 or newer is required for check-manifest") here = os.path.dirname(__file__) @@ -38,21 +37,18 @@ 'linter'], classifiers=[ 'Development Status :: 4 - Beta', -## 'Development Status :: 5 - Production/Stable', eventually... 'Environment :: Console', 'Intended Audience :: Developers', - 'License :: OSI Approved :: GNU General Public License (GPL)' - if licence.startswith('GPL') else - 'License :: OSI Approved :: MIT License' - if licence.startswith('MIT') else - 'License :: uhh, dunno', # fail PyPI upload intentionally until fixed + 'License :: OSI Approved :: MIT License', 'Operating System :: OS Independent', 'Programming Language :: Python', + 'Programming Language :: Python :: 2', 'Programming Language :: Python :: 2.7', - 'Programming Language :: Python :: 3.4', + 'Programming Language :: Python :: 3', 'Programming Language :: Python :: 3.5', 'Programming Language :: Python :: 3.6', 'Programming Language :: Python :: 3.7', + 'Programming Language :: Python :: 3.8', 'Programming Language :: Python :: Implementation :: CPython', 'Programming Language :: Python :: Implementation :: PyPy', ], @@ -61,7 +57,8 @@ py_modules=['check_manifest'], zip_safe=False, test_suite='tests.test_suite', - install_requires=[], + python_requires=">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*", + install_requires=['toml'], extras_require={ 'test': ['mock'], }, diff -Nru check-manifest-0.37/tests.py check-manifest-0.40/tests.py --- check-manifest-0.37/tests.py 2018-04-12 13:08:29.000000000 +0000 +++ check-manifest-0.40/tests.py 2019-10-15 07:04:08.000000000 +0000 @@ -1,7 +1,10 @@ +from __future__ import print_function + import codecs import doctest import locale import os +import shutil import subprocess import sys import tarfile @@ -287,6 +290,9 @@ def test_strip_sdist_extras(self): from check_manifest import strip_sdist_extras filelist = list(map(os.path.normpath, [ + '.github', + '.github/ISSUE_TEMPLATE', + '.github/ISSUE_TEMPLATE/bug_report.md', '.gitignore', '.travis.yml', 'setup.py', @@ -329,6 +335,7 @@ recursive-exclude src/zope *.sh """) filelist = list(map(os.path.normpath, [ + '.github/ISSUE_TEMPLATE/bug_report.md', '.gitignore', 'setup.py', 'setup.cfg', @@ -614,21 +621,35 @@ check_manifest.read_config() self.assertEqual(check_manifest.IGNORE, ['default-ignore-rules']) - def test_read_config_no_section(self): + def test_read_setup_config_no_section(self): import check_manifest with open('setup.cfg', 'w') as f: f.write('[pep8]\nignore =\n') check_manifest.read_config() self.assertEqual(check_manifest.IGNORE, ['default-ignore-rules']) - def test_read_config_no_option(self): + def test_read_pyproject_config_no_section(self): + import check_manifest + with open('pyproject.toml', 'w') as f: + f.write('[tool.pep8]\nignore = []\n') + check_manifest.read_config() + self.assertEqual(check_manifest.IGNORE, ['default-ignore-rules']) + + def test_read_setup_config_no_option(self): import check_manifest with open('setup.cfg', 'w') as f: f.write('[check-manifest]\n') check_manifest.read_config() self.assertEqual(check_manifest.IGNORE, ['default-ignore-rules']) - def test_read_config_extra_ignores(self): + def test_read_pyproject_config_no_option(self): + import check_manifest + with open('pyproject.toml', 'w') as f: + f.write('[tool.check-manifest]\n') + check_manifest.read_config() + self.assertEqual(check_manifest.IGNORE, ['default-ignore-rules']) + + def test_read_setup_config_extra_ignores(self): import check_manifest with open('setup.cfg', 'w') as f: f.write('[check-manifest]\nignore = foo\n bar\n') @@ -636,7 +657,15 @@ self.assertEqual(check_manifest.IGNORE, ['default-ignore-rules', 'foo', 'bar']) - def test_read_config_override_ignores(self): + def test_read_pyproject_config_extra_ignores(self): + import check_manifest + with open('pyproject.toml', 'w') as f: + f.write('[tool.check-manifest]\nignore = ["foo", "bar"]\n') + check_manifest.read_config() + self.assertEqual(check_manifest.IGNORE, + ['default-ignore-rules', 'foo', 'bar']) + + def test_read_setup_config_override_ignores(self): import check_manifest with open('setup.cfg', 'w') as f: f.write('[check-manifest]\nignore = foo\n\n bar\n') @@ -645,7 +674,16 @@ self.assertEqual(check_manifest.IGNORE, ['foo', 'bar']) - def test_read_config_ignore_bad_ideas(self): + def test_read_pyproject_config_override_ignores(self): + import check_manifest + with open('pyproject.toml', 'w') as f: + f.write('[tool.check-manifest]\nignore = ["foo", "bar"]\n') + f.write('ignore-default-rules = true\n') + check_manifest.read_config() + self.assertEqual(check_manifest.IGNORE, + ['foo', 'bar']) + + def test_read_setup_config_ignore_bad_ideas(self): import check_manifest with open('setup.cfg', 'w') as f: f.write('[check-manifest]\n' @@ -655,6 +693,14 @@ check_manifest.read_config() self.assertEqual(check_manifest.IGNORE_BAD_IDEAS, ['foo', 'bar']) + def test_read_pyproject_config_ignore_bad_ideas(self): + import check_manifest + with open('pyproject.toml', 'w') as f: + f.write('[tool.check-manifest]\n' + 'ignore-bad-ideas = ["foo", "bar"]\n') + check_manifest.read_config() + self.assertEqual(check_manifest.IGNORE_BAD_IDEAS, ['foo', 'bar']) + def test_read_manifest_no_manifest(self): import check_manifest check_manifest.read_manifest() @@ -843,13 +889,17 @@ # https://github.com/mgedmin/check-manifest/issues/23#issuecomment-33933031 if str is bytes: command = [s.encode(locale.getpreferredencoding()) for s in command] + print('$', ' '.join(command)) p = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) stdout, stderr = p.communicate() rc = p.wait() + if stdout: + print( + stdout if isinstance(stdout, str) else + stdout.decode('ascii', 'backslashreplace') + ) if rc: - print(' '.join(command)) - print(stdout) raise subprocess.CalledProcessError(rc, command[0], output=stdout) @@ -1350,27 +1400,33 @@ def test_all_is_well(self): from check_manifest import check_manifest self._create_repo_with_code() - self.assertTrue(check_manifest()) + self.assertTrue(check_manifest(), sys.stderr.getvalue()) def test_relative_pathname(self): from check_manifest import check_manifest subdir = self._create_repo_with_code_in_subdir() - self.assertTrue(check_manifest(subdir)) + self.assertTrue(check_manifest(subdir), sys.stderr.getvalue()) def test_relative_python(self): # https://github.com/mgedmin/check-manifest/issues/36 from check_manifest import check_manifest subdir = self._create_repo_with_code_in_subdir() python = os.path.relpath(sys.executable) - self.assertTrue(check_manifest(subdir, python=python)) + self.assertTrue(check_manifest(subdir, python=python), + sys.stderr.getvalue()) def test_python_from_path(self): # https://github.com/mgedmin/check-manifest/issues/57 - # NB: this test assumes you have a 'python' executable somewhere - # in your path. from check_manifest import check_manifest + # We need a Python interpeter to be in PATH. + python = 'python' + if hasattr(shutil, 'which'): + for python in 'python', 'python3', os.path.basename(sys.executable): + if shutil.which(python): + break subdir = self._create_repo_with_code_in_subdir() - self.assertTrue(check_manifest(subdir, python='python')) + self.assertTrue(check_manifest(subdir, python=python), + sys.stderr.getvalue()) def test_suggestions(self): from check_manifest import check_manifest diff -Nru check-manifest-0.37/tox.ini check-manifest-0.40/tox.ini --- check-manifest-0.37/tox.ini 2018-04-12 13:08:29.000000000 +0000 +++ check-manifest-0.40/tox.ini 2019-10-15 07:04:08.000000000 +0000 @@ -1,29 +1,30 @@ [tox] envlist = - py27,py34,py35,py36,pypy,pypy3 + py27,py35,py36,py37,py38,pypy,pypy3,flake8 [testenv] passenv = LANG LC_CTYPE LC_ALL MSYSTEM +extras = test deps = - mock nose commands = nosetests {posargs} -## if I run check-manifest here, it breaks my 'make release' :( -## check-manifest [testenv:coverage] deps = {[testenv]deps} coverage commands = - coverage run --source=check_manifest -m nose -## since I'm not running check-manifest during regular tests, let's not lie -## about the coverage numbers -## coverage run --append check_manifest.py + coverage run -m nose coverage report -m --fail-under=100 [testenv:py] commands = python --version nosetests {posargs} + + +[testenv:flake8] +skip_install = true +deps = flake8 +commands = flake8 *.py diff -Nru check-manifest-0.37/.travis.yml check-manifest-0.40/.travis.yml --- check-manifest-0.37/.travis.yml 2018-04-12 13:08:29.000000000 +0000 +++ check-manifest-0.40/.travis.yml 2019-10-15 07:04:08.000000000 +0000 @@ -1,11 +1,13 @@ language: python -sudo: false +sudo: required +dist: xenial +cache: pip python: - 2.7 - - 3.4 - 3.5 - 3.6 - - 3.7-dev + - 3.7 + - 3.8 - pypy - pypy3 env: @@ -14,10 +16,12 @@ - FORCE_TEST_VCS=hg - FORCE_TEST_VCS=svn install: - - pip install coverage coveralls mock + - pip install coverage coveralls mock flake8 toml script: - - SKIP_NO_TESTS=1 coverage run --source=check_manifest setup.py test -q - - coverage run --source=check_manifest --append check_manifest.py + - SKIP_NO_TESTS=1 coverage run setup.py test -q + - coverage report -m + - python check_manifest.py + - flake8 *.py after_script: - coveralls notifications: