[Clam-devel] Re: Task Runner removed?
Hernán Ordiales
h at ordia.com.ar
Sun Aug 17 09:08:28 PDT 2008
On Sun, Aug 17, 2008 at 12:52 PM, David García Garzón
<dgarcia at iua.upf.edu> wrote:
> Py2exe is something we should aboard some time soon to enable python scripts
> execution in windows, as we need either installing Python from the Annotator
> installer or generating executables from the python scripts.
>
> There is a python script 'freeze.py' that comes with the regular python
> distribution that generates c sources that compile a python script as a
> binary application. We could try that or py2exe.
py2exe is useful to build distribution files since looks for all the
dependencies and automates the process but make an executable from a
python file is so easy like:
"main.c"
#include <stdio.h>
#include <python2.5/Python.h>
int main(int argc, char *argv[])
{
Py_SetProgramName(argv[0]);
Py_Initialize();
PySys_SetArgv(argc, argv);
FILE *f;
f = fopen("YourPythonScript.py", "r");
PyRun_SimpleFile(f, "YourPythonScript.py");
Py_Finalize();
return 0;
}
And then:
gcc main.c -o YourBinaryFile -lpython2.5
or with scons:
"SConstruct"
import os
env = Environment(ENV=os.environ)
env.Append( LIBS=['python2.5'] )
Program('main.c', LIBS=['python2.5'] )
--
Hernán
http://h.ordia.com.ar
GnuPG: 0xEE8A3FE9
More information about the clam-devel
mailing list