• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/usr/bin/python
2
3"""distutils script for libwebp python module."""
4
5from distutils.core import setup
6from distutils.extension import Extension
7import os
8import shutil
9import tempfile
10
11tmpdir = tempfile.mkdtemp()
12package = "com.google.webp"
13package_path = os.path.join(tmpdir, *package.split("."))
14os.makedirs(package_path)
15
16# Create __init_.py files along the package path.
17initpy_path = tmpdir
18for d in package.split("."):
19  initpy_path = os.path.join(initpy_path, d)
20  open(os.path.join(initpy_path, "__init__.py"), "w").close()
21
22shutil.copy2("libwebp.py", package_path)
23setup(name="libwebp",
24      version="0.0",
25      description="libwebp python wrapper",
26      long_description="Provides access to 'simple' libwebp decode interface",
27      license="BSD",
28      url="http://developers.google.com/speed/webp",
29      ext_package=package,
30      ext_modules=[Extension("_libwebp",
31                             ["libwebp_python_wrap.c"],
32                             libraries=["webp"],
33                            ),
34                  ],
35      package_dir={"": tmpdir},
36      packages=["com", "com.google", "com.google.webp"],
37      py_modules=[package + ".libwebp"],
38     )
39
40shutil.rmtree(tmpdir)
41