32 lines
678 B
Python
32 lines
678 B
Python
|
from setuptools import setup, Extension
|
||
|
import gi
|
||
|
gi.require_version("GdkPixbuf", "2.0")
|
||
|
|
||
|
from gi.repository import GdkPixbuf
|
||
|
from gi.repository import GObject
|
||
|
|
||
|
pkg_config_args = [
|
||
|
"--cflags", "--libs",
|
||
|
"gdk-pixbuf-2.0",
|
||
|
"cairo"
|
||
|
]
|
||
|
|
||
|
from subprocess import check_output
|
||
|
|
||
|
def get_pkgconfig_flags(flag_type):
|
||
|
return check_output(["pkg-config", flag_type] + pkg_config_args).decode().split()
|
||
|
|
||
|
ext = Extension(
|
||
|
"pixbuf2cairo",
|
||
|
sources=["pixbuf2cairo.c"],
|
||
|
include_dirs=[],
|
||
|
extra_compile_args=get_pkgconfig_flags("--cflags"),
|
||
|
extra_link_args=get_pkgconfig_flags("--libs")
|
||
|
)
|
||
|
|
||
|
setup(
|
||
|
name="pixbuf2cairo",
|
||
|
version="0.1",
|
||
|
ext_modules=[ext]
|
||
|
)
|