comparison mercurial/cffi/bdiff.py @ 30346:9cc438bf7d9a

setup: move cffi stuff to mercurial/cffi This patch moves all setup*cffi stuff to mercurial/cffi to make the root directory cleaner. The idea was from mpm [1]: > It seems like we could have a fair amount of cffi definitions, and > cluttering the root directory (or mercurial/) with them is probably not > a great long-term solution. We could probably add a cffi/ directory > under mercurial/ to parallel pure/. [1]: https://www.mercurial-scm.org/pipermail/mercurial-devel/2016-July/086442.html
author Jun Wu <quark@fb.com>
date Wed, 09 Nov 2016 22:08:30 +0000
parents setup_bdiff_cffi.py@a8933d992a71
children 857876ebaed4
comparison
equal deleted inserted replaced
30345:fa54f7ade491 30346:9cc438bf7d9a
1 from __future__ import absolute_import
2
3 import cffi
4 import os
5
6 ffi = cffi.FFI()
7 ffi.set_source("_bdiff_cffi",
8 open(os.path.join(os.path.join(os.path.dirname(__file__), '..'),
9 'bdiff.c')).read(), include_dirs=['mercurial'])
10 ffi.cdef("""
11 struct bdiff_line {
12 int hash, n, e;
13 ssize_t len;
14 const char *l;
15 };
16
17 struct bdiff_hunk;
18 struct bdiff_hunk {
19 int a1, a2, b1, b2;
20 struct bdiff_hunk *next;
21 };
22
23 int bdiff_splitlines(const char *a, ssize_t len, struct bdiff_line **lr);
24 int bdiff_diff(struct bdiff_line *a, int an, struct bdiff_line *b, int bn,
25 struct bdiff_hunk *base);
26 void bdiff_freehunks(struct bdiff_hunk *l);
27 void free(void*);
28 """)
29
30 if __name__ == '__main__':
31 ffi.compile()