add setup_nbt.py and setupnbt64.bat. try to import _nbt without using ImportError, in case it was built using setup_nbt.py
This commit is contained in:
parent
6ba1634796
commit
3703015f86
11
nbt.py
11
nbt.py
@ -1,8 +1,13 @@
|
||||
try:
|
||||
import os
|
||||
os.environ['DISTUTILS_USE_SDK'] = "1"
|
||||
from pyximport import install; install()
|
||||
from _nbt import *
|
||||
try:
|
||||
import _nbt
|
||||
from _nbt import *
|
||||
except ImportError:
|
||||
print "Import error loading precompiled _nbt extension. Trying pyximport..."
|
||||
from pyximport import install; install()
|
||||
import _nbt
|
||||
from _nbt import *
|
||||
except ImportError, e:
|
||||
print "Import error loading _nbt extension", repr(e)
|
||||
import traceback; traceback.print_exc()
|
||||
|
12
setup_nbt.py
Normal file
12
setup_nbt.py
Normal file
@ -0,0 +1,12 @@
|
||||
|
||||
from distutils.core import setup
|
||||
from distutils.extension import Extension
|
||||
from Cython.Distutils import build_ext
|
||||
|
||||
ext_modules = [Extension("_nbt", ["_nbt.pyx"])]
|
||||
|
||||
setup(
|
||||
name = 'NBT library (Cython implementation)',
|
||||
cmdclass = {'build_ext': build_ext},
|
||||
ext_modules = ext_modules
|
||||
)
|
6
setupnbt64.bat
Normal file
6
setupnbt64.bat
Normal file
@ -0,0 +1,6 @@
|
||||
call "C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin\vcvars64.bat"
|
||||
set DISTUTILS_USE_SDK=1
|
||||
set MSSdk=1
|
||||
c:\python26-64\python setup_nbt.py build_ext
|
||||
|
||||
|
Reference in New Issue
Block a user