summaryrefslogtreecommitdiffstats
path: root/setup.py
blob: d6b7783665c8b28aef89592f9ff18cbfa86c4a7e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import fnmatch
from setuptools import setup
from setuptools.command.build_py import build_py as build_py_orig


exclude = ['*Tests']


class build_py(build_py_orig):

    def find_package_modules(self, package, package_dir):
        """
        Custom module to find package modules.
        It will strip out any modules which match the glob patters in exclude above
        """
        modules = super().find_package_modules(package, package_dir)
        return [(pkg, mod, file, ) for (pkg, mod, file, ) in modules
                if not any(fnmatch.fnmatchcase(mod, pat=pattern)
                for pattern in exclude)]

setup(
    cmdclass={
        'build_py': build_py,
    }
)