Show More
@@ -20,6 +20,14 b' from .util import (' | |||||
20 | ) |
|
20 | ) | |
21 |
|
21 | |||
22 |
|
22 | |||
|
23 | EXTRA_PACKAGES = { | |||
|
24 | 'dulwich', | |||
|
25 | 'keyring', | |||
|
26 | 'pygments', | |||
|
27 | 'win32ctypes', | |||
|
28 | } | |||
|
29 | ||||
|
30 | ||||
23 | def build(source_dir: pathlib.Path, build_dir: pathlib.Path, |
|
31 | def build(source_dir: pathlib.Path, build_dir: pathlib.Path, | |
24 | python_exe: pathlib.Path, iscc_exe: pathlib.Path, |
|
32 | python_exe: pathlib.Path, iscc_exe: pathlib.Path, | |
25 | version=None): |
|
33 | version=None): | |
@@ -40,7 +48,7 b' def build(source_dir: pathlib.Path, buil' | |||||
40 | 'inno' / 'requirements.txt') |
|
48 | 'inno' / 'requirements.txt') | |
41 |
|
49 | |||
42 | build_py2exe(source_dir, build_dir, python_exe, 'inno', |
|
50 | build_py2exe(source_dir, build_dir, python_exe, 'inno', | |
43 | requirements_txt) |
|
51 | requirements_txt, extra_packages=EXTRA_PACKAGES) | |
44 |
|
52 | |||
45 | # hg.exe depends on VC9 runtime DLLs. Copy those into place. |
|
53 | # hg.exe depends on VC9 runtime DLLs. Copy those into place. | |
46 | for f in find_vc_runtime_files(vc_x64): |
|
54 | for f in find_vc_runtime_files(vc_x64): |
@@ -23,7 +23,9 b' from .util import (' | |||||
23 |
|
23 | |||
24 | def build_py2exe(source_dir: pathlib.Path, build_dir: pathlib.Path, |
|
24 | def build_py2exe(source_dir: pathlib.Path, build_dir: pathlib.Path, | |
25 | python_exe: pathlib.Path, build_name: str, |
|
25 | python_exe: pathlib.Path, build_name: str, | |
26 |
venv_requirements_txt: pathlib.Path |
|
26 | venv_requirements_txt: pathlib.Path, | |
|
27 | extra_packages=None, extra_excludes=None, | |||
|
28 | extra_dll_excludes=None): | |||
27 | """Build Mercurial with py2exe. |
|
29 | """Build Mercurial with py2exe. | |
28 |
|
30 | |||
29 | Build files will be placed in ``build_dir``. |
|
31 | Build files will be placed in ``build_dir``. | |
@@ -103,6 +105,14 b' def build_py2exe(source_dir: pathlib.Pat' | |||||
103 | env['DISTUTILS_USE_SDK'] = '1' |
|
105 | env['DISTUTILS_USE_SDK'] = '1' | |
104 | env['MSSdk'] = '1' |
|
106 | env['MSSdk'] = '1' | |
105 |
|
107 | |||
|
108 | if extra_packages: | |||
|
109 | env['HG_PY2EXE_EXTRA_PACKAGES'] = ' '.join(sorted(extra_packages)) | |||
|
110 | if extra_excludes: | |||
|
111 | env['HG_PY2EXE_EXTRA_EXCLUDES'] = ' '.join(sorted(extra_excludes)) | |||
|
112 | if extra_dll_excludes: | |||
|
113 | env['HG_PY2EXE_EXTRA_DLL_EXCLUDES'] = ' '.join( | |||
|
114 | sorted(extra_dll_excludes)) | |||
|
115 | ||||
106 | py2exe_py_path = venv_path / 'Lib' / 'site-packages' / 'py2exe' |
|
116 | py2exe_py_path = venv_path / 'Lib' / 'site-packages' / 'py2exe' | |
107 | if not py2exe_py_path.exists(): |
|
117 | if not py2exe_py_path.exists(): | |
108 | print('building py2exe') |
|
118 | print('building py2exe') |
@@ -1251,6 +1251,9 b' py2exepackages = [' | |||||
1251 | 'mercurial.pure', |
|
1251 | 'mercurial.pure', | |
1252 | ] |
|
1252 | ] | |
1253 |
|
1253 | |||
|
1254 | py2exeexcludes = [] | |||
|
1255 | py2exedllexcludes = [] | |||
|
1256 | ||||
1254 | if issetuptools: |
|
1257 | if issetuptools: | |
1255 | extra['python_requires'] = supportedpy |
|
1258 | extra['python_requires'] = supportedpy | |
1256 |
|
1259 | |||
@@ -1264,33 +1267,20 b' if py2exeloaded:' | |||||
1264 | # put dlls in sub directory so that they won't pollute PATH |
|
1267 | # put dlls in sub directory so that they won't pollute PATH | |
1265 | extra['zipfile'] = 'lib/library.zip' |
|
1268 | extra['zipfile'] = 'lib/library.zip' | |
1266 |
|
1269 | |||
1267 | try: |
|
1270 | # We allow some configuration to be supplemented via environment | |
1268 | import dulwich |
|
1271 | # variables. This is better than setup.cfg files because it allows | |
1269 | dulwich.__version__ |
|
1272 | # supplementing configs instead of replacing them. | |
1270 | py2exepackages.append('dulwich') |
|
1273 | extrapackages = os.environ.get('HG_PY2EXE_EXTRA_PACKAGES') | |
1271 | except ImportError: |
|
1274 | if extrapackages: | |
1272 | pass |
|
1275 | py2exepackages.extend(extrapackages.split(' ')) | |
1273 |
|
||||
1274 | try: |
|
|||
1275 | import keyring |
|
|||
1276 | keyring.util |
|
|||
1277 | py2exepackages.append('keyring') |
|
|||
1278 | except ImportError: |
|
|||
1279 | pass |
|
|||
1280 |
|
1276 | |||
1281 | try: |
|
1277 | excludes = os.environ.get('HG_PY2EXE_EXTRA_EXCLUDES') | |
1282 | import pygments |
|
1278 | if excludes: | |
1283 | pygments.__version__ |
|
1279 | py2exeexcludes.extend(excludes.split(' ')) | |
1284 | py2exepackages.append('pygments') |
|
|||
1285 | except ImportError: |
|
|||
1286 | pass |
|
|||
1287 |
|
1280 | |||
1288 | try: |
|
1281 | dllexcludes = os.environ.get('HG_PY2EXE_EXTRA_DLL_EXCLUDES') | |
1289 | import win32ctypes |
|
1282 | if dllexcludes: | |
1290 | win32ctypes.__version__ |
|
1283 | py2exedllexcludes.extend(dllexcludes.split(' ')) | |
1291 | py2exepackages.append('win32ctypes') |
|
|||
1292 | except ImportError: |
|
|||
1293 | pass |
|
|||
1294 |
|
1284 | |||
1295 | if os.name == 'nt': |
|
1285 | if os.name == 'nt': | |
1296 | # Windows binary file versions for exe/dll files must have the |
|
1286 | # Windows binary file versions for exe/dll files must have the | |
@@ -1371,6 +1361,8 b" setup(name='mercurial'," | |||||
1371 | distclass=hgdist, |
|
1361 | distclass=hgdist, | |
1372 | options={ |
|
1362 | options={ | |
1373 | 'py2exe': { |
|
1363 | 'py2exe': { | |
|
1364 | 'dll_excludes': py2exedllexcludes, | |||
|
1365 | 'excludes': py2exeexcludes, | |||
1374 | 'packages': py2exepackages, |
|
1366 | 'packages': py2exepackages, | |
1375 | }, |
|
1367 | }, | |
1376 | 'bdist_mpkg': { |
|
1368 | 'bdist_mpkg': { |
General Comments 0
You need to be logged in to leave comments.
Login now