Cleanning up setup.py
This commit is contained in:
@@ -1,9 +1,20 @@
|
||||
# Python imports
|
||||
import pkg_resources
|
||||
import importlib.util
|
||||
|
||||
# Lib imports
|
||||
|
||||
# Application imports
|
||||
|
||||
|
||||
|
||||
def __bootstrap__():
|
||||
global __bootstrap__, __loader__, __file__
|
||||
import sys, pkg_resources, importlib.util
|
||||
__file__ = pkg_resources.resource_filename(__name__, 'pixbuf2cairo.cpython-313-x86_64-linux-gnu.so')
|
||||
__loader__ = None; del __bootstrap__, __loader__
|
||||
spec = importlib.util.spec_from_file_location(__name__,__file__)
|
||||
spec = importlib.util.spec_from_file_location(
|
||||
__name__,
|
||||
__file__
|
||||
)
|
||||
mod = importlib.util.module_from_spec(spec)
|
||||
spec.loader.exec_module(mod)
|
||||
|
||||
__bootstrap__()
|
||||
|
@@ -1,31 +1,28 @@
|
||||
# Python imports
|
||||
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
|
||||
|
||||
# Lib imports
|
||||
|
||||
# Application imports
|
||||
|
||||
|
||||
|
||||
pkg_config_args = ["gdk-pixbuf-2.0", "cairo"]
|
||||
|
||||
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")
|
||||
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]
|
||||
name = "pixbuf2cairo",
|
||||
version = "0.1",
|
||||
ext_modules = [ext]
|
||||
)
|
||||
|
Reference in New Issue
Block a user