Patchwork D6086: packaging: move find_vc_runtime_files() into hgpackaging.util

login
register
mail settings
Submitter phabricator
Date March 10, 2019, 1:51 a.m.
Message ID <2517cdaca6ce4177d88a7060908f400f@localhost.localdomain>
Download mbox | patch
Permalink /patch/39181/
State Not Applicable
Headers show

Comments

phabricator - March 10, 2019, 1:51 a.m.
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG1440dd6164f2: packaging: move find_vc_runtime_files() into hgpackaging.util (authored by indygreg, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6086?vs=14393&id=14441

REVISION DETAIL
  https://phab.mercurial-scm.org/D6086

AFFECTED FILES
  contrib/packaging/hgpackaging/util.py
  contrib/packaging/inno/build.py

CHANGE DETAILS




To: indygreg, #hg-reviewers
Cc: mercurial-devel

Patch

diff --git a/contrib/packaging/inno/build.py b/contrib/packaging/inno/build.py
--- a/contrib/packaging/inno/build.py
+++ b/contrib/packaging/inno/build.py
@@ -24,31 +24,6 @@ 
 '''.strip()
 
 
-def find_vc_runtime_files(x64=False):
-    """Finds Visual C++ Runtime DLLs to include in distribution."""
-    winsxs = pathlib.Path(os.environ['SYSTEMROOT']) / 'WinSxS'
-
-    prefix = 'amd64' if x64 else 'x86'
-
-    candidates = sorted(p for p in os.listdir(winsxs)
-                  if p.lower().startswith('%s_microsoft.vc90.crt_' % prefix))
-
-    for p in candidates:
-        print('found candidate VC runtime: %s' % p)
-
-    # Take the newest version.
-    version = candidates[-1]
-
-    d = winsxs / version
-
-    return [
-        d / 'msvcm90.dll',
-        d / 'msvcp90.dll',
-        d / 'msvcr90.dll',
-        winsxs / 'Manifests' / ('%s.manifest' % version),
-    ]
-
-
 def build(source_dir: pathlib.Path, build_dir: pathlib.Path,
           python_exe: pathlib.Path, iscc_exe: pathlib.Path,
           version=None):
@@ -66,6 +41,7 @@ 
     from hgpackaging.util import (
         extract_tar_to_directory,
         extract_zip_to_directory,
+        find_vc_runtime_files,
     )
 
     if not iscc.exists():
diff --git a/contrib/packaging/hgpackaging/util.py b/contrib/packaging/hgpackaging/util.py
--- a/contrib/packaging/hgpackaging/util.py
+++ b/contrib/packaging/hgpackaging/util.py
@@ -7,6 +7,7 @@ 
 
 # no-check-code because Python 3 native.
 
+import os

 import pathlib
 import tarfile
 import zipfile
@@ -20,3 +21,28 @@ 
 def extract_zip_to_directory(source: pathlib.Path, dest: pathlib.Path):
     with zipfile.ZipFile(source, 'r') as zf:
         zf.extractall(dest)
+

+

+def find_vc_runtime_files(x64=False):

+    """Finds Visual C++ Runtime DLLs to include in distribution."""

+    winsxs = pathlib.Path(os.environ['SYSTEMROOT']) / 'WinSxS'

+

+    prefix = 'amd64' if x64 else 'x86'

+

+    candidates = sorted(p for p in os.listdir(winsxs)

+                  if p.lower().startswith('%s_microsoft.vc90.crt_' % prefix))

+

+    for p in candidates:

+        print('found candidate VC runtime: %s' % p)

+

+    # Take the newest version.

+    version = candidates[-1]

+

+    d = winsxs / version

+

+    return [

+        d / 'msvcm90.dll',

+        d / 'msvcp90.dll',

+        d / 'msvcr90.dll',

+        winsxs / 'Manifests' / ('%s.manifest' % version),

+    ]