comparison contrib/packaging/hgpackaging/inno.py @ 43076:2372284d9457

formatting: blacken the codebase This is using my patch to black (https://github.com/psf/black/pull/826) so we don't un-wrap collection literals. Done with: hg files 'set:**.py - mercurial/thirdparty/** - "contrib/python-zstandard/**"' | xargs black -S # skip-blame mass-reformatting only # no-check-commit reformats foo_bar functions Differential Revision: https://phab.mercurial-scm.org/D6971
author Augie Fackler <augie@google.com>
date Sun, 06 Oct 2019 09:45:02 -0400
parents 260305e8ddbd
children 10454e788111
comparison
equal deleted inserted replaced
43075:57875cf423c9 43076:2372284d9457
10 import os 10 import os
11 import pathlib 11 import pathlib
12 import shutil 12 import shutil
13 import subprocess 13 import subprocess
14 14
15 from .py2exe import ( 15 from .py2exe import build_py2exe
16 build_py2exe, 16 from .util import find_vc_runtime_files
17 )
18 from .util import (
19 find_vc_runtime_files,
20 )
21 17
22 18
23 EXTRA_PACKAGES = { 19 EXTRA_PACKAGES = {
24 'dulwich', 20 'dulwich',
25 'keyring', 21 'keyring',
26 'pygments', 22 'pygments',
27 'win32ctypes', 23 'win32ctypes',
28 } 24 }
29 25
30 26
31 def build(source_dir: pathlib.Path, build_dir: pathlib.Path, 27 def build(
32 python_exe: pathlib.Path, iscc_exe: pathlib.Path, 28 source_dir: pathlib.Path,
33 version=None): 29 build_dir: pathlib.Path,
30 python_exe: pathlib.Path,
31 iscc_exe: pathlib.Path,
32 version=None,
33 ):
34 """Build the Inno installer. 34 """Build the Inno installer.
35 35
36 Build files will be placed in ``build_dir``. 36 Build files will be placed in ``build_dir``.
37 37
38 py2exe's setup.py doesn't use setuptools. It doesn't have modern logic 38 py2exe's setup.py doesn't use setuptools. It doesn't have modern logic
42 if not iscc_exe.exists(): 42 if not iscc_exe.exists():
43 raise Exception('%s does not exist' % iscc_exe) 43 raise Exception('%s does not exist' % iscc_exe)
44 44
45 vc_x64 = r'\x64' in os.environ.get('LIB', '') 45 vc_x64 = r'\x64' in os.environ.get('LIB', '')
46 46
47 requirements_txt = (source_dir / 'contrib' / 'packaging' / 47 requirements_txt = (
48 'inno' / 'requirements.txt') 48 source_dir / 'contrib' / 'packaging' / 'inno' / 'requirements.txt'
49 )
49 50
50 build_py2exe(source_dir, build_dir, python_exe, 'inno', 51 build_py2exe(
51 requirements_txt, extra_packages=EXTRA_PACKAGES) 52 source_dir,
53 build_dir,
54 python_exe,
55 'inno',
56 requirements_txt,
57 extra_packages=EXTRA_PACKAGES,
58 )
52 59
53 # hg.exe depends on VC9 runtime DLLs. Copy those into place. 60 # hg.exe depends on VC9 runtime DLLs. Copy those into place.
54 for f in find_vc_runtime_files(vc_x64): 61 for f in find_vc_runtime_files(vc_x64):
55 if f.name.endswith('.manifest'): 62 if f.name.endswith('.manifest'):
56 basename = 'Microsoft.VC90.CRT.manifest' 63 basename = 'Microsoft.VC90.CRT.manifest'