Skip to content

Commit 113169e

Browse files
committed
Refactor Windows build
Don't bundle assembled files, do it at build time.
1 parent f5d56d2 commit 113169e

File tree

4 files changed

+19
-15
lines changed

4 files changed

+19
-15
lines changed

setup.py

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,32 @@
33
from setuptools import setup, Extension
44

55
import glob
6+
import os
67
import re
78
import sys
89

910

1011
if hasattr(sys, 'pypy_version_info'):
1112
ext_modules = []
1213
else:
13-
if sys.platform == 'win32' and '32 bit' in sys.version:
14-
extra_objects = ['src/switch_x86_msvc.obj']
15-
elif sys.platform == 'win32' and '64 bit' in sys.version:
16-
extra_objects = ['src/switch_x64_msvc.obj']
17-
else:
18-
extra_objects = []
14+
extra_objects = []
15+
if sys.platform == 'win32':
16+
# This is a hack because msvc9compiler doesn't support asm files
17+
# http://bugs.python.org/issue7546
18+
19+
# Initialize compiler
20+
from distutils.msvc9compiler import MSVCCompiler
21+
cc = MSVCCompiler()
22+
cc.initialize()
23+
del cc
24+
25+
if '32 bit' in sys.version:
26+
extra_objects = ['src/switch_x86_msvc.obj']
27+
os.system('ml /nologo /c /Fo src\switch_x86_msvc.obj src\switch_x86_msvc.asm')
28+
else:
29+
extra_objects = ['src/switch_x64_msvc.obj']
30+
os.system('ml64 /nologo /c /Fo src\switch_x64_msvc.obj src\switch_x64_msvc.asm')
31+
1932
ext_modules = [Extension('fibers._cfibers',
2033
sources = glob.glob('src/*.c'),
2134
extra_objects=extra_objects,

src/switch_x64_msvc.obj

-1.03 KB
Binary file not shown.

src/switch_x86_msvc.obj

-486 Bytes
Binary file not shown.

windows.txt

Lines changed: 0 additions & 9 deletions
This file was deleted.

0 commit comments

Comments
 (0)