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