summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorJulian Andres Klode <jak@debian.org>2010-01-15 18:12:08 +0100
committerJulian Andres Klode <jak@debian.org>2010-01-15 18:12:08 +0100
commit06491fbbca339a0590ae963c69d2a78e06c0cb0a (patch)
treeaf960dc524a82097ed3eb45dc20c05bf5d3ffdd9 /python
parentb76e901886d37d0eee8d554a5d977cedd134d353 (diff)
downloadpython-apt-06491fbbca339a0590ae963c69d2a78e06c0cb0a.tar.gz
python/indexrecords.cc,python/policy.cc: Rename functions.
Diffstat (limited to 'python')
-rw-r--r--python/indexrecords.cc26
-rw-r--r--python/policy.cc56
2 files changed, 41 insertions, 41 deletions
diff --git a/python/indexrecords.cc b/python/indexrecords.cc
index 9ab052f6..2d21362d 100644
--- a/python/indexrecords.cc
+++ b/python/indexrecords.cc
@@ -23,7 +23,7 @@
#include "generic.h"
#include <apt-pkg/indexrecords.h>
-static PyObject *IndexRecords_NEW(PyTypeObject *type,PyObject *Args,
+static PyObject *indexrecords_new(PyTypeObject *type,PyObject *Args,
PyObject *kwds)
{
char * kwlist[] = {NULL};
@@ -35,7 +35,7 @@ static PyObject *IndexRecords_NEW(PyTypeObject *type,PyObject *Args,
return New;
}
-static PyObject *IndexRecords_Load(PyObject *self,PyObject *args)
+static PyObject *indexrecords_load(PyObject *self,PyObject *args)
{
const char *filename;
if (PyArg_ParseTuple(args, "s", &filename) == 0)
@@ -44,10 +44,10 @@ static PyObject *IndexRecords_Load(PyObject *self,PyObject *args)
return HandleErrors(Py_BuildValue("i", records->Load(filename)));
}
-static char *IndexRecords_Lookup_doc = "lookup(metakey)\n\n"
+static char *indexrecords_lookup_doc = "lookup(metakey)\n\n"
"Lookup the filename given by metakey, return a tuple (hash, size).\n"
"The hash part is a HashString() object.";
-static PyObject *IndexRecords_Lookup(PyObject *self,PyObject *args)
+static PyObject *indexrecords_lookup(PyObject *self,PyObject *args)
{
const char *keyname;
if (PyArg_ParseTuple(args, "s", &keyname) == 0)
@@ -66,22 +66,22 @@ static PyObject *IndexRecords_Lookup(PyObject *self,PyObject *args)
return value;
}
-static PyObject *IndexRecords_GetDist(PyObject *self)
+static PyObject *indexrecords_get_dist(PyObject *self)
{
indexRecords *records = GetCpp<indexRecords*>(self);
return HandleErrors(PyString_FromString(records->GetDist().c_str()));
}
-static PyMethodDef IndexRecords_Methods[] = {
- {"load",IndexRecords_Load,METH_VARARGS,
+static PyMethodDef indexrecords_methods[] = {
+ {"load",indexrecords_load,METH_VARARGS,
"load(filename: str)\n\nLoad the file given by filename."},
- {"get_dist",(PyCFunction)IndexRecords_GetDist,METH_NOARGS,
+ {"get_dist",(PyCFunction)indexrecords_get_dist,METH_NOARGS,
"get_dist() -> str\n\nReturn a distribution set in the release file."},
- {"lookup",IndexRecords_Lookup,METH_VARARGS,IndexRecords_Lookup_doc},
+ {"lookup",indexrecords_lookup,METH_VARARGS,indexrecords_lookup_doc},
{}
};
-static char *IndexRecords_doc = "IndexRecords()\n\n"
+static char *indexrecords_doc = "IndexRecords()\n\n"
"Representation of a release file.";
PyTypeObject PyIndexRecords_Type = {
PyVarObject_HEAD_INIT(&PyType_Type, 0)
@@ -106,14 +106,14 @@ PyTypeObject PyIndexRecords_Type = {
0, // tp_as_buffer
(Py_TPFLAGS_DEFAULT | // tp_flags
Py_TPFLAGS_BASETYPE),
- IndexRecords_doc, // tp_doc
+ indexrecords_doc, // tp_doc
0, // tp_traverse
0, // tp_clear
0, // tp_richcompare
0, // tp_weaklistoffset
0, // tp_iter
0, // tp_iternext
- IndexRecords_Methods, // tp_methods
+ indexrecords_methods, // tp_methods
0, // tp_members
0, // tp_getset
0, // tp_base
@@ -123,5 +123,5 @@ PyTypeObject PyIndexRecords_Type = {
0, // tp_dictoffset
0, // tp_init
0, // tp_alloc
- IndexRecords_NEW, // tp_new
+ indexrecords_new, // tp_new
};
diff --git a/python/policy.cc b/python/policy.cc
index faf53b38..80670267 100644
--- a/python/policy.cc
+++ b/python/policy.cc
@@ -23,7 +23,7 @@
#include "generic.h"
#include <apt-pkg/policy.h>
-static PyObject *Policy_NEW(PyTypeObject *type,PyObject *Args,
+static PyObject *policy_new(PyTypeObject *type,PyObject *Args,
PyObject *kwds) {
PyObject *cache;
char *kwlist[] = {"cache", NULL};
@@ -37,11 +37,11 @@ static PyObject *Policy_NEW(PyTypeObject *type,PyObject *Args,
return CppOwnedPyObject_NEW<pkgPolicy*>(cache,&PyPolicy_Type,policy);
}
-static char *Policy_GetPriority_doc = "get_priority(package: apt_pkg.Package)"
+static char *policy_get_priority_doc = "get_priority(package: apt_pkg.Package)"
" -> int\n\n"
"Return the priority of the package.";
-PyObject *Policy_GetPriority(PyObject *self, PyObject *arg) {
+PyObject *policy_get_priority(PyObject *self, PyObject *arg) {
pkgPolicy *policy = GetCpp<pkgPolicy *>(self);
if (PyObject_TypeCheck(arg, &PyPackage_Type)) {
pkgCache::PkgIterator pkg = GetCpp<pkgCache::PkgIterator>(arg);
@@ -52,11 +52,11 @@ PyObject *Policy_GetPriority(PyObject *self, PyObject *arg) {
}
}
-static char *Policy_GetCandidateVer_doc = "get_match(package: apt_pkg.Package)"
+static char *policy_get_candidate_ver_doc = "get_match(package: apt_pkg.Package)"
" -> apt_pkg.Version\n\n"
"Get the best package for the job.";
-PyObject *Policy_GetCandidateVer(PyObject *self, PyObject *arg) {
+PyObject *policy_get_candidate_ver(PyObject *self, PyObject *arg) {
if (PyObject_TypeCheck(arg, &PyPackage_Type)) {
pkgPolicy *policy = GetCpp<pkgPolicy *>(self);
pkgCache::PkgIterator pkg = GetCpp<pkgCache::PkgIterator>(arg);
@@ -69,11 +69,11 @@ PyObject *Policy_GetCandidateVer(PyObject *self, PyObject *arg) {
}
}
-static char *Policy_GetMatch_doc = "get_match(package: apt_pkg.Package) -> "
+static char *policy_get_match_doc = "get_match(package: apt_pkg.Package) -> "
"apt_pkg.Version\n\n"
"Return a matching version for the given package.";
-static PyObject *Policy_GetMatch(PyObject *self, PyObject *arg) {
+static PyObject *policy_get_match(PyObject *self, PyObject *arg) {
if (PyObject_TypeCheck(arg, &PyPackage_Type) == 0) {
PyErr_SetString(PyExc_TypeError,"Argument must be of Package().");
return 0;
@@ -84,11 +84,11 @@ static PyObject *Policy_GetMatch(PyObject *self, PyObject *arg) {
return CppOwnedPyObject_NEW<pkgCache::VerIterator>(arg,&PyVersion_Type,ver);
}
-static char *Policy_ReadPinFile_doc = "read_pinfile(filename: str) -> bool\n\n"
+static char *policy_read_pinfile_doc = "read_pinfile(filename: str) -> bool\n\n"
"Read the pin file given by filename (e.g. '/etc/apt/preferences') and\n"
"add it to the policy.";
-static PyObject *Policy_ReadPinFile(PyObject *self, PyObject *arg) {
+static PyObject *policy_read_pinfile(PyObject *self, PyObject *arg) {
if (!PyString_Check(arg))
return 0;
pkgPolicy *policy = GetCpp<pkgPolicy *>(self);
@@ -97,11 +97,11 @@ static PyObject *Policy_ReadPinFile(PyObject *self, PyObject *arg) {
}
#if (APT_PKG_MAJOR >= 4 && APT_PKG_MINOR >= 8)
-static char *Policy_ReadPinDir_doc = "read_pindir(dirname: str) -> bool\n\n"
+static char *policy_read_pindir_doc = "read_pindir(dirname: str) -> bool\n\n"
"Read the pin files in the given dir (e.g. '/etc/apt/preferences.d') and\n"
"add them to the policy.";
-static PyObject *Policy_ReadPinDir(PyObject *self, PyObject *arg) {
+static PyObject *policy_read_pindir(PyObject *self, PyObject *arg) {
if (!PyString_Check(arg))
return 0;
pkgPolicy *policy = GetCpp<pkgPolicy *>(self);
@@ -110,7 +110,7 @@ static PyObject *Policy_ReadPinDir(PyObject *self, PyObject *arg) {
}
#endif
-static char *Policy_CreatePin_doc = "create_pin(type: str, pkg: str, "
+static char *policy_create_pin_doc = "create_pin(type: str, pkg: str, "
"data: str, priority: int)\n\n"
"Create a pin for the policy. The parameter 'type' refers to one of the\n"
"following strings: 'Version', 'Release', 'Origin'. The argument 'pkg'\n"
@@ -118,7 +118,7 @@ static char *Policy_CreatePin_doc = "create_pin(type: str, pkg: str, "
"e.g. unstable for type='Release' and the other possible options. \n"
"The parameter 'priority' gives the priority of the pin.";
-static PyObject *Policy_CreatePin(PyObject *self, PyObject *args) {
+static PyObject *policy_create_pin(PyObject *self, PyObject *args) {
pkgVersionMatch::MatchType match_type;
const char *type, *pkg, *data;
signed short priority;
@@ -138,23 +138,23 @@ static PyObject *Policy_CreatePin(PyObject *self, PyObject *args) {
Py_RETURN_NONE;
}
-static PyMethodDef Policy_Methods[] = {
- {"get_priority",(PyCFunction)Policy_GetPriority,METH_O,
- Policy_GetPriority_doc},
- {"get_candidate_ver",(PyCFunction)Policy_GetCandidateVer,METH_O,
- Policy_GetCandidateVer_doc},
- {"read_pinfile",(PyCFunction)Policy_ReadPinFile,METH_O,
- Policy_ReadPinFile_doc},
+static PyMethodDef policy_methods[] = {
+ {"get_priority",(PyCFunction)policy_get_priority,METH_O,
+ policy_get_priority_doc},
+ {"get_candidate_ver",(PyCFunction)policy_get_candidate_ver,METH_O,
+ policy_get_candidate_ver_doc},
+ {"read_pinfile",(PyCFunction)policy_read_pinfile,METH_O,
+ policy_read_pinfile_doc},
#if (APT_PKG_MAJOR >= 4 && APT_PKG_MINOR >= 8)
- {"read_pindir",(PyCFunction)Policy_ReadPinDir,METH_O,
- Policy_ReadPinFile_doc},
+ {"read_pindir",(PyCFunction)policy_read_pindir,METH_O,
+ policy_read_pindir_doc},
#endif
- {"create_pin",Policy_CreatePin,METH_VARARGS,Policy_CreatePin_doc},
- {"get_match",(PyCFunction)Policy_GetMatch,METH_O, Policy_GetMatch_doc},
+ {"create_pin",policy_create_pin,METH_VARARGS,policy_create_pin_doc},
+ {"get_match",(PyCFunction)policy_get_match,METH_O, policy_get_match_doc},
{}
};
-static char *Policy_doc = "Policy(cache)\n\n"
+static char *policy_doc = "Policy(cache)\n\n"
"Representation of the policy of the Cache object given by cache. This\n"
"provides a superset of policy-related functionality compared to the\n"
"DepCache class. The DepCache can be used for most purposes, but there\n"
@@ -184,14 +184,14 @@ PyTypeObject PyPolicy_Type = {
(Py_TPFLAGS_DEFAULT | // tp_flags
Py_TPFLAGS_BASETYPE |
Py_TPFLAGS_HAVE_GC),
- Policy_doc, // tp_doc
+ policy_doc, // tp_doc
CppOwnedTraverse<pkgPolicy*>, // tp_traverse
CppOwnedClear<pkgPolicy*>, // tp_clear
0, // tp_richcompare
0, // tp_weaklistoffset
0, // tp_iter
0, // tp_iternext
- Policy_Methods, // tp_methods
+ policy_methods, // tp_methods
0, // tp_members
0, // tp_getset
0, // tp_base
@@ -201,5 +201,5 @@ PyTypeObject PyPolicy_Type = {
0, // tp_dictoffset
0, // tp_init
0, // tp_alloc
- Policy_NEW, // tp_new
+ policy_new, // tp_new
};