diff --git a/setup.py b/setup.py index 8b9617d..9afe94a 100644 --- a/setup.py +++ b/setup.py @@ -3,10 +3,13 @@ from __future__ import with_statement import functools +import os import sys import setuptools +sys.path.insert(0, os.path.join(os.path.dirname(__file__), 'src')) + import flake8 # noqa try: @@ -66,6 +69,7 @@ setuptools.setup( maintainer="Ian Cordasco", maintainer_email="graffatcolmingov@gmail.com", url="https://gitlab.com/pycqa/flake8", + package_dir={"": "src"}, packages=[ "flake8", "flake8.api", diff --git a/flake8/__init__.py b/src/flake8/__init__.py similarity index 100% rename from flake8/__init__.py rename to src/flake8/__init__.py diff --git a/flake8/__main__.py b/src/flake8/__main__.py similarity index 100% rename from flake8/__main__.py rename to src/flake8/__main__.py diff --git a/flake8/api/__init__.py b/src/flake8/api/__init__.py similarity index 100% rename from flake8/api/__init__.py rename to src/flake8/api/__init__.py diff --git a/flake8/checker.py b/src/flake8/checker.py similarity index 100% rename from flake8/checker.py rename to src/flake8/checker.py diff --git a/flake8/defaults.py b/src/flake8/defaults.py similarity index 100% rename from flake8/defaults.py rename to src/flake8/defaults.py diff --git a/flake8/exceptions.py b/src/flake8/exceptions.py similarity index 100% rename from flake8/exceptions.py rename to src/flake8/exceptions.py diff --git a/flake8/formatting/__init__.py b/src/flake8/formatting/__init__.py similarity index 100% rename from flake8/formatting/__init__.py rename to src/flake8/formatting/__init__.py diff --git a/flake8/formatting/base.py b/src/flake8/formatting/base.py similarity index 100% rename from flake8/formatting/base.py rename to src/flake8/formatting/base.py diff --git a/flake8/formatting/default.py b/src/flake8/formatting/default.py similarity index 100% rename from flake8/formatting/default.py rename to src/flake8/formatting/default.py diff --git a/flake8/main/__init__.py b/src/flake8/main/__init__.py similarity index 100% rename from flake8/main/__init__.py rename to src/flake8/main/__init__.py diff --git a/flake8/main/application.py b/src/flake8/main/application.py similarity index 100% rename from flake8/main/application.py rename to src/flake8/main/application.py diff --git a/flake8/main/cli.py b/src/flake8/main/cli.py similarity index 100% rename from flake8/main/cli.py rename to src/flake8/main/cli.py diff --git a/flake8/main/git.py b/src/flake8/main/git.py similarity index 100% rename from flake8/main/git.py rename to src/flake8/main/git.py diff --git a/flake8/main/mercurial.py b/src/flake8/main/mercurial.py similarity index 100% rename from flake8/main/mercurial.py rename to src/flake8/main/mercurial.py diff --git a/flake8/main/options.py b/src/flake8/main/options.py similarity index 100% rename from flake8/main/options.py rename to src/flake8/main/options.py diff --git a/flake8/main/setuptools_command.py b/src/flake8/main/setuptools_command.py similarity index 100% rename from flake8/main/setuptools_command.py rename to src/flake8/main/setuptools_command.py diff --git a/flake8/main/vcs.py b/src/flake8/main/vcs.py similarity index 100% rename from flake8/main/vcs.py rename to src/flake8/main/vcs.py diff --git a/flake8/options/__init__.py b/src/flake8/options/__init__.py similarity index 100% rename from flake8/options/__init__.py rename to src/flake8/options/__init__.py diff --git a/flake8/options/aggregator.py b/src/flake8/options/aggregator.py similarity index 100% rename from flake8/options/aggregator.py rename to src/flake8/options/aggregator.py diff --git a/flake8/options/config.py b/src/flake8/options/config.py similarity index 100% rename from flake8/options/config.py rename to src/flake8/options/config.py diff --git a/flake8/options/manager.py b/src/flake8/options/manager.py similarity index 100% rename from flake8/options/manager.py rename to src/flake8/options/manager.py diff --git a/flake8/plugins/__init__.py b/src/flake8/plugins/__init__.py similarity index 100% rename from flake8/plugins/__init__.py rename to src/flake8/plugins/__init__.py diff --git a/flake8/plugins/_trie.py b/src/flake8/plugins/_trie.py similarity index 100% rename from flake8/plugins/_trie.py rename to src/flake8/plugins/_trie.py diff --git a/flake8/plugins/manager.py b/src/flake8/plugins/manager.py similarity index 100% rename from flake8/plugins/manager.py rename to src/flake8/plugins/manager.py diff --git a/flake8/plugins/notifier.py b/src/flake8/plugins/notifier.py similarity index 100% rename from flake8/plugins/notifier.py rename to src/flake8/plugins/notifier.py diff --git a/flake8/plugins/pyflakes.py b/src/flake8/plugins/pyflakes.py similarity index 100% rename from flake8/plugins/pyflakes.py rename to src/flake8/plugins/pyflakes.py diff --git a/flake8/processor.py b/src/flake8/processor.py similarity index 100% rename from flake8/processor.py rename to src/flake8/processor.py diff --git a/flake8/style_guide.py b/src/flake8/style_guide.py similarity index 100% rename from flake8/style_guide.py rename to src/flake8/style_guide.py diff --git a/flake8/utils.py b/src/flake8/utils.py similarity index 100% rename from flake8/utils.py rename to src/flake8/utils.py diff --git a/tests/unit/test_utils.py b/tests/unit/test_utils.py index 062f7f9..5d31e82 100644 --- a/tests/unit/test_utils.py +++ b/tests/unit/test_utils.py @@ -71,15 +71,15 @@ def test_fnmatch_returns_the_default_with_empty_default(): def test_filenames_from_a_directory(): """Verify that filenames_from walks a directory.""" - filenames = list(utils.filenames_from('flake8/')) + filenames = list(utils.filenames_from('src/flake8/')) assert len(filenames) > 2 - assert 'flake8/__init__.py' in filenames + assert 'src/flake8/__init__.py' in filenames def test_filenames_from_a_directory_with_a_predicate(): """Verify that predicates filter filenames_from.""" filenames = list(utils.filenames_from( - arg='flake8/', + arg='src/flake8/', predicate=lambda filename: filename == 'flake8/__init__.py', )) assert len(filenames) > 2 diff --git a/tox.ini b/tox.ini index c17f025..beeb2e3 100644 --- a/tox.ini +++ b/tox.ini @@ -24,7 +24,7 @@ deps = flake8-docstrings>=0.2.7 flake8-import-order commands = - flake8 + flake8 src/flake8/ tests/ setup.py [testenv:pylint] basepython = python3