Merge pull request #4544 from bdbaddog/win32_test_speedup
[scons.git] / setup.py
blob6d52278dcef0fc72903f0e0df645056ace5ba906
1 #!python3
3 import fnmatch
4 from setuptools import setup
5 from setuptools.command.build_py import build_py as build_py_orig
7 import codecs
8 import os.path
11 def read(rel_path):
12 here = os.path.abspath(os.path.dirname(__file__))
13 with codecs.open(os.path.join(here, rel_path), 'r') as fp:
14 return fp.read()
17 def get_version(rel_path):
18 for line in read(rel_path).splitlines():
19 if line.startswith('__version__'):
20 delim = '"' if '"' in line else "'"
21 return line.split(delim)[1]
22 else:
23 raise RuntimeError("Unable to find version string.")
26 exclude = ['*Tests']
29 class build_py(build_py_orig):
31 def find_package_modules(self, package, package_dir):
32 """
33 Custom module to find package modules.
34 It will strip out any modules which match the glob patters in exclude above
35 """
36 modules = super().find_package_modules(package, package_dir)
37 return [(pkg, mod, file, ) for (pkg, mod, file, ) in modules
38 if not any(fnmatch.fnmatchcase(mod, pat=pattern)
39 for pattern in exclude)]
41 setup(
42 cmdclass={
43 'build_py': build_py,
45 version=get_version('SCons/__init__.py'),