Show More
@@ -30,8 +30,10 b' import os, time' | |||
|
30 | 30 | import shutil |
|
31 | 31 | import tempfile |
|
32 | 32 | from distutils.core import setup, Extension |
|
33 | from distutils.dist import Distribution | |
|
33 | 34 | from distutils.command.install_data import install_data |
|
34 | 35 | from distutils.command.build import build |
|
36 | from distutils.command.build_py import build_py | |
|
35 | 37 | from distutils.spawn import spawn, find_executable |
|
36 | 38 | from distutils.ccompiler import new_compiler |
|
37 | 39 | |
@@ -157,8 +159,35 b' class build_mo(build):' | |||
|
157 | 159 | |
|
158 | 160 | build.sub_commands.append(('build_mo', None)) |
|
159 | 161 | |
|
162 | Distribution.pure = 0 | |
|
163 | Distribution.global_options.append(('pure', None, "use pure (slow) Python " | |
|
164 | "code instead of C extensions")) | |
|
165 | ||
|
166 | class hg_build_py(build_py): | |
|
167 | ||
|
168 | def finalize_options(self): | |
|
169 | build_py.finalize_options(self) | |
|
170 | ||
|
171 | if self.distribution.pure: | |
|
172 | if self.py_modules is None: | |
|
173 | self.py_modules = [] | |
|
174 | for ext in self.distribution.ext_modules: | |
|
175 | if ext.name.startswith("mercurial."): | |
|
176 | self.py_modules.append("mercurial.pure.%s" % ext.name[10:]) | |
|
177 | self.distribution.ext_modules = [] | |
|
178 | ||
|
179 | def find_modules(self): | |
|
180 | modules = build_py.find_modules(self) | |
|
181 | for module in modules: | |
|
182 | if module[0] == "mercurial.pure": | |
|
183 | if module[1] != "__init__": | |
|
184 | yield ("mercurial", module[1], module[2]) | |
|
185 | else: | |
|
186 | yield module | |
|
187 | ||
|
160 | 188 | cmdclass = {'install_data': install_package_data, |
|
161 |
'build_mo': build_mo |
|
|
189 | 'build_mo': build_mo, | |
|
190 | 'build_py': hg_build_py} | |
|
162 | 191 | |
|
163 | 192 | ext_modules=[ |
|
164 | 193 | Extension('mercurial.base85', ['mercurial/base85.c']), |
General Comments 0
You need to be logged in to leave comments.
Login now