diff --git a/setup.py b/setup.py index e1b7899..a7ed278 100644 --- a/setup.py +++ b/setup.py @@ -279,17 +279,19 @@ def run(self): _pari_c = os.path.join('cypari', '_pari.c') cythonize([_pari_pyx], compiler_directives={'language_level':2}) - with open('_pari.c', 'w') as outfile: - with open(_pari_c) as infile: - for line in infile.readlines(): - if line.find('pycore') >= 0: - outfile.write( - ' #undef long\n%s' - ' #define long long long\n' %line) - else: - outfile.write(line) - os.unlink(_pari_c) - os.rename('_pari.c', _pari_c) + if sys.platform == 'win32': + # patch _pari.c to deal with #define long long long + with open('_pari.c', 'w') as outfile: + with open(_pari_c) as infile: + for line in infile.readlines(): + if line.find('pycore') >= 0: + outfile.write( + ' #undef long\n%s' + ' #define long long long\n' %line) + else: + outfile.write(line) + os.unlink(_pari_c) + os.rename('_pari.c', _pari_c) build_ext.run(self) class CyPariSourceDist(sdist):