Show More
@@ -1,57 +1,58 b'' | |||
|
1 | 1 | # Instructions: |
|
2 | 2 | # |
|
3 | 3 | # 1. cargo install --version 0.5.0 pyoxidizer |
|
4 | 4 | # 2. cd /path/to/hg |
|
5 | 5 | # 3. pyoxidizer build --path contrib/packaging [--release] |
|
6 | 6 | # 4. Run build/pyoxidizer/<arch>/<debug|release>/app/hg |
|
7 | 7 | # |
|
8 | 8 | # If you need to build again, you need to remove the build/lib.* and |
|
9 | 9 | # build/temp.* directories, otherwise PyOxidizer fails to pick up C |
|
10 | 10 | # extensions. This is a bug in PyOxidizer. |
|
11 | 11 | |
|
12 | 12 | ROOT = CWD + "/../.." |
|
13 | 13 | |
|
14 | 14 | set_build_path(ROOT + "/build/pyoxidizer") |
|
15 | 15 | |
|
16 | 16 | def make_exe(): |
|
17 | 17 | dist = default_python_distribution() |
|
18 | 18 | |
|
19 | 19 | code = "import hgdemandimport; hgdemandimport.enable(); from mercurial import dispatch; dispatch.run()" |
|
20 | 20 | |
|
21 | 21 | config = PythonInterpreterConfig( |
|
22 | 22 | raw_allocator = "system", |
|
23 | 23 | run_eval = code, |
|
24 | 24 | # We need this to make resourceutil happy, since it looks for sys.frozen. |
|
25 | 25 | sys_frozen = True, |
|
26 | legacy_windows_stdio = True, | |
|
26 | 27 | ) |
|
27 | 28 | |
|
28 | 29 | exe = dist.to_python_executable( |
|
29 | 30 | name = "hg", |
|
30 | 31 | config = config, |
|
31 | 32 | ) |
|
32 | 33 | |
|
33 | 34 | # Use setup.py install to build Mercurial and collect Python resources to |
|
34 | 35 | # embed in the executable. |
|
35 | 36 | resources = dist.setup_py_install(ROOT) |
|
36 | 37 | exe.add_python_resources(resources) |
|
37 | 38 | |
|
38 | 39 | return exe |
|
39 | 40 | |
|
40 | 41 | def make_install(exe): |
|
41 | 42 | m = FileManifest() |
|
42 | 43 | |
|
43 | 44 | # `hg` goes in root directory. |
|
44 | 45 | m.add_python_resource(".", exe) |
|
45 | 46 | |
|
46 | 47 | templates = glob( |
|
47 | 48 | include=[ROOT + "/mercurial/templates/**/*"], |
|
48 | 49 | strip_prefix = ROOT + "/mercurial/", |
|
49 | 50 | ) |
|
50 | 51 | m.add_manifest(templates) |
|
51 | 52 | |
|
52 | 53 | return m |
|
53 | 54 | |
|
54 | 55 | register_target("exe", make_exe) |
|
55 | 56 | register_target("app", make_install, depends = ["exe"], default = True) |
|
56 | 57 | |
|
57 | 58 | resolve_targets() |
General Comments 0
You need to be logged in to leave comments.
Login now