##// END OF EJS Templates
widening: duplicate generateellipsesbundle2() for widening...
widening: duplicate generateellipsesbundle2() for widening The widening and the non-widening code are quite different. It will be clearer to have them as sepearate functions. To start with, I've just copied it exactly, so it's clearer over the next few patches how they're different. The new function should gradually become more similar to bundle2.widen_bundle(), and should perhaps eventually be merged with that function. However, I've left it in narrowbundle2.py for now since it still depends on constants like _KILLNODESIGNAL there. Differential Revision: https://phab.mercurial-scm.org/D7092

File last commit:

r43346:2372284d default
r43517:db07f7fb default
Show More
inno.py
85 lines | 2.0 KiB | text/x-python | PythonLexer
Gregory Szorc
packaging: move Inno Setup core logic into a module...
r42077 # inno.py - Inno Setup functionality.
#
# Copyright 2019 Gregory Szorc <gregory.szorc@gmail.com>
#
# This software may be used and distributed according to the terms of the
# GNU General Public License version 2 or any later version.
# no-check-code because Python 3 native.
import os
import pathlib
import shutil
import subprocess
Augie Fackler
formatting: blacken the codebase...
r43346 from .py2exe import build_py2exe
from .util import find_vc_runtime_files
Gregory Szorc
packaging: move Inno Setup core logic into a module...
r42077
Gregory Szorc
setup: configure py2exe config via environment variables...
r42082 EXTRA_PACKAGES = {
'dulwich',
'keyring',
'pygments',
'win32ctypes',
}
Augie Fackler
formatting: blacken the codebase...
r43346 def build(
source_dir: pathlib.Path,
build_dir: pathlib.Path,
python_exe: pathlib.Path,
iscc_exe: pathlib.Path,
version=None,
):
Gregory Szorc
packaging: move Inno Setup core logic into a module...
r42077 """Build the Inno installer.
Build files will be placed in ``build_dir``.
py2exe's setup.py doesn't use setuptools. It doesn't have modern logic
for finding the Python 2.7 toolchain. So, we require the environment
to already be configured with an active toolchain.
"""
if not iscc_exe.exists():
raise Exception('%s does not exist' % iscc_exe)
Gregory Szorc
packaging: extract py2exe functionality to own module...
r42081 vc_x64 = r'\x64' in os.environ.get('LIB', '')
Gregory Szorc
packaging: move Inno Setup core logic into a module...
r42077
Augie Fackler
formatting: blacken the codebase...
r43346 requirements_txt = (
source_dir / 'contrib' / 'packaging' / 'inno' / 'requirements.txt'
)
Gregory Szorc
packaging: move Inno Setup core logic into a module...
r42077
Augie Fackler
formatting: blacken the codebase...
r43346 build_py2exe(
source_dir,
build_dir,
python_exe,
'inno',
requirements_txt,
extra_packages=EXTRA_PACKAGES,
)
Gregory Szorc
packaging: move Inno Setup core logic into a module...
r42077
Gregory Szorc
packaging: don't use temporary directory...
r42079 # hg.exe depends on VC9 runtime DLLs. Copy those into place.
for f in find_vc_runtime_files(vc_x64):
if f.name.endswith('.manifest'):
basename = 'Microsoft.VC90.CRT.manifest'
else:
basename = f.name
Gregory Szorc
packaging: move Inno Setup core logic into a module...
r42077
Gregory Szorc
packaging: don't use temporary directory...
r42079 dest_path = source_dir / 'dist' / basename
Gregory Szorc
packaging: move Inno Setup core logic into a module...
r42077
Gregory Szorc
packaging: don't use temporary directory...
r42079 print('copying %s to %s' % (f, dest_path))
shutil.copyfile(f, dest_path)
Gregory Szorc
packaging: move Inno Setup core logic into a module...
r42077
Gregory Szorc
packaging: don't use temporary directory...
r42079 print('creating installer')
args = [str(iscc_exe)]
Gregory Szorc
packaging: move Inno Setup core logic into a module...
r42077
Gregory Szorc
packaging: don't use temporary directory...
r42079 if vc_x64:
args.append('/dARCH=x64')
Gregory Szorc
packaging: move Inno Setup core logic into a module...
r42077
Gregory Szorc
packaging: don't use temporary directory...
r42079 if version:
args.append('/dVERSION=%s' % version)
Gregory Szorc
packaging: move Inno Setup core logic into a module...
r42077
Gregory Szorc
packaging: don't use temporary directory...
r42079 args.append('/Odist')
args.append('contrib/packaging/inno/mercurial.iss')
Gregory Szorc
packaging: move Inno Setup core logic into a module...
r42077
Gregory Szorc
packaging: don't use temporary directory...
r42079 subprocess.run(args, cwd=str(source_dir), check=True)