rpm  5.4.14
Macros | Functions | Variables
rpmpython.c File Reference
#include "system.h"
#include <rpmiotypes.h>
#include <rpmmacro.h>
#include <argv.h>
#include "rpmpython.h"
#include "debug.h"
Include dependency graph for rpmpython.c:

Go to the source code of this file.

Macros

#define _RPMIOB_INTERNAL   /* XXX necessary? */
 
#define _RPMPYTHON_INTERNAL
 

Functions

static void rpmpythonFini (void *_python)
 
static rpmpython rpmpythonGetPool (rpmioPool pool)
 
static rpmpython rpmpythonI (void)
 
rpmpython rpmpythonNew (char **av, uint32_t flags)
 Create and load a python interpreter. More...
 
rpmRC rpmpythonRunFile (rpmpython python, const char *fn, const char **resultp)
 Execute python from a file. More...
 
static const char * rpmpythonSlurp (const char *arg)
 
rpmRC rpmpythonRun (rpmpython python, const char *str, const char **resultp)
 Execute python string. More...
 

Variables

int _rpmpython_debug = 0
 
rpmpython _rpmpythonI = NULL
 
rpmioPool _rpmpythonPool
 

Macro Definition Documentation

#define _RPMIOB_INTERNAL   /* XXX necessary? */

Definition at line 3 of file rpmpython.c.

#define _RPMPYTHON_INTERNAL

Definition at line 8 of file rpmpython.c.

Function Documentation

static void rpmpythonFini ( void _python)
static

Definition at line 24 of file rpmpython.c.

References NULL.

Referenced by rpmpythonGetPool().

static rpmpython rpmpythonGetPool ( rpmioPool  pool)
static

Definition at line 39 of file rpmpython.c.

References _rpmpython_debug, _rpmpythonPool, NULL, rpmioGetPool(), rpmioNewPool(), and rpmpythonFini().

Referenced by rpmpythonNew().

static rpmpython rpmpythonI ( void  )
static

Definition at line 62 of file rpmpython.c.

References _rpmpythonI, NULL, and rpmpythonNew().

Referenced by rpmpythonNew(), rpmpythonRun(), and rpmpythonRunFile().

rpmpython rpmpythonNew ( char **  av,
uint32_t  flags 
)

Create and load a python interpreter.

Parameters
fnpython interpreter args (or NULL)
flagspython interpreter flags ((1<<31): use global interpreter)
Returns
new python interpreter

Definition at line 71 of file rpmpython.c.

References _free(), _rpmpython_debug, _rpmpythonI, ac, argvCount(), av, fprintf(), NULL, rpmExpand(), rpmpythonGetPool(), rpmpythonI(), rpmpythonLink(), rpmpythonRun(), s, and void.

Referenced by rpmpythonI(), and while().

rpmRC rpmpythonRun ( rpmpython  python,
const char *  str,
const char **  resultp 
)

Execute python string.

Parameters
pythonpython interpreter (NULL uses global interpreter)
strpython string to execute (NULL returns RPMRC_FAIL)
*resultppython exec result
Returns
RPMRC_OK on success

Definition at line 158 of file rpmpython.c.

References _free(), _rpmpython_debug, cf, fprintf(), m, NULL, o, Py_XDECREF(), rc, rpmpythonI(), rpmpythonSlurp(), RPMRC_FAIL, RPMRC_OK, and val.

Referenced by rpmpythonNew(), and while().

rpmRC rpmpythonRunFile ( rpmpython  python,
const char *  fn,
const char **  resultp 
)

Execute python from a file.

Parameters
pythonpython interpreter (NULL uses global interpreter)
fnpython file to run (NULL returns RPMRC_FAIL)
*resultppython exec result
Returns
RPMRC_OK on success

Definition at line 109 of file rpmpython.c.

References _rpmpython_debug, cf, fprintf(), NULL, rc, rpmpythonI(), RPMRC_FAIL, RPMRC_OK, and strcmp().

static const char* rpmpythonSlurp ( const char *  arg)
static

Definition at line 134 of file rpmpython.c.

References NULL, rpmiobAppend(), rpmiobFree(), rpmiobNew(), rpmiobSlurp(), rpmiobStr(), Stat(), strcmp(), val, xstrdup(), and xx.

Referenced by rpmpythonRun().

Variable Documentation

int _rpmpython_debug = 0

Definition at line 19 of file rpmpython.c.

Referenced by rpmpythonGetPool(), rpmpythonNew(), rpmpythonRun(), and rpmpythonRunFile().

rpmpython _rpmpythonI = NULL

Definition at line 22 of file rpmpython.c.

Referenced by rpmioClean(), rpmpythonI(), and rpmpythonNew().

rpmioPool _rpmpythonPool

Definition at line 37 of file rpmpython.c.

Referenced by rpmioClean(), and rpmpythonGetPool().