Show More
@@ -11,7 +11,6 b' import os' | |||
|
11 | 11 | import pathlib |
|
12 | 12 | import shutil |
|
13 | 13 | import subprocess |
|
14 | import tempfile | |
|
15 | 14 | |
|
16 | 15 | from .downloads import ( |
|
17 | 16 | download_entry, |
@@ -99,73 +98,70 b' def build(source_dir: pathlib.Path, buil' | |||
|
99 | 98 | if not py2exe_source_path.exists(): |
|
100 | 99 | extract_zip_to_directory(py2exe_pkg, build_dir) |
|
101 | 100 | |
|
102 | with tempfile.TemporaryDirectory() as td: | |
|
103 | td = pathlib.Path(td) | |
|
101 | if not venv_path.exists(): | |
|
102 | print('creating virtualenv with dependencies') | |
|
103 | subprocess.run( | |
|
104 | [str(python_exe), str(virtualenv_py), str(venv_path)], | |
|
105 | check=True) | |
|
106 | ||
|
107 | venv_python = venv_path / 'Scripts' / 'python.exe' | |
|
108 | venv_pip = venv_path / 'Scripts' / 'pip.exe' | |
|
104 | 109 | |
|
105 | if not venv_path.exists(): | |
|
106 | print('creating virtualenv with dependencies') | |
|
107 | subprocess.run( | |
|
108 | [str(python_exe), str(virtualenv_py), str(venv_path)], | |
|
109 | check=True) | |
|
110 | requirements_txt = (source_dir / 'contrib' / 'packaging' / | |
|
111 | 'inno' / 'requirements.txt') | |
|
112 | subprocess.run([str(venv_pip), 'install', '-r', str(requirements_txt)], | |
|
113 | check=True) | |
|
110 | 114 | |
|
111 | venv_python = venv_path / 'Scripts' / 'python.exe' | |
|
112 | venv_pip = venv_path / 'Scripts' / 'pip.exe' | |
|
115 | # Force distutils to use VC++ settings from environment, which was | |
|
116 | # validated above. | |
|
117 | env = dict(os.environ) | |
|
118 | env['DISTUTILS_USE_SDK'] = '1' | |
|
119 | env['MSSdk'] = '1' | |
|
113 | 120 | |
|
114 | requirements_txt = (source_dir / 'contrib' / 'packaging' / | |
|
115 | 'inno' / 'requirements.txt') | |
|
116 | subprocess.run([str(venv_pip), 'install', '-r', str(requirements_txt)], | |
|
121 | py2exe_py_path = venv_path / 'Lib' / 'site-packages' / 'py2exe' | |
|
122 | if not py2exe_py_path.exists(): | |
|
123 | print('building py2exe') | |
|
124 | subprocess.run([str(venv_python), 'setup.py', 'install'], | |
|
125 | cwd=py2exe_source_path, | |
|
126 | env=env, | |
|
117 | 127 | check=True) |
|
118 | 128 | |
|
119 | # Force distutils to use VC++ settings from environment, which was | |
|
120 | # validated above. | |
|
121 | env = dict(os.environ) | |
|
122 | env['DISTUTILS_USE_SDK'] = '1' | |
|
123 | env['MSSdk'] = '1' | |
|
129 | # Register location of msgfmt and other binaries. | |
|
130 | env['PATH'] = '%s%s%s' % ( | |
|
131 | env['PATH'], os.pathsep, str(gettext_root / 'bin')) | |
|
124 | 132 | |
|
125 | py2exe_py_path = venv_path / 'Lib' / 'site-packages' / 'py2exe' | |
|
126 | if not py2exe_py_path.exists(): | |
|
127 | print('building py2exe') | |
|
128 | subprocess.run([str(venv_python), 'setup.py', 'install'], | |
|
129 | cwd=py2exe_source_path, | |
|
130 | env=env, | |
|
131 | check=True) | |
|
133 | print('building Mercurial') | |
|
134 | subprocess.run( | |
|
135 | [str(venv_python), 'setup.py', | |
|
136 | 'py2exe', '-b', '3' if vc_x64 else '2', | |
|
137 | 'build_doc', '--html'], | |
|
138 | cwd=str(source_dir), | |
|
139 | env=env, | |
|
140 | check=True) | |
|
132 | 141 | |
|
133 | # Register location of msgfmt and other binaries. | |
|
134 | env['PATH'] = '%s%s%s' % ( | |
|
135 | env['PATH'], os.pathsep, str(gettext_root / 'bin')) | |
|
136 | ||
|
137 | print('building Mercurial') | |
|
138 | subprocess.run( | |
|
139 | [str(venv_python), 'setup.py', | |
|
140 | 'py2exe', '-b', '3' if vc_x64 else '2', | |
|
141 | 'build_doc', '--html'], | |
|
142 | cwd=str(source_dir), | |
|
143 | env=env, | |
|
144 | check=True) | |
|
142 | # hg.exe depends on VC9 runtime DLLs. Copy those into place. | |
|
143 | for f in find_vc_runtime_files(vc_x64): | |
|
144 | if f.name.endswith('.manifest'): | |
|
145 | basename = 'Microsoft.VC90.CRT.manifest' | |
|
146 | else: | |
|
147 | basename = f.name | |
|
145 | 148 | |
|
146 | # hg.exe depends on VC9 runtime DLLs. Copy those into place. | |
|
147 | for f in find_vc_runtime_files(vc_x64): | |
|
148 | if f.name.endswith('.manifest'): | |
|
149 | basename = 'Microsoft.VC90.CRT.manifest' | |
|
150 | else: | |
|
151 | basename = f.name | |
|
149 | dest_path = source_dir / 'dist' / basename | |
|
152 | 150 | |
|
153 | dest_path = source_dir / 'dist' / basename | |
|
151 | print('copying %s to %s' % (f, dest_path)) | |
|
152 | shutil.copyfile(f, dest_path) | |
|
154 | 153 | |
|
155 | print('copying %s to %s' % (f, dest_path)) | |
|
156 | shutil.copyfile(f, dest_path) | |
|
154 | print('creating installer') | |
|
155 | ||
|
156 | args = [str(iscc_exe)] | |
|
157 | 157 | |
|
158 | print('creating installer') | |
|
159 | ||
|
160 | args = [str(iscc_exe)] | |
|
161 | ||
|
162 | if vc_x64: | |
|
163 | args.append('/dARCH=x64') | |
|
158 | if vc_x64: | |
|
159 | args.append('/dARCH=x64') | |
|
164 | 160 | |
|
165 |
|
|
|
166 |
|
|
|
161 | if version: | |
|
162 | args.append('/dVERSION=%s' % version) | |
|
167 | 163 | |
|
168 |
|
|
|
169 |
|
|
|
164 | args.append('/Odist') | |
|
165 | args.append('contrib/packaging/inno/mercurial.iss') | |
|
170 | 166 | |
|
171 |
|
|
|
167 | subprocess.run(args, cwd=str(source_dir), check=True) |
General Comments 0
You need to be logged in to leave comments.
Login now