Skip to content

Commit

Permalink
Refine
Browse files Browse the repository at this point in the history
  • Loading branch information
hattya committed Feb 20, 2024
1 parent 720cf8a commit 78c8722
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 29 deletions.
4 changes: 1 addition & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
*.egg-info/
.eggs/
.tox/
build/
dist/
*.egg
*.py[cd]
*.py?
*.so
*.sw?
.coverage
Expand Down
1 change: 0 additions & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ Requirements
------------

- Python 3.8+
- setuptools


Usage
Expand Down
6 changes: 4 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ readme = "README.rst"
authors = [
{name = "Akinori Hattori", email = "[email protected]"},
]
license = {"text" = "ALv2"}
license = {text = "ALv2"}
classifiers = [
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
Expand All @@ -39,7 +39,9 @@ Homepage = "https://github.com/hattya/zopflipy"

[tool.setuptools]
include-package-data = false
packages = ["zopfli"]
packages = [
"zopfli",
]

[tool.setuptools.package-data]
zopfli = [
Expand Down
39 changes: 16 additions & 23 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,14 @@
from setuptools import setup, Command, Extension


zopfli_dir = os.path.join('zopfli', '_zopfli', 'zopfli', 'src')


def list_sources(path, exts):
srcs = []
def sources(path, exts):
for root, dirs, files in os.walk(path):
dirs[:] = (d for d in dirs if not d.startswith('.'))
for f in files:
n, ext = os.path.splitext(f)
if (ext in exts
and not n.endswith('_bin')):
srcs.append(os.path.normpath(os.path.join(root, f)))
return srcs
yield os.path.normpath(os.path.join(root, f))


class test(Command):
Expand Down Expand Up @@ -52,19 +47,17 @@ def run(self):
unittest.main(None, argv=argv)


ext_modules = [Extension('zopfli._zopfli',
include_dirs=[zopfli_dir],
sources=list_sources('.', ['.c', '.cc', '.cpp']))]

cmdclass = {
'test': test,
}

setup(ext_modules=ext_modules,
cmdclass=cmdclass,
scmver={
'root': os.path.dirname(os.path.abspath(__file__)),
'spec': 'micro',
'write_to': os.path.join('zopfli', '__version__.py'),
'fallback': ['__version__:version', 'zopfli'],
})
setup(
ext_modules=[Extension('zopfli._zopfli',
include_dirs=[os.path.join('zopfli', '_zopfli', 'zopfli', 'src')],
sources=list(sources('zopfli', ['.c', '.cc', '.cpp'])))],
cmdclass={
'test': test,
},
scmver={
'root': os.path.dirname(os.path.abspath(__file__)),
'spec': 'micro',
'write_to': os.path.join('zopfli', '__version__.py'),
'fallback': ['__version__:version', 'zopfli'],
},
)

0 comments on commit 78c8722

Please sign in to comment.