I'm having a hard time finding py2exe recipes, especially for cases that require c extensions.
The following recipe works fine without the "ext_modules" part. With it I get "NameError: name 'Extension' is not defined.
from distutils.core import setup
import py2exe
import matplotlib
import os
s = os.popen('svnversion')
version = s.read()
f = open('cpa_version.py', 'w')
f.write('VERSION = "%s"\n'%(version.strip()))
f.close()
setup(console=['cpa.py'],
options={
'py2exe': {
'packages' : ['matplotlib', 'pytz', 'MySQLdb', 'pysqlite2'],
'includes' : ['PILfix', 'version'],
"excludes" : ['_gtkagg', '_tkagg',
"Tkconstants","Tkinter","tcl"],
"dll_excludes": ['libgdk-win32-2.0-0.dll',
'libgobject-2.0-0.dll',
'libgdk_pixbuf-2.0-0.dll',
'tcl84.dll', 'tk84.dll']
}
},
data_files=matplotlib.get_py2exe_datafiles(),
# how to build _classifier.c???
ext_modules = [Extension('_classifier',
sources = ['_classifier.c'],
include_dirs=[numpy.get_include()],
libraries = ['sqlite3'])]
)
_classifier.c includes the following
#include "sqlite3.h"
#include "Python.h"
#include "numpy/arrayobject.h"
#include <stdio.h>
any help would be greatly appreciated.