contrib/packaging/hgpackaging/pyoxidizer.py
changeset 47207 41be7698a4fd
parent 45922 37bcd7f5a543
child 47208 df1767fa822d
equal deleted inserted replaced
47206:c8001d9c26f5 47207:41be7698a4fd
    49 ]
    49 ]
    50 
    50 
    51 STAGING_EXCLUDES_WINDOWS = [
    51 STAGING_EXCLUDES_WINDOWS = [
    52     "doc/hg-ssh.8.html",
    52     "doc/hg-ssh.8.html",
    53 ]
    53 ]
       
    54 
       
    55 
       
    56 def build_docs_html(source_dir: pathlib.Path):
       
    57     """Ensures HTML documentation is built.
       
    58 
       
    59     This will fail if docutils isn't available.
       
    60 
       
    61     (The HTML docs aren't built as part of `pip install` so we need to build them
       
    62     out of band.)
       
    63     """
       
    64     subprocess.run(
       
    65         [sys.executable, str(source_dir / "setup.py"), "build_doc", "--html"],
       
    66         cwd=str(source_dir),
       
    67         check=True,
       
    68     )
    54 
    69 
    55 
    70 
    56 def run_pyoxidizer(
    71 def run_pyoxidizer(
    57     source_dir: pathlib.Path,
    72     source_dir: pathlib.Path,
    58     build_dir: pathlib.Path,
    73     build_dir: pathlib.Path,
   111 
   126 
   112     # Move some of those files around. We can get rid of this once Mercurial
   127     # Move some of those files around. We can get rid of this once Mercurial
   113     # is taught to use the importlib APIs for reading resources.
   128     # is taught to use the importlib APIs for reading resources.
   114     process_install_rules(STAGING_RULES_APP, build_dir, out_dir)
   129     process_install_rules(STAGING_RULES_APP, build_dir, out_dir)
   115 
   130 
   116     # We also need to run setup.py build_doc to produce html files,
   131     build_docs_html(source_dir)
   117     # as they aren't built as part of ``pip install``.
       
   118     # This will fail if docutils isn't installed.
       
   119     subprocess.run(
       
   120         [sys.executable, str(source_dir / "setup.py"), "build_doc", "--html"],
       
   121         cwd=str(source_dir),
       
   122         check=True,
       
   123     )
       
   124 
   132 
   125     if "windows" in target_triple:
   133     if "windows" in target_triple:
   126         process_install_rules(STAGING_RULES_WINDOWS, source_dir, out_dir)
   134         process_install_rules(STAGING_RULES_WINDOWS, source_dir, out_dir)
   127 
   135 
   128         # Write out a default editor.rc file to configure notepad as the
   136         # Write out a default editor.rc file to configure notepad as the