##// END OF EJS Templates
packaging: use PyOxidizer for producing WiX MSI installer...
packaging: use PyOxidizer for producing WiX MSI installer We recently taught our in-tree PyOxidizer configuration file to produce MSI installers with WiX using PyOxidizer's built-in support for doing so. This commit changes our WiX + PyOxidizer installer generation code to use this functionality. After this change, all the Python packaging code is doing is the following: * Building HTML documentation * Making gettext available to the build process. * Munging CLI arguments to variables for the `pyoxidizer` execution. * Invoking `pyoxidizer build`. * Copying the produced `.msi` to the `dist/` directory. Applying this stack on stable and rebuilding the 5.8 MSI installer produced the following differences from the official 5.8 installer: * .exe and .pyd files aren't byte identical (this is expected). * Various .dist-info/ directories have different names due to older versions of PyOxidizer being buggy and not properly normalizing package names. (The new behavior is correct.) * Various *.dist-info/RECORD files are different due to content divergence of files (this is expected). * The python38.dll differs due to newer PyOxidizer shipping a newer version of Python 3.8. * We now ship python3.dll because PyOxidizer now includes this file by default. * The vcruntime140.dll differs because newer PyOxidizer installs a newer version. We also now ship a vcruntime140_1.dll because newer versions of the redistributable ship 2 files now. The WiX GUIDs and IDs of installed files have likely changed as a result of PyOxidizer's different mechanism for generating those identifiers. This means that an upgrade install of the MSI will replace files instead of doing an incremental update. This is likely harmless and we've incurred this kind of breakage before. As far as I can tell, the new PyOxidizer-built MSI is functionally equivalent to the old method. Once we drop support for Python 2.7 MSI installers, we can delete the WiX code from the repository. This commit temporarily drops support for extra `.wxs` files. We raise an exception instead of silently not using them, which I think is appropriate. We should be able to add support back in by injecting state into pyoxidizer.bzl via `--var`. I just didn't want to expend cognitive load to think about the solution as part of this series. Differential Revision: https://phab.mercurial-scm.org/D10688

File last commit:

r47478:b1f2c2b3 default
r47981:73f1a103 default
Show More
cat.rs
84 lines | 2.7 KiB | application/rls-services+xml | RustLexer
Simon Sapin
rust: remove `FooError` structs with only `kind: FooErrorKind` enum field...
r47163 use crate::error::CommandError;
Simon Sapin
rhg: Move subcommand CLI arguments definitions to respective modules...
r47251 use clap::Arg;
Simon Sapin
rhg: `cat` command: print error messages for missing files...
r47478 use format_bytes::format_bytes;
Simon Sapin
rhg: replace `map_*_error` functions with `From` impls...
r47165 use hg::operations::cat;
Antoine Cezar
rhg: add a limited `rhg cat -r` subcommand...
r46113 use hg::utils::hg_path::HgPathBuf;
use micro_timer::timed;
use std::convert::TryFrom;
pub const HELP_TEXT: &str = "
Output the current or given revision of files
";
Simon Sapin
rhg: Move subcommand CLI arguments definitions to respective modules...
r47251 pub fn args() -> clap::App<'static, 'static> {
clap::SubCommand::with_name("cat")
.arg(
Arg::with_name("rev")
.help("search the repository as it is in REV")
.short("-r")
.long("--revision")
.value_name("REV")
.takes_value(true),
)
.arg(
clap::Arg::with_name("files")
.required(true)
.multiple(true)
.empty_values(false)
.value_name("FILE")
.help("Activity to start: activity@category"),
)
.about(HELP_TEXT)
}
Simon Sapin
rhg: replace command structs with functions...
r47250 #[timed]
Simon Sapin
rhg: Group values passed to every sub-command into a struct...
r47334 pub fn run(invocation: &crate::CliInvocation) -> Result<(), CommandError> {
let rev = invocation.subcommand_args.value_of("rev");
let file_args = match invocation.subcommand_args.values_of("files") {
Simon Sapin
rhg: replace command structs with functions...
r47250 Some(files) => files.collect(),
None => vec![],
};
Antoine Cezar
rhg: add a limited `rhg cat -r` subcommand...
r46113
Simon Sapin
rhg: Move `Repo` object creation into `main()`...
r47335 let repo = invocation.repo?;
Simon Sapin
rhg: replace command structs with functions...
r47250 let cwd = hg::utils::current_dir()?;
Simon Sapin
rhg: Don’t make repository path absolute too early...
r47474 let working_directory = repo.working_directory_path();
let working_directory = cwd.join(working_directory); // Make it absolute
Simon Sapin
rhg: replace command structs with functions...
r47250
let mut files = vec![];
for file in file_args.iter() {
// TODO: actually normalize `..` path segments etc?
let normalized = cwd.join(&file);
let stripped = normalized
Simon Sapin
rhg: Don’t make repository path absolute too early...
r47474 .strip_prefix(&working_directory)
Simon Sapin
rhg: replace command structs with functions...
r47250 // TODO: error message for path arguments outside of the repo
.map_err(|_| CommandError::abort(""))?;
let hg_file = HgPathBuf::try_from(stripped.to_path_buf())
.map_err(|e| CommandError::abort(e.to_string()))?;
files.push(hg_file);
Antoine Cezar
rhg: add a limited `rhg cat -r` subcommand...
r46113 }
Simon Sapin
rhg: replace command structs with functions...
r47250 match rev {
Some(rev) => {
Simon Sapin
rhg: `cat` command: print error messages for missing files...
r47478 let output = cat(&repo, rev, &files).map_err(|e| (e, rev))?;
invocation.ui.write_stdout(&output.concatenated)?;
if !output.missing.is_empty() {
let short = format!("{:x}", output.node.short()).into_bytes();
for path in &output.missing {
invocation.ui.write_stderr(&format_bytes!(
b"{}: no such file in rev {}\n",
path.as_bytes(),
short
))?;
}
}
if output.found_any {
Ok(())
} else {
Err(CommandError::Unsuccessful)
}
Simon Sapin
rhg: replace command structs with functions...
r47250 }
Simon Sapin
rhg: Add a `rhg.on-unsupported` configuration key...
r47424 None => Err(CommandError::unsupported(
"`rhg cat` without `--rev` / `-r`",
)),
Antoine Cezar
rhg: add a limited `rhg cat -r` subcommand...
r46113 }
}