mirror of
https://github.com/PyCQA/flake8.git
synced 2026-04-06 21:16:54 +00:00
Convert namespace package names into paths
Namespace packages, which have a name like "namespace.package" need to be converted to paths in order to be found by flake8 - as the code is in "namespace/package/".
This commit is contained in:
parent
bb61b3df82
commit
af2f71c910
2 changed files with 4 additions and 2 deletions
|
|
@ -54,7 +54,7 @@ class Flake8(setuptools.Command):
|
|||
empty_directory_exists = "" in directories
|
||||
packages = self.distribution.packages or []
|
||||
for package in packages:
|
||||
package_directory = package
|
||||
package_directory = os.path.join(*package.split("."))
|
||||
if package in directories:
|
||||
package_directory = directories[package]
|
||||
elif empty_directory_exists:
|
||||
|
|
@ -71,7 +71,7 @@ class Flake8(setuptools.Command):
|
|||
if package_directory.startswith(seen_package_directories):
|
||||
continue
|
||||
|
||||
seen_package_directories += (package_directory + ".",)
|
||||
seen_package_directories += (os.path.join(package_directory, ""),)
|
||||
yield package_directory
|
||||
|
||||
def module_files(self):
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ def distribution():
|
|||
'foo',
|
||||
'foo.bar',
|
||||
'foo_biz',
|
||||
'namespace.bar',
|
||||
],
|
||||
})
|
||||
|
||||
|
|
@ -30,4 +31,5 @@ def test_package_files_removes_submodules(command):
|
|||
assert sorted(package_files) == [
|
||||
'foo',
|
||||
'foo_biz',
|
||||
'namespace/bar',
|
||||
]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue