diff options
| author | Julian Andres Klode <jak@debian.org> | 2009-06-03 17:27:33 +0200 |
|---|---|---|
| committer | Julian Andres Klode <jak@debian.org> | 2009-06-03 17:27:33 +0200 |
| commit | 7051066cf258caa2a3fd45271faa3d46b8a6d98a (patch) | |
| tree | 45efe66d83002d258e739214050a262c75e672cd /python | |
| parent | 7d6f85c475d5f50e0c54814cd8b644e38147b282 (diff) | |
| download | python-apt-7051066cf258caa2a3fd45271faa3d46b8a6d98a.tar.gz | |
python/: Convert most names to PEP8 naming conventions (except Version,PackageFile,MetaIndex).
On our way to close Bug#481061, this converts almost all names to PEP 8 naming
conventions. Missing are now apt_pkg.Version, apt_pkg.PackageFile, apt_pkg.MetaIndex
and apt.progress.*.
In case of the missing apt_pkg classes, they are not converted yet because they
do not use getset descriptors yet.
apt.progress.* has not been converted yet because the extension interacts with it,
and we first need to modify the extension to recognize the new names, as well as
the old names (old applications shouldn't break).
Diffstat (limited to 'python')
| -rw-r--r-- | python/acquire.cc | 29 | ||||
| -rw-r--r-- | python/apt_instmodule.cc | 21 | ||||
| -rw-r--r-- | python/apt_pkgmodule.cc | 94 | ||||
| -rw-r--r-- | python/cache.cc | 49 | ||||
| -rw-r--r-- | python/cdrom.cc | 4 | ||||
| -rw-r--r-- | python/configuration.cc | 21 | ||||
| -rw-r--r-- | python/depcache.cc | 57 | ||||
| -rw-r--r-- | python/indexfile.cc | 11 | ||||
| -rw-r--r-- | python/pkgmanager.cc | 10 | ||||
| -rw-r--r-- | python/pkgrecords.cc | 17 | ||||
| -rw-r--r-- | python/pkgsrcrecords.cc | 15 | ||||
| -rw-r--r-- | python/sourcelist.cc | 8 | ||||
| -rw-r--r-- | python/tag.cc | 15 |
13 files changed, 329 insertions, 22 deletions
diff --git a/python/acquire.cc b/python/acquire.cc index ccd3a479..6cb2130c 100644 --- a/python/acquire.cc +++ b/python/acquire.cc @@ -38,6 +38,21 @@ MkGet(AcquireItemGetStatAuthError,Py_BuildValue("i", pkgAcquire::Item::StatAuthE #undef MkGet static PyGetSetDef AcquireItemGetSet[] = { + {"complete",AcquireItemGetComplete}, + {"descuri",AcquireItemGetDescURI}, + {"destfile",AcquireItemGetDestFile}, + {"errortext",AcquireItemGetErrorText}, + {"filesize",AcquireItemGetFileSize}, + {"is",AcquireItemGetID}, + {"is_trusted",AcquireItemGetIsTrusted}, + {"local",AcquireItemGetLocal}, + {"status",AcquireItemGetStatus}, + {"stat_idle",AcquireItemGetStatIdle}, + {"stat_fetching",AcquireItemGetStatFetching}, + {"stat_done",AcquireItemGetStatDone}, + {"stat_error",AcquireItemGetStatError}, + {"stat_auth_error",AcquireItemGetStatAuthError}, +#ifdef COMPAT_0_7 {"Complete",AcquireItemGetComplete}, {"DescURI",AcquireItemGetDescURI}, {"DestFile",AcquireItemGetDestFile}, @@ -52,6 +67,7 @@ static PyGetSetDef AcquireItemGetSet[] = { {"StatDone",AcquireItemGetStatDone}, {"StatError",AcquireItemGetStatError}, {"StatAuthError",AcquireItemGetStatAuthError}, +#endif {} }; @@ -140,8 +156,12 @@ static PyObject *PkgAcquireShutdown(PyObject *Self,PyObject *Args) static PyMethodDef PkgAcquireMethods[] = { + {"run",PkgAcquireRun,METH_VARARGS,"Run the fetcher"}, + {"shutdown",PkgAcquireShutdown, METH_VARARGS,"Shutdown the fetcher"}, + #ifdef COMPAT_0_7 {"Run",PkgAcquireRun,METH_VARARGS,"Run the fetcher"}, {"Shutdown",PkgAcquireShutdown, METH_VARARGS,"Shutdown the fetcher"}, + #endif {} }; @@ -184,6 +204,14 @@ static PyObject *PkgAcquireGetResultCancelled(PyObject *Self,void*) { } static PyGetSetDef PkgAcquireGetSet[] = { + {"fetch_needed",PkgAcquireGetFetchNeeded}, + {"items",PkgAcquireGetItems}, + {"partial_present",PkgAcquireGetPartialPresent}, + {"result_cancelled",PkgAcquireGetResultCancelled}, + {"result_continue",PkgAcquireGetResultContinue}, + {"result_failed",PkgAcquireGetResultFailed}, + {"total_needed",PkgAcquireGetTotalNeeded}, + #ifdef COMPAT_0_7 {"FetchNeeded",PkgAcquireGetFetchNeeded}, {"Items",PkgAcquireGetItems}, {"PartialPresent",PkgAcquireGetPartialPresent}, @@ -191,6 +219,7 @@ static PyGetSetDef PkgAcquireGetSet[] = { {"ResultContinue",PkgAcquireGetResultContinue}, {"ResultFailed",PkgAcquireGetResultFailed}, {"TotalNeeded",PkgAcquireGetTotalNeeded}, + #endif {} }; diff --git a/python/apt_instmodule.cc b/python/apt_instmodule.cc index 09e3937e..84479fcb 100644 --- a/python/apt_instmodule.cc +++ b/python/apt_instmodule.cc @@ -29,7 +29,7 @@ expose the full range of the apt-inst .deb processing will join it some day. */ static char *doc_debExtractControl = -"debExtractControl(File[,Member]) -> String\n" +"deb_extract_control(file[,member]) -> String\n" "Returns the indicated file from the control tar. The default is 'control'\n"; static PyObject *debExtractControl(PyObject *Self,PyObject *Args) { @@ -72,7 +72,7 @@ static PyObject *debExtractControl(PyObject *Self,PyObject *Args) // debExtractArchive - Exctract the archive /*{{{*/ // --------------------------------------------------------------------- static char *doc_debExtractArchive = -"debExtractArchve(File,rootdir) -> Bool\n" +"deb_extract_archive(File,rootdir) -> Bool\n" "Extracts the Archive into the given root dir"; static PyObject *debExtractArchive(PyObject *Self,PyObject *Args) { @@ -118,7 +118,7 @@ static PyObject *debExtractArchive(PyObject *Self,PyObject *Args) // arFindMember - Find member in AR archive /*{{{*/ // --------------------------------------------------------------------- static char *doc_arCheckMember = -"arCheckMember(File, membername) -> Bool\n"; +"ar_check_member(file, membername) -> Bool\n"; static PyObject *arCheckMember(PyObject *Self,PyObject *Args) { char *Member = NULL; @@ -149,16 +149,23 @@ static PyObject *arCheckMember(PyObject *Self,PyObject *Args) static PyMethodDef methods[] = { // access to ar files - {"arCheckMember", arCheckMember, METH_VARARGS, doc_arCheckMember}, + {"ar_check_member", arCheckMember, METH_VARARGS, doc_arCheckMember}, // access to deb files - {"debExtractControl",debExtractControl,METH_VARARGS,doc_debExtractControl}, - {"debExtractArchive",debExtractArchive,METH_VARARGS,doc_debExtractArchive}, + {"deb_extract_control",debExtractControl,METH_VARARGS,doc_debExtractControl}, + {"deb_extract_archive",debExtractArchive,METH_VARARGS,doc_debExtractArchive}, // access to tar streams + {"tar_extract",tarExtract,METH_VARARGS,doc_tarExtract}, + {"deb_extract",debExtract,METH_VARARGS,doc_debExtract}, + +#ifdef COMPAT_0_7 + {"arCheckMember", arCheckMember, METH_VARARGS, doc_arCheckMember}, + {"debExtractControl",debExtractControl,METH_VARARGS,doc_debExtractControl}, + {"debExtractArchive",debExtractArchive,METH_VARARGS,doc_debExtractArchive}, {"tarExtract",tarExtract,METH_VARARGS,doc_tarExtract}, {"debExtract",debExtract,METH_VARARGS,doc_debExtract}, - +#endif {} }; diff --git a/python/apt_pkgmodule.cc b/python/apt_pkgmodule.cc index bdea5fae..ddd6d38b 100644 --- a/python/apt_pkgmodule.cc +++ b/python/apt_pkgmodule.cc @@ -389,35 +389,60 @@ static PyMethodDef methods[] = {"newConfiguration",newConfiguration,METH_VARARGS,doc_newConfiguration}, #endif {"init",Init,METH_VARARGS,doc_Init}, + {"init_config",InitConfig,METH_VARARGS,doc_InitConfig}, + {"init_system",InitSystem,METH_VARARGS,doc_InitSystem}, + #ifdef COMPAT_0_7 {"InitConfig",InitConfig,METH_VARARGS,doc_InitConfig}, {"InitSystem",InitSystem,METH_VARARGS,doc_InitSystem}, + #endif // Tag File #ifdef COMPAT_0_7 {"ParseSection",ParseSection,METH_VARARGS,doc_ParseSection}, {"ParseTagFile",ParseTagFile,METH_VARARGS,doc_ParseTagFile}, - #endif {"RewriteSection",RewriteSection,METH_VARARGS,doc_RewriteSection}, + #endif + {"rewrite_section",RewriteSection,METH_VARARGS,doc_RewriteSection}, // Locking + {"get_lock",GetLock,METH_VARARGS,doc_GetLock}, + {"pkgsystem_lock",PkgSystemLock,METH_VARARGS,doc_PkgSystemLock}, + {"pkgsystem_unlock",PkgSystemUnLock,METH_VARARGS,doc_PkgSystemUnLock}, + #ifdef COMPAT_0_7 {"GetLock",GetLock,METH_VARARGS,doc_GetLock}, {"PkgSystemLock",PkgSystemLock,METH_VARARGS,doc_PkgSystemLock}, {"PkgSystemUnLock",PkgSystemUnLock,METH_VARARGS,doc_PkgSystemUnLock}, + #endif // Command line + {"read_configfile",LoadConfig,METH_VARARGS,doc_LoadConfig}, + {"read_configdir",LoadConfigDir,METH_VARARGS,doc_LoadConfigDir}, + {"read_configfile_isc",LoadConfigISC,METH_VARARGS,doc_LoadConfig}, + {"parse_commandline",ParseCommandLine,METH_VARARGS,doc_ParseCommandLine}, + #ifdef COMPAT_0_7 {"ReadConfigFile",LoadConfig,METH_VARARGS,doc_LoadConfig}, {"ReadConfigDir",LoadConfigDir,METH_VARARGS,doc_LoadConfigDir}, {"ReadConfigFileISC",LoadConfigISC,METH_VARARGS,doc_LoadConfig}, {"ParseCommandLine",ParseCommandLine,METH_VARARGS,doc_ParseCommandLine}, + #endif // Versioning + {"version_compare",VersionCompare,METH_VARARGS,doc_VersionCompare}, + {"check_dep",CheckDep,METH_VARARGS,doc_CheckDep}, + {"upstream_version",UpstreamVersion,METH_VARARGS,doc_UpstreamVersion}, + #ifdef COMPAT_0_7 {"VersionCompare",VersionCompare,METH_VARARGS,doc_VersionCompare}, {"CheckDep",CheckDep,METH_VARARGS,doc_CheckDep}, {"UpstreamVersion",UpstreamVersion,METH_VARARGS,doc_UpstreamVersion}, + #endif // Depends + {"parse_depends",ParseDepends,METH_VARARGS,doc_ParseDepends}, + {"parse_srcdepends",ParseSrcDepends,METH_VARARGS,doc_ParseDepends}, + #ifdef COMPAT_0_7 {"ParseDepends",ParseDepends,METH_VARARGS,doc_ParseDepends}, {"ParseSrcDepends",ParseSrcDepends,METH_VARARGS,doc_ParseDepends}, + #endif // Stuff {"md5sum",md5sum,METH_VARARGS,doc_md5sum}, @@ -425,6 +450,17 @@ static PyMethodDef methods[] = {"sha256sum",sha256sum,METH_VARARGS,doc_sha256sum}, // Strings + {"check_domainlist",StrCheckDomainList,METH_VARARGS,"CheckDomainList(String,String) -> Bool"}, + {"quote_string",StrQuoteString,METH_VARARGS,"QuoteString(String,String) -> String"}, + {"dequote_string",StrDeQuote,METH_VARARGS,"DeQuoteString(String) -> String"}, + {"size_to_str",StrSizeToStr,METH_VARARGS,"SizeToStr(int) -> String"}, + {"time_to_str",StrTimeToStr,METH_VARARGS,"TimeToStr(int) -> String"}, + {"uri_to_filename",StrURItoFileName,METH_VARARGS,"URItoFileName(String) -> String"}, + {"base64_encode",StrBase64Encode,METH_VARARGS,"Base64Encode(String) -> String"}, + {"string_to_bool",StrStringToBool,METH_VARARGS,"StringToBool(String) -> int"}, + {"time_rfc1123",StrTimeRFC1123,METH_VARARGS,"TimeRFC1123(int) -> String"}, + {"str_to_time",StrStrToTime,METH_VARARGS,"StrToTime(String) -> Int"}, + #ifdef COMPAT_0_7 {"CheckDomainList",StrCheckDomainList,METH_VARARGS,"CheckDomainList(String,String) -> Bool"}, {"QuoteString",StrQuoteString,METH_VARARGS,"QuoteString(String,String) -> String"}, {"DeQuoteString",StrDeQuote,METH_VARARGS,"DeQuoteString(String) -> String"}, @@ -435,6 +471,7 @@ static PyMethodDef methods[] = {"StringToBool",StrStringToBool,METH_VARARGS,"StringToBool(String) -> int"}, {"TimeRFC1123",StrTimeRFC1123,METH_VARARGS,"TimeRFC1123(int) -> String"}, {"StrToTime",StrStrToTime,METH_VARARGS,"StrToTime(String) -> Int"}, + #endif // Cache #ifdef COMPAT_0_7 @@ -535,7 +572,10 @@ extern "C" void initapt_pkg() // Global variable linked to the global configuration class CppPyObject<Configuration *> *Config = CppPyObject_NEW<Configuration *>(&ConfigurationPtrType); Config->Object = _config; + PyModule_AddObject(Module,"config",Config); + #ifdef COMPAT_0_7 PyModule_AddObject(Module,"Config",Config); + #endif // Add our classes. /* ============================ tag.cc ============================ */ @@ -577,20 +617,40 @@ extern "C" void initapt_pkg() /* ========================= sourcelist.cc ========================= */ ADDTYPE(Module,"SourceList",&PkgSourceListType); // Tag file constants + PyModule_AddObject(Module,"REWRITE_PACKAGE_ORDER", + CharCharToList(TFRewritePackageOrder)); + + PyModule_AddObject(Module,"REWRITE_SOURCE_ORDER", + CharCharToList(TFRewriteSourceOrder)); +#ifdef COMPAT_0_7 PyModule_AddObject(Module,"RewritePackageOrder", CharCharToList(TFRewritePackageOrder)); PyModule_AddObject(Module,"RewriteSourceOrder", CharCharToList(TFRewriteSourceOrder)); +#endif // Version.. + PyModule_AddStringConstant(Module,"VERSION",(char *)pkgVersion); + PyModule_AddStringConstant(Module,"LIB_VERSION",(char *)pkgLibVersion); + PyModule_AddStringConstant(Module,"DATE",__DATE__); + PyModule_AddStringConstant(Module,"TIME",__TIME__); +#ifdef COMPAT_0_7 PyModule_AddStringConstant(Module,"Version",(char *)pkgVersion); PyModule_AddStringConstant(Module,"LibVersion",(char *)pkgLibVersion); PyModule_AddStringConstant(Module,"Date",__DATE__); PyModule_AddStringConstant(Module,"Time",__TIME__); +#endif // My constants - + PyModule_AddIntConstant(Module,"DEP_DEPENDS",pkgCache::Dep::Depends); + PyModule_AddIntConstant(Module,"DEP_PREDEPENDS",pkgCache::Dep::PreDepends); + PyModule_AddIntConstant(Module,"DEP_SUGGESTS",pkgCache::Dep::Suggests); + PyModule_AddIntConstant(Module,"DEP_RECOMMENDS",pkgCache::Dep::Recommends); + PyModule_AddIntConstant(Module,"DEP_CONFLICTS",pkgCache::Dep::Conflicts); + PyModule_AddIntConstant(Module,"DEP_REPLACES",pkgCache::Dep::Replaces); + PyModule_AddIntConstant(Module,"DEP_OBSOLTES",pkgCache::Dep::Obsoletes); +#ifdef COMPAT_0_7 PyModule_AddIntConstant(Module,"DepDepends",pkgCache::Dep::Depends); PyModule_AddIntConstant(Module,"DepPreDepends",pkgCache::Dep::PreDepends); PyModule_AddIntConstant(Module,"DepSuggests",pkgCache::Dep::Suggests); @@ -598,13 +658,40 @@ extern "C" void initapt_pkg() PyModule_AddIntConstant(Module,"DepConflicts",pkgCache::Dep::Conflicts); PyModule_AddIntConstant(Module,"DepReplaces",pkgCache::Dep::Replaces); PyModule_AddIntConstant(Module,"DepObsoletes",pkgCache::Dep::Obsoletes); +#endif + PyModule_AddIntConstant(Module,"PRI_IMPORTANT",pkgCache::State::Important); + PyModule_AddIntConstant(Module,"PRI_REQUIRED",pkgCache::State::Required); + PyModule_AddIntConstant(Module,"PRI_STANDARD",pkgCache::State::Standard); + PyModule_AddIntConstant(Module,"PRI_OPTIONAL",pkgCache::State::Optional); + PyModule_AddIntConstant(Module,"PRI_EXTRA",pkgCache::State::Extra); +#ifdef COMPAT_0_7 PyModule_AddIntConstant(Module,"PriImportant",pkgCache::State::Important); PyModule_AddIntConstant(Module,"PriRequired",pkgCache::State::Required); PyModule_AddIntConstant(Module,"PriStandard",pkgCache::State::Standard); PyModule_AddIntConstant(Module,"PriOptional",pkgCache::State::Optional); PyModule_AddIntConstant(Module,"PriExtra",pkgCache::State::Extra); - +#endif + // CurState + PyModule_AddIntConstant(Module,"STATE_NOTINSTALLED",pkgCache::State::NotInstalled); + PyModule_AddIntConstant(Module,"STATE_UNPACKED",pkgCache::State::UnPacked); + PyModule_AddIntConstant(Module,"STATE_HALFCONFIGURED",pkgCache::State::HalfConfigured); + PyModule_AddIntConstant(Module,"STATE_HALFINSTALLED",pkgCache::State::HalfInstalled); + PyModule_AddIntConstant(Module,"STATE_CONFIGFILES",pkgCache::State::ConfigFiles); + PyModule_AddIntConstant(Module,"STATE_INSTALLED",pkgCache::State::Installed); + // SelState + PyModule_AddIntConstant(Module,"STATE_UNKNOWN",pkgCache::State::Unknown); + PyModule_AddIntConstant(Module,"STATE_INSTALL",pkgCache::State::Install); + PyModule_AddIntConstant(Module,"STATE_HOLD",pkgCache::State::Hold); + PyModule_AddIntConstant(Module,"STATE_DEINSTALL",pkgCache::State::DeInstall); + PyModule_AddIntConstant(Module,"STATE_PURGE",pkgCache::State::Purge); + // InstState + PyModule_AddIntConstant(Module,"STATE_OK",pkgCache::State::Ok); + PyModule_AddIntConstant(Module,"STATE_REINSTREQ",pkgCache::State::ReInstReq); + PyModule_AddIntConstant(Module,"STATE_HOLD",pkgCache::State::Hold); + PyModule_AddIntConstant(Module,"STATE_HOLD_REINSTREQ",pkgCache::State::HoldReInstReq); + +#ifdef COMPAT_0_7 PyModule_AddIntConstant(Module,"CurStateNotInstalled",pkgCache::State::NotInstalled); PyModule_AddIntConstant(Module,"CurStateUnPacked",pkgCache::State::UnPacked); PyModule_AddIntConstant(Module,"CurStateHalfConfigured",pkgCache::State::HalfConfigured); @@ -622,6 +709,7 @@ extern "C" void initapt_pkg() PyModule_AddIntConstant(Module,"InstStateReInstReq",pkgCache::State::ReInstReq); PyModule_AddIntConstant(Module,"InstStateHold",pkgCache::State::Hold); PyModule_AddIntConstant(Module,"InstStateHoldReInstReq",pkgCache::State::HoldReInstReq); +#endif #ifdef COMPAT_0_7 PyModule_AddIntConstant(Module,"_COMPAT_0_7",1); diff --git a/python/cache.cc b/python/cache.cc index f545a605..644646a1 100644 --- a/python/cache.cc +++ b/python/cache.cc @@ -136,9 +136,14 @@ static PyObject *PkgCacheOpen(PyObject *Self,PyObject *Args) static PyMethodDef PkgCacheMethods[] = { + {"update",PkgCacheUpdate,METH_VARARGS,"Update the cache"}, + {"open", PkgCacheOpen, METH_VARARGS,"Open the cache"}, + {"close", PkgCacheClose, METH_VARARGS,"Close the cache"}, +#ifdef COMPAT_0_7 {"Update",PkgCacheUpdate,METH_VARARGS,"Update the cache"}, {"Open", PkgCacheOpen, METH_VARARGS,"Open the cache"}, {"Close", PkgCacheClose, METH_VARARGS,"Close the cache"}, +#endif {} }; @@ -190,6 +195,15 @@ static PyObject *PkgCacheGetFileList(PyObject *Self, void*) { } static PyGetSetDef PkgCacheGetSet[] = { + {"depends_count",PkgCacheGetDependsCount}, + {"filelist",PkgCacheGetFileList}, + {"package_count",PkgCacheGetPackageCount}, + {"packagefile_count",PkgCacheGetPackageFileCount}, + {"packages",PkgCacheGetPackages}, + {"provides_count",PkgCacheGetProvidesCount}, + {"verfile_count",PkgCacheGetVerFileCount}, + {"version_count",PkgCacheGetVersionCount}, +#ifdef COMPAT_0_7 {"DependsCount",PkgCacheGetDependsCount}, {"FileList",PkgCacheGetFileList}, {"PackageCount",PkgCacheGetPackageCount}, @@ -198,6 +212,7 @@ static PyGetSetDef PkgCacheGetSet[] = { {"ProvidesCount",PkgCacheGetProvidesCount}, {"VerFileCount",PkgCacheGetVerFileCount}, {"VersionCount",PkgCacheGetVersionCount}, +#endif {} }; @@ -482,6 +497,20 @@ static PyObject *PackageGetCurrentVer(PyObject *Self,void*) } static PyGetSetDef PackageGetSet[] = { + {"name",PackageGetName}, + {"section",PackageGetSection}, + {"revdependslist",PackageGetRevDependsList}, + {"provideslist",PackageGetProvidesList}, + {"selected_state",PackageGetSelectedState}, + {"inst_state",PackageGetInstState}, + {"current_state",PackageGetCurrentState}, + {"id",PackageGetID}, + {"auto",PackageGetAuto}, + {"essential",PackageGetEssential}, + {"important",PackageGetImportant}, + {"versionlist",PackageGetVersionList}, + {"currentver",PackageGetCurrentVer}, + #ifdef COMPAT_0_7 {"Name",PackageGetName}, {"Section",PackageGetSection}, {"RevDependsList",PackageGetRevDependsList}, @@ -495,6 +524,7 @@ static PyGetSetDef PackageGetSet[] = { {"Important",PackageGetImportant}, {"VersionList",PackageGetVersionList}, {"CurrentVer",PackageGetCurrentVer}, + #endif {} }; @@ -579,9 +609,13 @@ static PyObject *DescriptionGetFileList(PyObject *Self,void*) } static PyGetSetDef DescriptionGetSet[] = { - {"LanguageCode",DescriptionGetLanguageCode}, + {"languagecode",DescriptionGetLanguageCode}, {"md5",DescriptionGetMd5}, + {"filelist",DescriptionGetFileList}, + #ifdef COMPAT_0_7 + {"LanguageCode",DescriptionGetLanguageCode}, {"FileList",DescriptionGetFileList}, + #endif {} }; @@ -955,8 +989,12 @@ static PyObject *DepAllTargets(PyObject *Self,PyObject *Args) static PyMethodDef DependencyMethods[] = { + {"smart_target_pkg",DepSmartTargetPkg,METH_VARARGS,"Returns the natural Target or None"}, + {"all_targets",DepAllTargets,METH_VARARGS,"Returns all possible Versions that match this dependency"}, +#ifdef COMPAT_0_7 {"SmartTargetPkg",DepSmartTargetPkg,METH_VARARGS,"Returns the natural Target or None"}, {"AllTargets",DepAllTargets,METH_VARARGS,"Returns all possible Versions that match this dependency"}, +#endif {} }; @@ -1014,6 +1052,14 @@ static PyObject *DependencyGetID(PyObject *Self,void*) } static PyGetSetDef DependencyGetSet[] = { + {"comptype",DependencyGetCompType}, + {"deptype",DependencyGetDepType}, + {"id",DependencyGetID}, + {"parentpkg",DependencyGetParentPkg}, + {"parentver",DependencyGetParentVer}, + {"targetpkg",DependencyGetTargetPkg}, + {"targetver",DependencyGetTargetVer}, +#ifdef COMPAT_0_7 {"CompType",DependencyGetCompType}, {"DepType",DependencyGetDepType}, {"ID",DependencyGetID}, @@ -1021,6 +1067,7 @@ static PyGetSetDef DependencyGetSet[] = { {"ParentVer",DependencyGetParentVer}, {"TargetPkg",DependencyGetTargetPkg}, {"TargetVer",DependencyGetTargetVer}, +#endif {} }; diff --git a/python/cdrom.cc b/python/cdrom.cc index bf94a390..044bbf30 100644 --- a/python/cdrom.cc +++ b/python/cdrom.cc @@ -58,8 +58,12 @@ static PyObject *PkgCdromIdent(PyObject *Self,PyObject *Args) static PyMethodDef PkgCdromMethods[] = { + {"add",PkgCdromAdd,METH_VARARGS,"add(progress) -> Add a cdrom"}, + {"ident",PkgCdromIdent,METH_VARARGS,"ident(progress) -> Ident a cdrom"}, +#ifdef COMPAT_0_7 {"Add",PkgCdromAdd,METH_VARARGS,"Add(progress) -> Add a cdrom"}, {"Ident",PkgCdromIdent,METH_VARARGS,"Ident(progress) -> Ident a cdrom"}, +#endif {} }; diff --git a/python/configuration.cc b/python/configuration.cc index abbed6d9..107cf90f 100644 --- a/python/configuration.cc +++ b/python/configuration.cc @@ -453,13 +453,26 @@ PyObject *ParseCommandLine(PyObject *Self,PyObject *Args) static PyMethodDef CnfMethods[] = { // Query + {"find",CnfFind,METH_VARARGS,doc_Find}, + {"find_file",CnfFindFile,METH_VARARGS,doc_FindFile}, + {"find_dir",CnfFindDir,METH_VARARGS,doc_FindDir}, + {"find_i",CnfFindI,METH_VARARGS,doc_FindI}, + {"find_b",CnfFindB,METH_VARARGS,doc_FindB}, + + // Others + {"set",CnfSet,METH_VARARGS,doc_Set}, + {"exists",CnfExists,METH_VARARGS,doc_Exists}, + {"subtree",CnfSubTree,METH_VARARGS,doc_SubTree}, + {"list",CnfList,METH_VARARGS,doc_List}, + {"valuelist",CnfValueList,METH_VARARGS,doc_ValueList}, + {"mytag",CnfMyTag,METH_VARARGS,doc_MyTag}, + {"clear",CnfClear,METH_VARARGS,doc_Clear}, +#ifdef COMPAT_0_7 {"Find",CnfFind,METH_VARARGS,doc_Find}, {"FindFile",CnfFindFile,METH_VARARGS,doc_FindFile}, {"FindDir",CnfFindDir,METH_VARARGS,doc_FindDir}, {"FindI",CnfFindI,METH_VARARGS,doc_FindI}, {"FindB",CnfFindB,METH_VARARGS,doc_FindB}, - - // Others {"Set",CnfSet,METH_VARARGS,doc_Set}, {"Exists",CnfExists,METH_VARARGS,doc_Exists}, {"SubTree",CnfSubTree,METH_VARARGS,doc_SubTree}, @@ -467,10 +480,12 @@ static PyMethodDef CnfMethods[] = {"ValueList",CnfValueList,METH_VARARGS,doc_ValueList}, {"MyTag",CnfMyTag,METH_VARARGS,doc_MyTag}, {"Clear",CnfClear,METH_VARARGS,doc_Clear}, - +#endif // Python Special {"keys",CnfKeys,METH_VARARGS,doc_Keys}, + #if PY_MAJOR_VERSION < 3 {"has_key",CnfExists,METH_VARARGS,doc_Exists}, + #endif {"get",CnfFind,METH_VARARGS,doc_Find}, {} }; diff --git a/python/depcache.cc b/python/depcache.cc index ef2240ce..f3b16211 100644 --- a/python/depcache.cc +++ b/python/depcache.cc @@ -528,21 +528,47 @@ static PyObject *PkgDepCacheMarkedReinstall(PyObject *Self,PyObject *Args) static PyMethodDef PkgDepCacheMethods[] = { + {"init",PkgDepCacheInit,METH_VARARGS,"Init the depcache (done on construct automatically)"}, + {"get_candidate",PkgDepCacheGetCandidateVer,METH_VARARGS,"Get candidate version"}, + {"set_candidate",PkgDepCacheSetCandidateVer,METH_VARARGS,"Set candidate version"}, + + // global cache operations + {"upgrade",PkgDepCacheUpgrade,METH_VARARGS,"Perform Upgrade (optional boolean argument if dist-upgrade should be performed)"}, + {"fix_broken",PkgDepCacheFixBroken,METH_VARARGS,"Fix broken packages"}, + {"read_pinfile",PkgDepCacheReadPinFile,METH_VARARGS,"Read the pin policy"}, + {"minimize_upgrade",PkgDepCacheMinimizeUpgrade, METH_VARARGS,"Go over the entire set of packages and try to keep each package marked for upgrade. If a conflict is generated then the package is restored."}, + // Manipulators + {"mark_keep",PkgDepCacheMarkKeep,METH_VARARGS,"Mark package for keep"}, + {"mark_delete",PkgDepCacheMarkDelete,METH_VARARGS,"Mark package for delete (optional boolean argument if it should be purged)"}, + {"mark_install",PkgDepCacheMarkInstall,METH_VARARGS,"Mark package for Install"}, + {"set_reinstall",PkgDepCacheSetReInstall,METH_VARARGS,"Set if the package should be reinstalled"}, + // state information + {"is_upgradable",PkgDepCacheIsUpgradable,METH_VARARGS,"Is pkg upgradable"}, + {"is_now_broken",PkgDepCacheIsNowBroken,METH_VARARGS,"Is pkg is now broken"}, + {"is_inst_broken",PkgDepCacheIsInstBroken,METH_VARARGS,"Is pkg broken on the current install"}, + {"is_garbage",PkgDepCacheIsGarbage,METH_VARARGS,"Is pkg garbage (mark-n-sweep)"}, + {"is_auto_installed",PkgDepCacheIsAutoInstalled,METH_VARARGS,"Is pkg marked as auto installed"}, + {"marked_install",PkgDepCacheMarkedInstall,METH_VARARGS,"Is pkg marked for install"}, + {"marked_upgrade",PkgDepCacheMarkedUpgrade,METH_VARARGS,"Is pkg marked for upgrade"}, + {"marked_delete",PkgDepCacheMarkedDelete,METH_VARARGS,"Is pkg marked for delete"}, + {"marked_keep",PkgDepCacheMarkedKeep,METH_VARARGS,"Is pkg marked for keep"}, + {"marked_reinstall",PkgDepCacheMarkedReinstall,METH_VARARGS,"Is pkg marked for reinstall"}, + {"marked_downgrade",PkgDepCacheMarkedDowngrade,METH_VARARGS,"Is pkg marked for downgrade"}, + + // Action + {"commit", PkgDepCacheCommit, METH_VARARGS, "Commit pending changes"}, +#ifdef COMPAT_0_7 {"Init",PkgDepCacheInit,METH_VARARGS,"Init the depcache (done on construct automatically)"}, {"GetCandidateVer",PkgDepCacheGetCandidateVer,METH_VARARGS,"Get candidate version"}, {"SetCandidateVer",PkgDepCacheSetCandidateVer,METH_VARARGS,"Set candidate version"}, - - // global cache operations {"Upgrade",PkgDepCacheUpgrade,METH_VARARGS,"Perform Upgrade (optional boolean argument if dist-upgrade should be performed)"}, {"FixBroken",PkgDepCacheFixBroken,METH_VARARGS,"Fix broken packages"}, {"ReadPinFile",PkgDepCacheReadPinFile,METH_VARARGS,"Read the pin policy"}, {"MinimizeUpgrade",PkgDepCacheMinimizeUpgrade, METH_VARARGS,"Go over the entire set of packages and try to keep each package marked for upgrade. If a conflict is generated then the package is restored."}, - // Manipulators {"MarkKeep",PkgDepCacheMarkKeep,METH_VARARGS,"Mark package for keep"}, {"MarkDelete",PkgDepCacheMarkDelete,METH_VARARGS,"Mark package for delete (optional boolean argument if it should be purged)"}, {"MarkInstall",PkgDepCacheMarkInstall,METH_VARARGS,"Mark package for Install"}, {"SetReInstall",PkgDepCacheSetReInstall,METH_VARARGS,"Set if the package should be reinstalled"}, - // state information {"IsUpgradable",PkgDepCacheIsUpgradable,METH_VARARGS,"Is pkg upgradable"}, {"IsNowBroken",PkgDepCacheIsNowBroken,METH_VARARGS,"Is pkg is now broken"}, {"IsInstBroken",PkgDepCacheIsInstBroken,METH_VARARGS,"Is pkg broken on the current install"}, @@ -554,9 +580,8 @@ static PyMethodDef PkgDepCacheMethods[] = {"MarkedKeep",PkgDepCacheMarkedKeep,METH_VARARGS,"Is pkg marked for keep"}, {"MarkedReinstall",PkgDepCacheMarkedReinstall,METH_VARARGS,"Is pkg marked for reinstall"}, {"MarkedDowngrade",PkgDepCacheMarkedDowngrade,METH_VARARGS,"Is pkg marked for downgrade"}, - - // Action {"Commit", PkgDepCacheCommit, METH_VARARGS, "Commit pending changes"}, +#endif {} }; @@ -582,12 +607,20 @@ static PyObject *PkgDepCacheGetDebSize(PyObject *Self,void*) { #undef depcache static PyGetSetDef PkgDepCacheGetSet[] = { + {"brokencount",PkgDepCacheGetBrokenCount}, + {"debsize",PkgDepCacheGetDebSize}, + {"delcount",PkgDepCacheGetDelCount}, + {"instcount",PkgDepCacheGetInstCount}, + {"keepcount",PkgDepCacheGetKeepCount}, + {"usrsize",PkgDepCacheGetUsrSize}, + #ifdef COMPAT_0_7 {"BrokenCount",PkgDepCacheGetBrokenCount}, {"DebSize",PkgDepCacheGetDebSize}, {"DelCount",PkgDepCacheGetDelCount}, {"InstCount",PkgDepCacheGetInstCount}, {"KeepCount",PkgDepCacheGetKeepCount}, {"UsrSize",PkgDepCacheGetUsrSize}, + #endif {} }; @@ -779,14 +812,22 @@ static PyObject *PkgProblemResolverInstallProtect(PyObject *Self,PyObject *Args) static PyMethodDef PkgProblemResolverMethods[] = { // config + {"protect", PkgProblemResolverProtect, METH_VARARGS, "protect(PkgIterator)"}, + {"remove", PkgProblemResolverRemove, METH_VARARGS, "remove(PkgIterator)"}, + {"clear", PkgProblemResolverClear, METH_VARARGS, "clear(PkgIterator)"}, + {"install_protect", PkgProblemResolverInstallProtect, METH_VARARGS, "install_protect()"}, + + // Actions + {"resolve", PkgProblemResolverResolve, METH_VARARGS, "Try to intelligently resolve problems by installing and removing packages"}, + {"resolve_by_keep", PkgProblemResolverResolveByKeep, METH_VARARGS, "Try to resolv problems only by using keep"}, + #ifdef COMPAT_0_7 {"Protect", PkgProblemResolverProtect, METH_VARARGS, "Protect(PkgIterator)"}, {"Remove", PkgProblemResolverRemove, METH_VARARGS, "Remove(PkgIterator)"}, {"Clear", PkgProblemResolverClear, METH_VARARGS, "Clear(PkgIterator)"}, {"InstallProtect", PkgProblemResolverInstallProtect, METH_VARARGS, "ProtectInstalled()"}, - - // Actions {"Resolve", PkgProblemResolverResolve, METH_VARARGS, "Try to intelligently resolve problems by installing and removing packages"}, {"ResolveByKeep", PkgProblemResolverResolveByKeep, METH_VARARGS, "Try to resolv problems only by using keep"}, + #endif {} }; diff --git a/python/indexfile.cc b/python/indexfile.cc index 600dc853..795931fb 100644 --- a/python/indexfile.cc +++ b/python/indexfile.cc @@ -28,7 +28,10 @@ static PyObject *PackageIndexFileArchiveURI(PyObject *Self,PyObject *Args) static PyMethodDef PackageIndexFileMethods[] = { + {"archive_uri",PackageIndexFileArchiveURI,METH_VARARGS,"Returns the ArchiveURI"}, + #ifdef COMPAT_0_7 {"ArchiveURI",PackageIndexFileArchiveURI,METH_VARARGS,"Returns the ArchiveURI"}, + #endif {} }; @@ -69,12 +72,20 @@ static PyObject *PackageIndexFileRepr(PyObject *Self) } static PyGetSetDef PackageIndexFileGetSet[] = { + {"describe",PackageIndexFileGetDescribe}, + {"exists",PackageIndexFileGetExists}, + {"has_packages",PackageIndexFileGetHasPackages}, + {"is_trusted",PackageIndexFileGetIsTrusted}, + {"label",PackageIndexFileGetLabel}, + {"size",PackageIndexFileGetSize}, + #ifdef COMPAT_0_7 {"Describe",PackageIndexFileGetDescribe}, {"Exists",PackageIndexFileGetExists}, {"HasPackages",PackageIndexFileGetHasPackages}, {"IsTrusted",PackageIndexFileGetIsTrusted}, {"Label",PackageIndexFileGetLabel}, {"Size",PackageIndexFileGetSize}, + #endif {} }; diff --git a/python/pkgmanager.cc b/python/pkgmanager.cc index 781acc8b..cae2b580 100644 --- a/python/pkgmanager.cc +++ b/python/pkgmanager.cc @@ -92,9 +92,14 @@ static PyObject *PkgManagerFixMissing(PyObject *Self,PyObject *Args) static PyMethodDef PkgManagerMethods[] = { + {"get_archives",PkgManagerGetArchives,METH_VARARGS,"Load the selected archives into the fetcher"}, + {"do_install",PkgManagerDoInstall,METH_VARARGS,"Do the actual install"}, + {"fix_missing",PkgManagerFixMissing,METH_VARARGS,"Fix the install if a pkg couldn't be downloaded"}, +#ifdef COMPAT_0_7 {"GetArchives",PkgManagerGetArchives,METH_VARARGS,"Load the selected archives into the fetcher"}, {"DoInstall",PkgManagerDoInstall,METH_VARARGS,"Do the actual install"}, {"FixMissing",PkgManagerFixMissing,METH_VARARGS,"Fix the install if a pkg couldn't be downloaded"}, +#endif {} }; @@ -110,9 +115,14 @@ static PyObject *PkgManagerGetResultIncomplete(PyObject *Self,void*) { } static PyGetSetDef PkgManagerGetSet[] = { + {"result_completed",PkgManagerGetResultCompleted}, + {"result_failed",PkgManagerGetResultFailed}, + {"result_incomplete",PkgManagerGetResultIncomplete}, +#ifdef COMPAT_0_7 {"ResultCompleted",PkgManagerGetResultCompleted}, {"ResultFailed",PkgManagerGetResultFailed}, {"ResultIncomplete",PkgManagerGetResultIncomplete}, +#endif {} }; diff --git a/python/pkgrecords.cc b/python/pkgrecords.cc index 1cccfce2..f9e48352 100644 --- a/python/pkgrecords.cc +++ b/python/pkgrecords.cc @@ -49,7 +49,10 @@ static PyObject *PkgRecordsLookup(PyObject *Self,PyObject *Args) static PyMethodDef PkgRecordsMethods[] = { + {"lookup",PkgRecordsLookup,METH_VARARGS,"Changes to a new package"}, + #ifdef COMPAT_0_7 {"Lookup",PkgRecordsLookup,METH_VARARGS,"Changes to a new package"}, + #endif {} }; @@ -117,6 +120,19 @@ static PyObject *PkgRecordsGetRecord(PyObject *Self,void*) { return PyString_FromStringAndSize(start,stop-start); } static PyGetSetDef PkgRecordsGetSet[] = { + {"filename",PkgRecordsGetFileName}, + {"homepage",PkgRecordsGetHomepage}, + {"longdesc",PkgRecordsGetLongDesc}, + {"md5",PkgRecordsGetMD5Hash}, + {"maintainer",PkgRecordsGetMaintainer}, + {"name",PkgRecordsGetName}, + {"record",PkgRecordsGetRecord}, + {"sha1",PkgRecordsGetSHA1Hash}, + {"sha256",PkgRecordsGetSHA256Hash}, + {"shortdesc",PkgRecordsGetShortDesc}, + {"sourcepkg",PkgRecordsGetSourcePkg}, + {"sourcever",PkgRecordsGetSourceVer}, +#ifdef COMPAT_0_7 {"FileName",PkgRecordsGetFileName}, {"Homepage",PkgRecordsGetHomepage}, {"LongDesc",PkgRecordsGetLongDesc}, @@ -129,6 +145,7 @@ static PyGetSetDef PkgRecordsGetSet[] = { {"ShortDesc",PkgRecordsGetShortDesc}, {"SourcePkg",PkgRecordsGetSourcePkg}, {"SourceVer",PkgRecordsGetSourceVer}, +#endif {} }; diff --git a/python/pkgsrcrecords.cc b/python/pkgsrcrecords.cc index 8b4dce3e..2a8b7bab 100644 --- a/python/pkgsrcrecords.cc +++ b/python/pkgsrcrecords.cc @@ -70,8 +70,12 @@ static PyObject *PkgSrcRecordsRestart(PyObject *Self,PyObject *Args) static PyMethodDef PkgSrcRecordsMethods[] = { + {"lookup",PkgSrcRecordsLookup,METH_VARARGS,doc_PkgSrcRecordsLookup}, + {"restart",PkgSrcRecordsRestart,METH_VARARGS,doc_PkgSrcRecordsRestart}, +#ifdef COMPAT_0_7 {"Lookup",PkgSrcRecordsLookup,METH_VARARGS,doc_PkgSrcRecordsLookup}, {"Restart",PkgSrcRecordsRestart,METH_VARARGS,doc_PkgSrcRecordsRestart}, +#endif {} }; @@ -168,6 +172,16 @@ static PyObject *PkgSrcRecordsGetBuildDepends(PyObject *Self,void*) { } static PyGetSetDef PkgSrcRecordsGetSet[] = { + {"binaries",PkgSrcRecordsGetBinaries}, + {"builddepends",PkgSrcRecordsGetBuildDepends}, + {"files",PkgSrcRecordsGetFiles}, + {"index",PkgSrcRecordsGetIndex}, + {"maintainer",PkgSrcRecordsGetMaintainer}, + {"package",PkgSrcRecordsGetPackage}, + {"record",PkgSrcRecordsGetRecord}, + {"section",PkgSrcRecordsGetSection}, + {"version",PkgSrcRecordsGetVersion}, +#ifdef COMPAT_0_7 {"Binaries",PkgSrcRecordsGetBinaries}, {"BuildDepends",PkgSrcRecordsGetBuildDepends}, {"Files",PkgSrcRecordsGetFiles}, @@ -177,6 +191,7 @@ static PyGetSetDef PkgSrcRecordsGetSet[] = { {"Record",PkgSrcRecordsGetRecord}, {"Section",PkgSrcRecordsGetSection}, {"Version",PkgSrcRecordsGetVersion}, +#endif {} }; diff --git a/python/sourcelist.cc b/python/sourcelist.cc index 15311e94..daf0c08c 100644 --- a/python/sourcelist.cc +++ b/python/sourcelist.cc @@ -72,9 +72,14 @@ static PyObject *PkgSourceListGetIndexes(PyObject *Self,PyObject *Args) static PyMethodDef PkgSourceListMethods[] = { + {"find_index",PkgSourceListFindIndex,METH_VARARGS,doc_PkgSourceListFindIndex}, + {"read_main_list",PkgSourceListReadMainList,METH_VARARGS,doc_PkgSourceListReadMainList}, + {"get_indexes",PkgSourceListGetIndexes,METH_VARARGS,doc_PkgSourceListGetIndexes}, +#ifdef COMPAT_0_7 {"FindIndex",PkgSourceListFindIndex,METH_VARARGS,doc_PkgSourceListFindIndex}, {"ReadMainList",PkgSourceListReadMainList,METH_VARARGS,doc_PkgSourceListReadMainList}, {"GetIndexes",PkgSourceListGetIndexes,METH_VARARGS,doc_PkgSourceListGetIndexes}, +#endif {} }; @@ -93,7 +98,10 @@ static PyObject *PkgSourceListGetList(PyObject *Self,void*) } static PyGetSetDef PkgSourceListGetSet[] = { + {"list",PkgSourceListGetList,0,"A list of MetaIndex() objects.",0}, +#ifdef COMPAT_0_7 {"List",PkgSourceListGetList,0,"A list of MetaIndex() objects.",0}, +#endif {} }; diff --git a/python/tag.cc b/python/tag.cc index bc23e98b..846123ba 100644 --- a/python/tag.cc +++ b/python/tag.cc @@ -377,13 +377,20 @@ PyObject *RewriteSection(PyObject *self,PyObject *Args) static PyMethodDef TagSecMethods[] = { // Query + {"find",TagSecFind,METH_VARARGS,doc_Find}, + {"findflag",TagSecFindFlag,METH_VARARGS,doc_FindFlag}, + {"bytes",TagSecBytes,METH_VARARGS,doc_Bytes}, +#ifdef COMPAT_0_7 {"Find",TagSecFind,METH_VARARGS,doc_Find}, {"FindFlag",TagSecFindFlag,METH_VARARGS,doc_FindFlag}, {"Bytes",TagSecBytes,METH_VARARGS,doc_Bytes}, +#endif // Python Special {"keys",TagSecKeys,METH_VARARGS,doc_Keys}, +#if PY_MAJOR_VERSION < 3 {"has_key",TagSecExists,METH_VARARGS,doc_Exists}, +#endif {"get",TagSecFind,METH_VARARGS,doc_Find}, {} }; @@ -448,9 +455,14 @@ PyTypeObject TagSecType = static PyMethodDef TagFileMethods[] = { // Query + {"step",TagFileStep,METH_VARARGS,doc_Step}, + {"offset",TagFileOffset,METH_VARARGS,doc_Offset}, + {"jump",TagFileJump,METH_VARARGS,doc_Jump}, +#ifdef COMPAT_0_7 {"Step",TagFileStep,METH_VARARGS,doc_Step}, {"Offset",TagFileOffset,METH_VARARGS,doc_Offset}, {"Jump",TagFileJump,METH_VARARGS,doc_Jump}, +#endif {} }; @@ -463,7 +475,10 @@ static PyObject *TagFileGetSection(PyObject *Self,void*) { } static PyGetSetDef TagFileGetSet[] = { + {"section",TagFileGetSection,0,"Return a TagSection.",0}, +#ifdef COMPAT_0_7 {"Section",TagFileGetSection,0,"Return a TagSection.",0}, +#endif {} }; |
