##// END OF EJS Templates
packaging: move find_vc_runtime_files() into hgpackaging.util...
Gregory Szorc -
r42076:1440dd61 default
parent child Browse files
Show More
@@ -7,6 +7,7 b''
7
7
8 # no-check-code because Python 3 native.
8 # no-check-code because Python 3 native.
9
9
10 import os
10 import pathlib
11 import pathlib
11 import tarfile
12 import tarfile
12 import zipfile
13 import zipfile
@@ -20,3 +21,28 b' def extract_tar_to_directory(source: pat'
20 def extract_zip_to_directory(source: pathlib.Path, dest: pathlib.Path):
21 def extract_zip_to_directory(source: pathlib.Path, dest: pathlib.Path):
21 with zipfile.ZipFile(source, 'r') as zf:
22 with zipfile.ZipFile(source, 'r') as zf:
22 zf.extractall(dest)
23 zf.extractall(dest)
24
25
26 def find_vc_runtime_files(x64=False):
27 """Finds Visual C++ Runtime DLLs to include in distribution."""
28 winsxs = pathlib.Path(os.environ['SYSTEMROOT']) / 'WinSxS'
29
30 prefix = 'amd64' if x64 else 'x86'
31
32 candidates = sorted(p for p in os.listdir(winsxs)
33 if p.lower().startswith('%s_microsoft.vc90.crt_' % prefix))
34
35 for p in candidates:
36 print('found candidate VC runtime: %s' % p)
37
38 # Take the newest version.
39 version = candidates[-1]
40
41 d = winsxs / version
42
43 return [
44 d / 'msvcm90.dll',
45 d / 'msvcp90.dll',
46 d / 'msvcr90.dll',
47 winsxs / 'Manifests' / ('%s.manifest' % version),
48 ]
@@ -24,31 +24,6 b' import platform, sys; print("%s:%d" % (p'
24 '''.strip()
24 '''.strip()
25
25
26
26
27 def find_vc_runtime_files(x64=False):
28 """Finds Visual C++ Runtime DLLs to include in distribution."""
29 winsxs = pathlib.Path(os.environ['SYSTEMROOT']) / 'WinSxS'
30
31 prefix = 'amd64' if x64 else 'x86'
32
33 candidates = sorted(p for p in os.listdir(winsxs)
34 if p.lower().startswith('%s_microsoft.vc90.crt_' % prefix))
35
36 for p in candidates:
37 print('found candidate VC runtime: %s' % p)
38
39 # Take the newest version.
40 version = candidates[-1]
41
42 d = winsxs / version
43
44 return [
45 d / 'msvcm90.dll',
46 d / 'msvcp90.dll',
47 d / 'msvcr90.dll',
48 winsxs / 'Manifests' / ('%s.manifest' % version),
49 ]
50
51
52 def build(source_dir: pathlib.Path, build_dir: pathlib.Path,
27 def build(source_dir: pathlib.Path, build_dir: pathlib.Path,
53 python_exe: pathlib.Path, iscc_exe: pathlib.Path,
28 python_exe: pathlib.Path, iscc_exe: pathlib.Path,
54 version=None):
29 version=None):
@@ -66,6 +41,7 b' def build(source_dir: pathlib.Path, buil'
66 from hgpackaging.util import (
41 from hgpackaging.util import (
67 extract_tar_to_directory,
42 extract_tar_to_directory,
68 extract_zip_to_directory,
43 extract_zip_to_directory,
44 find_vc_runtime_files,
69 )
45 )
70
46
71 if not iscc.exists():
47 if not iscc.exists():
General Comments 0
You need to be logged in to leave comments. Login now