|
9 | 9 | from setuptools import setup, Command, Extension
|
10 | 10 |
|
11 | 11 |
|
12 |
| -zopfli_dir = os.path.join('zopfli', '_zopfli', 'zopfli', 'src') |
13 |
| - |
14 |
| - |
15 |
| -def list_sources(path, exts): |
16 |
| - srcs = [] |
| 12 | +def sources(path, exts): |
17 | 13 | for root, dirs, files in os.walk(path):
|
18 | 14 | dirs[:] = (d for d in dirs if not d.startswith('.'))
|
19 | 15 | for f in files:
|
20 | 16 | n, ext = os.path.splitext(f)
|
21 | 17 | if (ext in exts
|
22 | 18 | and not n.endswith('_bin')):
|
23 |
| - srcs.append(os.path.normpath(os.path.join(root, f))) |
24 |
| - return srcs |
| 19 | + yield os.path.normpath(os.path.join(root, f)) |
25 | 20 |
|
26 | 21 |
|
27 | 22 | class test(Command):
|
@@ -52,19 +47,17 @@ def run(self):
|
52 | 47 | unittest.main(None, argv=argv)
|
53 | 48 |
|
54 | 49 |
|
55 |
| -ext_modules = [Extension('zopfli._zopfli', |
56 |
| - include_dirs=[zopfli_dir], |
57 |
| - sources=list_sources('.', ['.c', '.cc', '.cpp']))] |
58 |
| - |
59 |
| -cmdclass = { |
60 |
| - 'test': test, |
61 |
| -} |
62 |
| - |
63 |
| -setup(ext_modules=ext_modules, |
64 |
| - cmdclass=cmdclass, |
65 |
| - scmver={ |
66 |
| - 'root': os.path.dirname(os.path.abspath(__file__)), |
67 |
| - 'spec': 'micro', |
68 |
| - 'write_to': os.path.join('zopfli', '__version__.py'), |
69 |
| - 'fallback': ['__version__:version', 'zopfli'], |
70 |
| - }) |
| 50 | +setup( |
| 51 | + ext_modules=[Extension('zopfli._zopfli', |
| 52 | + include_dirs=[os.path.join('zopfli', '_zopfli', 'zopfli', 'src')], |
| 53 | + sources=list(sources('zopfli', ['.c', '.cc', '.cpp'])))], |
| 54 | + cmdclass={ |
| 55 | + 'test': test, |
| 56 | + }, |
| 57 | + scmver={ |
| 58 | + 'root': os.path.dirname(os.path.abspath(__file__)), |
| 59 | + 'spec': 'micro', |
| 60 | + 'write_to': os.path.join('zopfli', '__version__.py'), |
| 61 | + 'fallback': ['__version__:version', 'zopfli'], |
| 62 | + }, |
| 63 | +) |
0 commit comments