mirror of
https://github.com/webmproject/libwebp.git
synced 2025-07-13 06:24:27 +02:00
swig: add python (decode) support
similar to Java, simple interface only Change-Id: I8a3d344e5d89f73627e4e0cb2067512260d46fdd
This commit is contained in:
40
swig/setup.py
Normal file
40
swig/setup.py
Normal file
@ -0,0 +1,40 @@
|
||||
#!/usr/bin/python
|
||||
|
||||
"""distutils script for libwebp python module."""
|
||||
|
||||
from distutils.core import setup
|
||||
from distutils.extension import Extension
|
||||
import os
|
||||
import shutil
|
||||
import tempfile
|
||||
|
||||
tmpdir = tempfile.mkdtemp()
|
||||
package = "com.google.webp"
|
||||
package_path = os.path.join(tmpdir, *package.split("."))
|
||||
os.makedirs(package_path)
|
||||
|
||||
# Create __init_.py files along the package path.
|
||||
initpy_path = tmpdir
|
||||
for d in package.split("."):
|
||||
initpy_path = os.path.join(initpy_path, d)
|
||||
open(os.path.join(initpy_path, "__init__.py"), "w").close()
|
||||
|
||||
shutil.copy2("libwebp.py", package_path)
|
||||
setup(name="libwebp",
|
||||
version="0.0",
|
||||
description="libwebp python wrapper",
|
||||
long_description="Provides access to 'simple' libwebp decode interface",
|
||||
license="BSD",
|
||||
url="http://developers.google.com/speed/webp",
|
||||
ext_package=package,
|
||||
ext_modules=[Extension("_libwebp",
|
||||
["libwebp_python_wrap.c"],
|
||||
libraries=["webp"],
|
||||
),
|
||||
],
|
||||
package_dir={"": tmpdir},
|
||||
packages=["com", "com.google", "com.google.webp"],
|
||||
py_modules=[package + ".libwebp"],
|
||||
)
|
||||
|
||||
shutil.rmtree(tmpdir)
|
Reference in New Issue
Block a user