Mercurial > hg
annotate mercurial/thirdparty/xdiff/xdiff.h @ 42172:71d8b4d91616 stable
setup: properly package distutils in py2exe virtualenv builds
Our in-repo py2exe packaging code uses virtualenvs for managing
dependencies. An advantage of this is that packaging is more
deterministic and reproducible. Without virtualenvs, we need to
install packages in the system Python install. Packages installed
by other consumers of the system Python could leak into the Mercurial
package.
A regression from this change was that py2exe packages contained
the virtualenv's hacked distutils modules instead of the original
distutils modules. (virtualenv installs a hacked distutils module
because distutils uses relative path lookups that fail when running
from a virtualenv.)
This commit introduces a workaround so py2exe packaging uses the
original distutils modules when running from a virtualenv.
With this change, `import distutils` no longer fails from py2exe
builds produced from a virtualenv. This fixes the regression.
Furthermore, we now include all distutils modules. Before, py2exe's
module finding would only find modules there were explicitly
referenced in code. So, we now package a complete copy of distutils
instead of a partial one. This is even better than before.
# no-check-commit foo_bar function name
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Sat, 20 Apr 2019 07:29:07 -0700 |
parents | a2baa61bbb14 |
children |
rev | line source |
---|---|
36671 | 1 /* |
2 * LibXDiff by Davide Libenzi ( File Differential Library ) | |
3 * Copyright (C) 2003 Davide Libenzi | |
4 * | |
5 * This library is free software; you can redistribute it and/or | |
6 * modify it under the terms of the GNU Lesser General Public | |
7 * License as published by the Free Software Foundation; either | |
8 * version 2.1 of the License, or (at your option) any later version. | |
9 * | |
10 * This library is distributed in the hope that it will be useful, | |
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
13 * Lesser General Public License for more details. | |
14 * | |
15 * You should have received a copy of the GNU Lesser General Public | |
16 * License along with this library; if not, see | |
17 * <http://www.gnu.org/licenses/>. | |
18 * | |
19 * Davide Libenzi <davidel@xmailserver.org> | |
20 * | |
21 */ | |
22 | |
23 #if !defined(XDIFF_H) | |
24 #define XDIFF_H | |
25 | |
26 #ifdef __cplusplus | |
27 extern "C" { | |
28 #endif /* #ifdef __cplusplus */ | |
29 | |
36672
9e7b14caf67f
xdiff: remove patience and histogram diff algorithms
Jun Wu <quark@fb.com>
parents:
36671
diff
changeset
|
30 #include <stddef.h> /* size_t */ |
9e7b14caf67f
xdiff: remove patience and histogram diff algorithms
Jun Wu <quark@fb.com>
parents:
36671
diff
changeset
|
31 |
36936 | 32 #if !defined(_MSC_VER) || _MSC_VER >= 1600 |
33 #include <stdint.h> | |
34 #else | |
35 /* prior to Visual Studio 2010 */ | |
36 typedef long long int64_t; | |
37 typedef unsigned long long uint64_t; | |
38 #endif | |
39 | |
36671 | 40 /* xpparm_t.flags */ |
41 #define XDF_NEED_MINIMAL (1 << 0) | |
42 | |
43 #define XDF_INDENT_HEURISTIC (1 << 23) | |
44 | |
36673 | 45 /* emit bdiff-style "matched" (a1, a2, b1, b2) hunks instead of "different" |
46 * (a1, a2 - a1, b1, b2 - b1) hunks */ | |
47 #define XDL_EMIT_BDIFFHUNK (1 << 4) | |
36671 | 48 |
49 typedef struct s_mmfile { | |
50 char *ptr; | |
36822
882657a9f768
xdiff: replace {unsigned ,}long with {u,}int64_t
Jun Wu <quark@fb.com>
parents:
36764
diff
changeset
|
51 int64_t size; |
36671 | 52 } mmfile_t; |
53 | |
54 typedef struct s_mmbuffer { | |
55 char *ptr; | |
36822
882657a9f768
xdiff: replace {unsigned ,}long with {u,}int64_t
Jun Wu <quark@fb.com>
parents:
36764
diff
changeset
|
56 int64_t size; |
36671 | 57 } mmbuffer_t; |
58 | |
59 typedef struct s_xpparam { | |
36822
882657a9f768
xdiff: replace {unsigned ,}long with {u,}int64_t
Jun Wu <quark@fb.com>
parents:
36764
diff
changeset
|
60 uint64_t flags; |
36671 | 61 } xpparam_t; |
62 | |
63 typedef struct s_xdemitcb { | |
64 void *priv; | |
65 } xdemitcb_t; | |
66 | |
36822
882657a9f768
xdiff: replace {unsigned ,}long with {u,}int64_t
Jun Wu <quark@fb.com>
parents:
36764
diff
changeset
|
67 typedef int (*xdl_emit_hunk_consume_func_t)(int64_t start_a, int64_t count_a, |
882657a9f768
xdiff: replace {unsigned ,}long with {u,}int64_t
Jun Wu <quark@fb.com>
parents:
36764
diff
changeset
|
68 int64_t start_b, int64_t count_b, |
36671 | 69 void *cb_data); |
70 | |
71 typedef struct s_xdemitconf { | |
36822
882657a9f768
xdiff: replace {unsigned ,}long with {u,}int64_t
Jun Wu <quark@fb.com>
parents:
36764
diff
changeset
|
72 uint64_t flags; |
36671 | 73 xdl_emit_hunk_consume_func_t hunk_func; |
74 } xdemitconf_t; | |
75 | |
76 | |
77 #define xdl_malloc(x) malloc(x) | |
78 #define xdl_free(ptr) free(ptr) | |
79 #define xdl_realloc(ptr,x) realloc(ptr,x) | |
80 | |
36822
882657a9f768
xdiff: replace {unsigned ,}long with {u,}int64_t
Jun Wu <quark@fb.com>
parents:
36764
diff
changeset
|
81 void *xdl_mmfile_first(mmfile_t *mmf, int64_t *size); |
882657a9f768
xdiff: replace {unsigned ,}long with {u,}int64_t
Jun Wu <quark@fb.com>
parents:
36764
diff
changeset
|
82 int64_t xdl_mmfile_size(mmfile_t *mmf); |
36671 | 83 |
84 int xdl_diff(mmfile_t *mf1, mmfile_t *mf2, xpparam_t const *xpp, | |
85 xdemitconf_t const *xecfg, xdemitcb_t *ecb); | |
86 | |
87 #ifdef __cplusplus | |
88 } | |
89 #endif /* #ifdef __cplusplus */ | |
90 | |
91 #endif /* #if !defined(XDIFF_H) */ |