Skip to content

Commit

Permalink
Use in-line ABI mode
Browse files Browse the repository at this point in the history
Fix #212, fix #214.
  • Loading branch information
liZe committed Jun 1, 2023
1 parent b48a5b3 commit aef853d
Show file tree
Hide file tree
Showing 5 changed files with 1 addition and 56 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
__pycache__
cairocffi/_ffi*.py
cairocffi/_generated
*.egg
*.egg-info
/build
Expand Down
2 changes: 1 addition & 1 deletion cairocffi/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from ctypes.util import find_library

from . import constants
from ._generated.ffi import ffi
from .ffi import ffi

VERSION = __version__ = '1.5.1'
# supported version of cairo, used to be pycairo version too:
Expand Down
20 changes: 0 additions & 20 deletions cairocffi/ffi_build.py → cairocffi/ffi.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,8 @@
constants = module_from_spec(constants_spec)
constants_spec.loader.exec_module(constants)

# Create an empty _generated folder if needed
generated = Path(__file__).parent / '_generated'
generated.mkdir(exist_ok=True)

# Primary cffi definitions
ffi = FFI()
ffi.set_source('cairocffi._generated.ffi', None)
ffi.cdef(constants._CAIRO_HEADERS)

# include xcffib cffi definitions for cairo xcb support
Expand All @@ -41,7 +36,6 @@

# gdk pixbuf cffi definitions
ffi_pixbuf = FFI()
ffi_pixbuf.set_source('cairocffi._generated.ffi_pixbuf', None)
ffi_pixbuf.include(ffi)
ffi_pixbuf.cdef('''
typedef unsigned long gsize;
Expand Down Expand Up @@ -102,17 +96,3 @@
void g_error_free (GError *error);
void g_type_init (void);
''')


def compile():
ffi.compile()
ffi_path = generated / 'ffi.py'
ffi_path.write_text('# flake8: noqa\n' + ffi_path.read_text())
ffi_pixbuf.compile()
ffi_pixbuf_path = generated / 'ffi_pixbuf.py'
ffi_pixbuf_path.write_text(
'# flake8: noqa\n' + ffi_pixbuf_path.read_text())


if __name__ == '__main__':
compile()
2 changes: 0 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
[build-system]
requires = ["setuptools >= 61.0.0", "cffi >= 1.1.0"]
build-backend = "build"
backend-path = ["utils"]

[project]
name = "cairocffi"
Expand Down
32 changes: 0 additions & 32 deletions utils/build.py

This file was deleted.

0 comments on commit aef853d

Please sign in to comment.