##// END OF EJS Templates
style: run a patched black on a subset of mercurial...
style: run a patched black on a subset of mercurial This applied black to the 20 smallest files in mercurial/: ls -S1 mercurial/*.py | tail -n20 | xargs black --skip-string-normalization Note that a few files failed to format, presumably due to a bug in my patch. The intent is to be able to compare results to D5064 with https://github.com/python/black/pull/826 applied to black. I skipped string normalization on this patch for clarity - in reality I think we'd want one pass without string normalization, followed by another to normalize strings (which is basically replacing ' with " globally.) # skip-blame mass-reformatting only Differential Revision: https://phab.mercurial-scm.org/D6342

File last commit:

r42082:260305e8 default
r43345:57875cf4 default
Show More
inno.py
78 lines | 2.0 KiB | text/x-python | PythonLexer
# 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
from .py2exe import (
build_py2exe,
)
from .util import (
find_vc_runtime_files,
)
EXTRA_PACKAGES = {
'dulwich',
'keyring',
'pygments',
'win32ctypes',
}
def build(source_dir: pathlib.Path, build_dir: pathlib.Path,
python_exe: pathlib.Path, iscc_exe: pathlib.Path,
version=None):
"""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)
vc_x64 = r'\x64' in os.environ.get('LIB', '')
requirements_txt = (source_dir / 'contrib' / 'packaging' /
'inno' / 'requirements.txt')
build_py2exe(source_dir, build_dir, python_exe, 'inno',
requirements_txt, extra_packages=EXTRA_PACKAGES)
# 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
dest_path = source_dir / 'dist' / basename
print('copying %s to %s' % (f, dest_path))
shutil.copyfile(f, dest_path)
print('creating installer')
args = [str(iscc_exe)]
if vc_x64:
args.append('/dARCH=x64')
if version:
args.append('/dVERSION=%s' % version)
args.append('/Odist')
args.append('contrib/packaging/inno/mercurial.iss')
subprocess.run(args, cwd=str(source_dir), check=True)