4 from setuptools
import setup
5 from setuptools
.command
.build_py
import build_py
as build_py_orig
12 here
= os
.path
.abspath(os
.path
.dirname(__file__
))
13 with codecs
.open(os
.path
.join(here
, rel_path
), 'r') as fp
:
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]
23 raise RuntimeError("Unable to find version string.")
29 class build_py(build_py_orig
):
31 def find_package_modules(self
, package
, package_dir
):
33 Custom module to find package modules.
34 It will strip out any modules which match the glob patters in exclude above
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
)]
45 version
=get_version('SCons/__init__.py'),