Show More
@@ -94,17 +94,13 if os.name == 'nt': | |||
|
94 | 94 | # We remove hg.bat if we are able to build hg.exe. |
|
95 | 95 | scripts.append('contrib/win32/hg.bat') |
|
96 | 96 | |
|
97 | # simplified version of distutils.ccompiler.CCompiler.has_function | |
|
98 | # that actually removes its temporary files. | |
|
99 | def hasfunction(cc, funcname): | |
|
97 | def cancompile(cc, code): | |
|
100 | 98 | tmpdir = tempfile.mkdtemp(prefix='hg-install-') |
|
101 | 99 | devnull = oldstderr = None |
|
102 | 100 | try: |
|
103 |
fname = os.path.join(tmpdir, ' |
|
|
101 | fname = os.path.join(tmpdir, 'testcomp.c') | |
|
104 | 102 | f = open(fname, 'w') |
|
105 |
f.write( |
|
|
106 | f.write(' %s();\n' % funcname) | |
|
107 | f.write('}\n') | |
|
103 | f.write(code) | |
|
108 | 104 | f.close() |
|
109 | 105 | # Redirect stderr to /dev/null to hide any error messages |
|
110 | 106 | # from the compiler. |
@@ -125,6 +121,12 def hasfunction(cc, funcname): | |||
|
125 | 121 | devnull.close() |
|
126 | 122 | shutil.rmtree(tmpdir) |
|
127 | 123 | |
|
124 | # simplified version of distutils.ccompiler.CCompiler.has_function | |
|
125 | # that actually removes its temporary files. | |
|
126 | def hasfunction(cc, funcname): | |
|
127 | code = 'int main(void) { %s(); }\n' % funcname | |
|
128 | return cancompile(cc, code) | |
|
129 | ||
|
128 | 130 | # py2exe needs to be installed to work |
|
129 | 131 | try: |
|
130 | 132 | import py2exe |
General Comments 0
You need to be logged in to leave comments.
Login now