This commit is contained in:
Irony 2018-05-06 02:33:38 +08:00
parent a96ab06e31
commit 0bdd1b5a33
9 changed files with 37 additions and 0 deletions

View file

@ -0,0 +1,5 @@
cd %~dp0
python setup.py build
pause

View file

@ -0,0 +1,8 @@
from distutils.core import setup, Extension
module = Extension('pydext', sources = ['pydext.c'])
setup (name = 'pydext',
version = '1.0.0',
description = 'This is pydext',
ext_modules = [module])

View file

@ -0,0 +1,22 @@
import sys
sys.path.insert(0,
'./build/lib.{0}-{1}.{2}'.format(sys.platform, sys.version_info.major, sys.version_info.minor))
import pydext
print(pydext)
print(dir(pydext))
print(pydext.__author__)
print(pydext.__mail__)
print(pydext.hello())
print(pydext.hello2('Irony'))
print(pydext.sum(1, 5))
# 结果变负数
print(pydext.sum(1, 5, minus=True))

View file

@ -0,0 +1 @@
该目录下的setup.py是在vs编译环境的cmd下调用build.bat进行编译生成build文件夹。然后执行python test.py 对build文件夹中的pyd进行测试

View file

@ -0,0 +1 @@
该目录的test.py是用vs打开pydext.sln编译后生成的Release文件夹里的pyd进行测试