comparison contrib/packaging/hgpackaging/pyoxidizer.py @ 47209:d09b36f69180

packaging: extract invocation of pyoxidizer to own function I'll be refactoring how the WiX installer creation calls into pyoxidizer and will need a lower level function for facilitating that. The new `run_pyoxidizer()` builds our execution environment (with gettext available) and invokes `pyoxidizer`. Differential Revision: https://phab.mercurial-scm.org/D10687
author Gregory Szorc <gregory.szorc@gmail.com>
date Thu, 06 May 2021 16:07:01 -0700
parents df1767fa822d
children 73f1a10320d1
comparison
equal deleted inserted replaced
47208:df1767fa822d 47209:d09b36f69180
66 cwd=str(source_dir), 66 cwd=str(source_dir),
67 check=True, 67 check=True,
68 ) 68 )
69 69
70 70
71 def create_pyoxidizer_install_layout( 71 def run_pyoxidizer(
72 source_dir: pathlib.Path, 72 source_dir: pathlib.Path, build_dir: pathlib.Path, target_triple: str,
73 build_dir: pathlib.Path, 73 ) -> pathlib.Path:
74 out_dir: pathlib.Path, 74 """Run `pyoxidizer` in an environment with access to build dependencies.
75 target_triple: str,
76 ):
77 """Build Mercurial with PyOxidizer and copy additional files into place.
78 75
79 After successful completion, ``out_dir`` contains files constituting a 76 Returns the output directory that pyoxidizer would have used for build
80 Mercurial install. 77 artifacts. Actual build artifacts are likely in a sub-directory with the
78 name of the pyoxidizer build target that was built.
81 """ 79 """
82 # We need to make gettext binaries available for compiling i18n files. 80 # We need to make gettext binaries available for compiling i18n files.
83 gettext_pkg, gettext_entry = download_entry('gettext', build_dir) 81 gettext_pkg, gettext_entry = download_entry('gettext', build_dir)
84 gettext_dep_pkg = download_entry('gettext-dep', build_dir)[0] 82 gettext_dep_pkg = download_entry('gettext-dep', build_dir)[0]
85 83
105 "--target-triple", 103 "--target-triple",
106 target_triple, 104 target_triple,
107 ] 105 ]
108 106
109 subprocess.run(args, env=env, check=True) 107 subprocess.run(args, env=env, check=True)
108
109 return source_dir / "build" / "pyoxidizer" / target_triple / "release"
110
111
112 def create_pyoxidizer_install_layout(
113 source_dir: pathlib.Path,
114 build_dir: pathlib.Path,
115 out_dir: pathlib.Path,
116 target_triple: str,
117 ):
118 """Build Mercurial with PyOxidizer and copy additional files into place.
119
120 After successful completion, ``out_dir`` contains files constituting a
121 Mercurial install.
122 """
123
124 run_pyoxidizer(source_dir, build_dir, target_triple)
110 125
111 if "windows" in target_triple: 126 if "windows" in target_triple:
112 target = "app_windows" 127 target = "app_windows"
113 else: 128 else:
114 target = "app_posix" 129 target = "app_posix"