Author: Stefano Rivera <stef...@rivera.za.net>
Branch: split-verify
Changeset: r1356:5e2da61b8aa5
Date: 2013-10-06 15:02 +0200
http://bitbucket.org/cffi/cffi/changeset/5e2da61b8aa5/

Log:    Add cffi.packaging module which has everything you need for your
        setup.py

diff --git a/cffi/packaging.py b/cffi/packaging.py
new file mode 100644
--- /dev/null
+++ b/cffi/packaging.py
@@ -0,0 +1,21 @@
+from distutils.command.build_ext import build_ext as _build_ext
+from distutils.core import Extension
+import os
+
+
+class FFIExtension(Extension):
+    def __init__(self, ffi_builder):
+        self.ffi_builder = ffi_builder
+        Extension.__init__(self, '<cffi extension>', [])
+
+
+class build_ext(_build_ext):
+    def build_extension(self, ext):
+        if isinstance(ext, FFIExtension):
+            files = ext.ffi_builder(self.build_temp)
+            for name in files:
+                self.copy_file(
+                    os.path.join(self.build_temp, name),
+                    os.path.join(self.build_lib, name))
+        else:
+            super(build_ext, self).build_extension(ext)
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to