From 14086582c87c4297fd14bd3c3831afd3cd1d2833 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Tue, 10 Sep 2013 17:30:32 +0200 Subject: * merge from Ubuntu: - data/templates/Ubuntu.info.in: add "Saucy Salamander" to - debian/control: add "Multi-Arch: allowed" --- data/templates/Ubuntu.info.in | 119 ++++++++++++++++++++++++++++++++++++++++++ debian/changelog | 13 ++--- debian/control | 4 ++ 3 files changed, 127 insertions(+), 9 deletions(-) diff --git a/data/templates/Ubuntu.info.in b/data/templates/Ubuntu.info.in index 567456b3..9de9d75f 100644 --- a/data/templates/Ubuntu.info.in +++ b/data/templates/Ubuntu.info.in @@ -1,5 +1,124 @@ _ChangelogURI: http://changelogs.ubuntu.com/changelogs/pool/%s/%s/%s/%s_%s/changelog +Suite: saucy +RepositoryType: deb +BaseURI: http://ports.ubuntu.com/ubuntu-ports/ +MatchURI: ports.ubuntu.com/ubuntu-ports +BaseURI-amd64: http://archive.ubuntu.com/ubuntu +MatchURI-amd64: archive.ubuntu.com/ubuntu +BaseURI-i386: http://archive.ubuntu.com/ubuntu +MatchURI-i386: archive.ubuntu.com/ubuntu +MirrorsFile-amd64: Ubuntu.mirrors +MirrorsFile-i386: Ubuntu.mirrors +_Description: Ubuntu 13.10 'Saucy Salamander' +Component: main +_CompDescription: Officially supported +_CompDescriptionLong: Canonical-supported free and open-source software +Component: universe +_CompDescription: Community-maintained +_CompDescriptionLong: Community-maintained free and open-source software +Component: restricted +_CompDescription: Non-free drivers +_CompDescriptionLong: Proprietary drivers for devices +Component: multiverse +ParentComponent: universe +_CompDescription: Restricted software +_CompDescriptionLong: Software restricted by copyright or legal issues + +Suite: saucy +ParentSuite: saucy +RepositoryType: deb-src +BaseURI: http://archive.ubuntu.com/ubuntu/ +MatchURI: archive.ubuntu.com/ubuntu|ports.ubuntu.com/ubuntu-ports +_Description: Ubuntu 13.10 'Saucy Salamander' + +Suite: saucy +RepositoryType: deb +MatchName: .* +BaseURI: cdrom:\[Ubuntu.*13.10 +MatchURI: cdrom:\[Ubuntu.*13.10 +_Description: Cdrom with Ubuntu 13.10 'Saucy Salamander' +Available: False +Component: main +_CompDescription: Officially supported +Component: restricted +_CompDescription: Restricted copyright + +Suite: saucy +Official: false +RepositoryType: deb +BaseURI: http://archive.canonical.com +MatchURI: archive.canonical.com +_Description: Canonical Partners +Component: partner +_CompDescription: Software packaged by Canonical for their partners +_CompDescriptionLong: This software is not part of Ubuntu. + +Suite: saucy +Official: false +RepositoryType: deb +BaseURI: http://extras.ubuntu.com +MatchURI: extras.ubuntu.com +_Description: Independent +Component: main +_CompDescription: Provided by third-party software developers +_CompDescriptionLong: Software offered by third party developers. + +Suite: saucy-security +ParentSuite: saucy +RepositoryType: deb +BaseURI: http://ports.ubuntu.com/ubuntu-ports/ +MatchURI: ports.ubuntu.com/ubuntu-ports +BaseURI-amd64: http://security.ubuntu.com/ubuntu/ +MatchURI-amd64: archive.ubuntu.com/ubuntu|security.ubuntu.com +BaseURI-i386: http://security.ubuntu.com/ubuntu/ +MatchURI-i386: archive.ubuntu.com/ubuntu|security.ubuntu.com +_Description: Important security updates + +Suite: saucy-security +ParentSuite: saucy +RepositoryType: deb-src +BaseURI: http://archive.ubuntu.com/ubuntu/ +MatchURI: archive.ubuntu.com/ubuntu|ports.ubuntu.com/ubuntu-ports|security.ubuntu.com +_Description: Important security updates + +Suite: saucy-updates +ParentSuite: saucy +RepositoryType: deb +_Description: Recommended updates + +Suite: saucy-updates +ParentSuite: saucy +RepositoryType: deb-src +BaseURI: http://archive.ubuntu.com/ubuntu/ +MatchURI: archive.ubuntu.com/ubuntu|ports.ubuntu.com/ubuntu-ports +_Description: Recommended updates + +Suite: saucy-proposed +ParentSuite: saucy +RepositoryType: deb +_Description: Pre-released updates + +Suite: saucy-proposed +ParentSuite: saucy +RepositoryType: deb-src +BaseURI: http://archive.ubuntu.com/ubuntu/ +MatchURI: archive.ubuntu.com/ubuntu|ports.ubuntu.com/ubuntu-ports +_Description: Pre-released updates + +Suite: saucy-backports +ParentSuite: saucy +RepositoryType: deb +_Description: Unsupported updates + +Suite: saucy-backports +ParentSuite: saucy +RepositoryType: deb-src +BaseURI: http://archive.ubuntu.com/ubuntu/ +MatchURI: archive.ubuntu.com/ubuntu|ports.ubuntu.com/ubuntu-ports +_Description: Unsupported updates + + Suite: raring RepositoryType: deb BaseURI: http://ports.ubuntu.com/ubuntu-ports/ diff --git a/debian/changelog b/debian/changelog index eb4a1b36..d1cc10ee 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,6 +1,9 @@ python-apt (0.8.9.2) UNRELEASED; urgency=low - * some fixes from a coverity scan run + * some fixes from the "coverity" scan + * merge from Ubuntu: + - data/templates/Ubuntu.info.in: add "Saucy Salamander" to + - debian/control: add "Multi-Arch: allowed" -- Michael Vogt Mon, 05 Aug 2013 22:55:02 +0200 @@ -91,14 +94,6 @@ python-apt (0.8.9~exp1) experimental; urgency=low -- Michael Vogt Wed, 13 Mar 2013 18:36:37 +0100 -python-apt (0.8.8.3) UNRELEASED; urgency=low - - * aptsources/distro.py: - - include the missing ID in the NoDistroTemplateException() error, - thanks to Brian Murray - - -- Michael Vogt Tue, 30 Apr 2013 18:37:24 +0200 - python-apt (0.8.8.2) unstable; urgency=low [ David Prévot ] diff --git a/debian/control b/debian/control index 945d49d5..ea80e940 100644 --- a/debian/control +++ b/debian/control @@ -25,6 +25,7 @@ XS-Testsuite: autopkgtest Package: python-apt Architecture: any +Multi-Arch: allowed Depends: ${python:Depends}, ${shlibs:Depends}, ${misc:Depends}, python-apt-common Recommends: lsb-release, iso-codes, xz-utils Breaks: packagekit-backend-apt (<= 0.4.8-0ubuntu4), @@ -88,6 +89,7 @@ Description: Python interface to libapt-pkg (API documentation) Package: python-apt-dbg Priority: extra Architecture: any +Multi-Arch: allowed Section: debug Depends: python-dbg, python-apt (= ${binary:Version}), ${shlibs:Depends}, ${misc:Depends} @@ -130,6 +132,7 @@ Description: Python interface to libapt-pkg (locales) Package: python3-apt Priority: optional Architecture: any +Multi-Arch: allowed Depends: ${python3:Depends}, ${shlibs:Depends}, ${misc:Depends}, python-apt-common Recommends: lsb-release, iso-codes Provides: ${python3:Provides} @@ -152,6 +155,7 @@ Description: Python 3 interface to libapt-pkg Package: python3-apt-dbg Priority: extra Architecture: any +Multi-Arch: allowed Section: debug Breaks: python-apt (<< 0.7.98+nmu1) Replaces: python-apt (<< 0.7.98+nmu1) -- cgit v1.2.3 From 044322b4dca1135671a93ebfe1601214f7f6e655 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Mon, 26 Aug 2013 13:39:57 +0200 Subject: Remove old API compatibility C++ support code --- debian/rules | 1 - python/acquire-item.cc | 38 --------- python/acquire.cc | 8 -- python/apt_instmodule.cc | 141 --------------------------------- python/apt_instmodule.h | 6 -- python/apt_pkgmodule.cc | 157 ------------------------------------- python/cache.cc | 61 --------------- python/cdrom.cc | 36 --------- python/depcache.cc | 25 ------ python/generic.cc | 69 ----------------- python/generic.h | 6 -- python/pkgmanager.cc | 9 --- python/pkgrecords.cc | 9 --- python/pkgsrcrecords.cc | 38 --------- python/progress.cc | 117 ---------------------------- python/sourcelist.cc | 9 --- python/tag.cc | 19 ----- python/tar.cc | 197 ----------------------------------------------- setup.py | 2 +- 19 files changed, 1 insertion(+), 947 deletions(-) delete mode 100644 python/tar.cc diff --git a/debian/rules b/debian/rules index c6c3e053..b2da3003 100755 --- a/debian/rules +++ b/debian/rules @@ -1,7 +1,6 @@ #!/usr/bin/make -f # Should be include-links, but that somehow fails. export DEBVER=$(shell dpkg-parsechangelog | sed -n -e 's/^Version: //p') -# For compatibility, add -DCOMPAT_0_7 export CFLAGS=-Wno-write-strings export PATH := $(CURDIR)/utils:$(PATH) export pyversions := $(CURDIR)/utils/pyversions diff --git a/python/acquire-item.cc b/python/acquire-item.cc index 5e7423ab..53c3802b 100644 --- a/python/acquire-item.cc +++ b/python/acquire-item.cc @@ -320,41 +320,3 @@ PyTypeObject PyAcquireFile_Type = { acquirefile_new, // tp_new }; -#ifdef COMPAT_0_7 -char *doc_GetPkgAcqFile = - "GetPkgAcqFile(pkgAquire, uri[, md5, size, descr, shortDescr, destDir, destFile]) -> PkgAcqFile\n"; -PyObject *GetPkgAcqFile(PyObject *Self, PyObject *Args, PyObject * kwds) -{ - PyErr_WarnEx(PyExc_DeprecationWarning, "apt_pkg.GetPkgAcqFile() is " - "deprecated. Please see apt_pkg.AcquireFile() for the " - "replacement", 1); - PyObject *pyfetcher; - char *uri, *md5, *descr, *shortDescr, *destDir, *destFile; - int size = 0; - uri = md5 = descr = shortDescr = destDir = destFile = ""; - - char * kwlist[] = {"owner","uri", "md5", "size", "descr", "shortDescr", - "destDir", "destFile", NULL - }; - - if (PyArg_ParseTupleAndKeywords(Args, kwds, "O!s|sissss", kwlist, - &PyAcquire_Type, &pyfetcher, &uri, &md5, - &size, &descr, &shortDescr, &destDir, &destFile) == 0) - return 0; - - pkgAcquire *fetcher = GetCpp(pyfetcher); - pkgAcqFile *af = new pkgAcqFile(fetcher, // owner - uri, // uri - md5, // md5 - size, // size - descr, // descr - shortDescr, - destDir, - destFile); // short-desc - CppPyObject *AcqFileObj = CppPyObject_NEW(NULL, &PyAcquireFile_Type); - AcqFileObj->Object = af; - AcqFileObj->NoDelete = true; - - return AcqFileObj; -} -#endif diff --git a/python/acquire.cc b/python/acquire.cc index 45b4493c..82968a9d 100644 --- a/python/acquire.cc +++ b/python/acquire.cc @@ -400,12 +400,4 @@ PyTypeObject PyAcquire_Type = { PkgAcquireNew, // tp_new }; -#ifdef COMPAT_0_7 -PyObject *GetAcquire(PyObject *Self,PyObject *Args) -{ - PyErr_WarnEx(PyExc_DeprecationWarning,"apt_pkg.GetAcquire() is deprecated." - " Please see apt_pkg.Acquire() for the replacement.", 1); - return PkgAcquireNew(&PyAcquire_Type,Args,0); -} -#endif diff --git a/python/apt_instmodule.cc b/python/apt_instmodule.cc index 732f1bd0..0f0a187a 100644 --- a/python/apt_instmodule.cc +++ b/python/apt_instmodule.cc @@ -23,148 +23,7 @@ #include /*}}}*/ -#ifdef COMPAT_0_7 - -// debExtractControl - Exctract an arbitary control member /*{{{*/ -// --------------------------------------------------------------------- -/* This is a common operation so this function will stay, but others that - expose the full range of the apt-inst .deb processing will join it some - day. */ -static char *doc_debExtractControl = -"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) -{ - char *Member = "control"; - PyObject *File; - if (PyArg_ParseTuple(Args,"O|s",&File,&Member) == 0) - return 0; - - // Subscope makes sure any clean up errors are properly handled. - PyObject *Res = 0; - { - // Open the file and associate the .deb - int fileno = PyObject_AsFileDescriptor(File); - if (fileno == -1) - return 0; - FileFd Fd(fileno,false); - debDebFile Deb(Fd); - if (_error->PendingError() == true) - return HandleErrors(); - - debDebFile::MemControlExtract Extract(Member); - if (Extract.Read(Deb) == false) - return HandleErrors(); - - // Build the return result - - if (Extract.Control == 0) - { - Py_INCREF(Py_None); - Res = Py_None; - } - else - Res = PyString_FromStringAndSize(Extract.Control,Extract.Length+2); - } - - return HandleErrors(Res); -} - /*}}}*/ - -// debExtractArchive - Exctract the archive /*{{{*/ -// --------------------------------------------------------------------- -static char *doc_debExtractArchive = -"deb_extract_archive(File,rootdir) -> Bool\n" -"Extracts the Archive into the given root dir"; -static PyObject *debExtractArchive(PyObject *Self,PyObject *Args) -{ - char *Rootdir = NULL; - char cwd[512]; - PyObject *File; - if (PyArg_ParseTuple(Args,"O|s",&File,&Rootdir) == 0) - return 0; - - // Subscope makes sure any clean up errors are properly handled. - bool res = false; - { - if(Rootdir != NULL) - { - getcwd(cwd, sizeof(cwd)); - chdir(Rootdir); - } - - // Open the file and associate the .deb - int fileno = PyObject_AsFileDescriptor(File); - if (fileno == -1) - return 0; - FileFd Fd(fileno,false); - debDebFile Deb(Fd); - if (_error->PendingError() == true) { - if (Rootdir != NULL) - chdir (cwd); - return HandleErrors(); - } - - // extracts relative to the current dir - pkgDirStream Extract; - res = Deb.ExtractArchive(Extract); - - if (Rootdir != NULL) - chdir (cwd); - if (res == false) - return HandleErrors(PyBool_FromLong(res)); - } - return HandleErrors(PyBool_FromLong(res)); -} - /*}}}*/ -// arFindMember - Find member in AR archive /*{{{*/ -// --------------------------------------------------------------------- -static char *doc_arCheckMember = -"ar_check_member(file, membername) -> Bool\n"; -static PyObject *arCheckMember(PyObject *Self,PyObject *Args) -{ - char *Member = NULL; - bool res = false; - PyObject *File; - if (PyArg_ParseTuple(Args,"Os",&File,&Member) == 0) - return 0; - - // Open the file and associate the .deb - int fileno = PyObject_AsFileDescriptor(File); - if (fileno == -1) - return 0; - FileFd Fd(fileno,false); - ARArchive AR(Fd); - if (_error->PendingError() == true) - return HandleErrors(); - - if(AR.FindMember(Member) != 0) - res = true; - - return HandleErrors(PyBool_FromLong(res)); -} - /*}}}*/ - -// initapt_inst - Core Module Initialization /*{{{*/ -// --------------------------------------------------------------------- -/* */ -static PyMethodDef methods[] = -{ - // access to ar files - {"arCheckMember", arCheckMember, METH_VARARGS, doc_arCheckMember}, - - // access to deb files - {"debExtractControl",debExtractControl,METH_VARARGS,doc_debExtractControl}, - {"debExtractArchive",debExtractArchive,METH_VARARGS,doc_debExtractArchive}, - - // access to tar streams - {"tarExtract",tarExtract,METH_VARARGS,doc_tarExtract}, - {"debExtract",debExtract,METH_VARARGS,doc_debExtract}, - {} -}; -#else static PyMethodDef *methods = 0; -#endif // defined(COMPAT_0_7) static const char *apt_inst_doc = diff --git a/python/apt_instmodule.h b/python/apt_instmodule.h index f6b337f4..ad4e9f72 100644 --- a/python/apt_instmodule.h +++ b/python/apt_instmodule.h @@ -14,12 +14,6 @@ #include "generic.h" #include -#ifdef COMPAT_0_7 -PyObject *debExtract(PyObject *Self,PyObject *Args); -extern char *doc_debExtract; -PyObject *tarExtract(PyObject *Self,PyObject *Args); -extern char *doc_tarExtract; -#endif extern PyTypeObject PyArMember_Type; extern PyTypeObject PyArArchive_Type; diff --git a/python/apt_pkgmodule.cc b/python/apt_pkgmodule.cc index 7704aa01..5e48be04 100644 --- a/python/apt_pkgmodule.cc +++ b/python/apt_pkgmodule.cc @@ -53,15 +53,6 @@ static PyObject *py_gettext(PyObject *self, PyObject *Args) { // newConfiguration - Build a new configuration class /*{{{*/ // --------------------------------------------------------------------- -#ifdef COMPAT_0_7 -static char *doc_newConfiguration = "Construct a configuration instance"; -static PyObject *newConfiguration(PyObject *self,PyObject *args) -{ - PyErr_WarnEx(PyExc_DeprecationWarning, "apt_pkg.newConfiguration() is " - "deprecated. Use apt_pkg.Configuration() instead.", 1); - return CppPyObject_NEW(NULL, &PyConfiguration_Type, new Configuration()); -} -#endif /*}}}*/ // Version Wrappers /*{{{*/ @@ -124,32 +115,6 @@ static PyObject *CheckDep(PyObject *Self,PyObject *Args) return PyBool_FromLong(_system->VS->CheckDep(A,Op,B)); } -#ifdef COMPAT_0_7 -static char *doc_CheckDepOld = "CheckDep(PkgVer,DepOp,DepVer) -> bool"; -static PyObject *CheckDepOld(PyObject *Self,PyObject *Args) -{ - char *A; - char *B; - char *OpStr; - unsigned int Op = 0; - - if (PyArg_ParseTuple(Args,"sss",&A,&OpStr,&B) == 0) - return 0; - if (*debListParser::ConvertRelation(OpStr,Op) != 0) - { - PyErr_SetString(PyExc_ValueError,"Bad comparision operation"); - return 0; - } - - if (_system == 0) - { - PyErr_SetString(PyExc_ValueError,"_system not initialized"); - return 0; - } - - return PyBool_FromLong(_system->VS->CheckDep(A,Op,B)); -} -#endif static char *doc_UpstreamVersion = "upstream_version(ver: str) -> str\n\n" @@ -249,16 +214,6 @@ static PyObject *ParseSrcDepends(PyObject *Self,PyObject *Args) { return RealParseDepends(Self, Args, true, "parse_src_depends"); } -#ifdef COMPAT_0_7 -static PyObject *ParseDepends_old(PyObject *Self,PyObject *Args) -{ - return RealParseDepends(Self, Args, false, "ParseDepends", true); -} -static PyObject *ParseSrcDepends_old(PyObject *Self,PyObject *Args) -{ - return RealParseDepends(Self, Args, true, "ParseSrcDepends", true); -} -#endif /*}}}*/ // md5sum - Compute the md5sum of a file or string /*{{{*/ // --------------------------------------------------------------------- @@ -615,55 +570,6 @@ static PyMethodDef methods[] = "Convert the given RFC 1123 formatted string to a Unix timestamp."}, // DEPRECATED - #ifdef COMPAT_0_7 - {"CheckDep",CheckDepOld,METH_VARARGS,doc_CheckDepOld}, - {"newConfiguration",newConfiguration,METH_VARARGS,doc_newConfiguration}, - {"InitConfig",InitConfig,METH_VARARGS,doc_InitConfig}, - {"InitSystem",InitSystem,METH_VARARGS,doc_InitSystem}, - - {"ParseSection",ParseSection,METH_VARARGS,doc_ParseSection}, - {"ParseTagFile",ParseTagFile,METH_VARARGS,doc_ParseTagFile}, - {"RewriteSection",RewriteSection,METH_VARARGS,doc_RewriteSection}, - - {"GetLock",GetLock,METH_VARARGS,doc_GetLock}, - {"PkgSystemLock",PkgSystemLock,METH_VARARGS,doc_PkgSystemLock}, - {"PkgSystemUnLock",PkgSystemUnLock,METH_VARARGS,doc_PkgSystemUnLock}, - - {"ReadConfigFile",LoadConfig,METH_VARARGS,doc_LoadConfig}, - {"ReadConfigDir",LoadConfigDir,METH_VARARGS,doc_LoadConfigDir}, - {"ReadConfigFileISC",LoadConfigISC,METH_VARARGS,doc_LoadConfig}, - {"ParseCommandLine",ParseCommandLine,METH_VARARGS,doc_ParseCommandLine}, - - {"VersionCompare",VersionCompare,METH_VARARGS,doc_VersionCompare}, - {"UpstreamVersion",UpstreamVersion,METH_VARARGS,doc_UpstreamVersion}, - - {"ParseDepends",ParseDepends_old,METH_VARARGS,doc_ParseDepends}, - {"ParseSrcDepends",ParseSrcDepends_old,METH_VARARGS,doc_ParseDepends}, - - {"CheckDomainList",StrCheckDomainList,METH_VARARGS, - "CheckDomainList(String,String) -> Bool"}, - {"QuoteString",StrQuoteString,METH_VARARGS,"QuoteString(String,String) -> String"}, - {"DeQuoteString",StrDeQuote,METH_VARARGS,"DeQuoteString(String) -> String"}, - {"SizeToStr",StrSizeToStr,METH_VARARGS,"SizeToStr(int) -> String"}, - {"TimeToStr",StrTimeToStr,METH_VARARGS,"TimeToStr(int) -> String"}, - {"URItoFileName",StrURItoFileName,METH_VARARGS,"URItoFileName(String) -> String"}, - {"Base64Encode",StrBase64Encode,METH_VARARGS,"Base64Encode(String) -> String"}, - {"StringToBool",StrStringToBool,METH_VARARGS,"StringToBool(String) -> int"}, - {"TimeRFC1123",StrTimeRFC1123,METH_VARARGS,"TimeRFC1123(int) -> String"}, - {"StrToTime",StrStrToTime,METH_VARARGS,"StrToTime(String) -> Int"}, - - {"GetCache",TmpGetCache,METH_VARARGS,"GetCache() -> PkgCache"}, - {"GetDepCache",GetDepCache,METH_VARARGS,"GetDepCache(Cache) -> DepCache"}, - {"GetPkgRecords",GetPkgRecords,METH_VARARGS,"GetPkgRecords(Cache) -> PkgRecords"}, - {"GetPkgSrcRecords",GetPkgSrcRecords,METH_VARARGS,"GetPkgSrcRecords() -> PkgSrcRecords"}, - {"GetPkgSourceList",GetPkgSourceList,METH_VARARGS,"GetPkgSourceList() -> PkgSourceList"}, - {"GetPkgProblemResolver",GetPkgProblemResolver,METH_VARARGS,"GetDepProblemResolver(DepCache) -> PkgProblemResolver"}, - {"GetPkgActionGroup",GetPkgActionGroup,METH_VARARGS,"GetPkgActionGroup(DepCache) -> PkgActionGroup"}, - {"GetCdrom",GetCdrom,METH_VARARGS,"GetCdrom() -> Cdrom"}, - {"GetAcquire",GetAcquire,METH_VARARGS,"GetAcquire() -> Acquire"}, - {"GetPkgAcqFile",(PyCFunction)GetPkgAcqFile,METH_KEYWORDS|METH_VARARGS, doc_GetPkgAcqFile}, - {"GetPackageManager",GetPkgManager,METH_VARARGS,"GetPackageManager(DepCache) -> PackageManager"}, - #endif {} }; @@ -821,10 +727,6 @@ extern "C" void initapt_pkg() // Global configuration, should never be deleted. Config->NoDelete = true; PyModule_AddObject(Module,"config",Config); - #ifdef COMPAT_0_7 - Py_INCREF(Config); - PyModule_AddObject(Module,"Config",Config); - #endif @@ -904,14 +806,6 @@ extern "C" void initapt_pkg() MkPyNumber(pkgAcquire::Continue)); PyDict_SetItemString(PyAcquire_Type.tp_dict, "RESULT_FAILED", MkPyNumber(pkgAcquire::Failed)); -#ifdef COMPAT_0_7 - PyDict_SetItemString(PyAcquire_Type.tp_dict, "ResultCancelled", - MkPyNumber(pkgAcquire::Cancelled)); - PyDict_SetItemString(PyAcquire_Type.tp_dict, "ResultContinue", - MkPyNumber(pkgAcquire::Continue)); - PyDict_SetItemString(PyAcquire_Type.tp_dict, "ResultFailed", - MkPyNumber(pkgAcquire::Failed)); -#endif // Dependency constants PyDict_SetItemString(PyDependency_Type.tp_dict, "TYPE_DEPENDS", MkPyNumber(pkgCache::Dep::Depends)); @@ -941,14 +835,6 @@ extern "C" void initapt_pkg() PyDict_SetItemString(PyPackageManager_Type.tp_dict, "RESULT_INCOMPLETE", MkPyNumber(pkgPackageManager::Incomplete)); -#ifdef COMPAT_0_7 - PyDict_SetItemString(PyPackageManager_Type.tp_dict, "ResultCompleted", - MkPyNumber(pkgPackageManager::Completed)); - PyDict_SetItemString(PyPackageManager_Type.tp_dict, "ResultFailed", - MkPyNumber(pkgPackageManager::Failed)); - PyDict_SetItemString(PyPackageManager_Type.tp_dict, "ResultIncomplete", - MkPyNumber(pkgPackageManager::Incomplete)); -#endif PyDict_SetItemString(PyVersion_Type.tp_dict, "MULTI_ARCH_NONE", MkPyNumber(pkgCache::Version::None)); @@ -978,18 +864,6 @@ extern "C" void initapt_pkg() PyDict_SetItemString(PyAcquireItem_Type.tp_dict, "STAT_AUTH_ERROR", MkPyNumber(pkgAcquire::Item::StatAuthError)); -#ifdef COMPAT_0_7 - PyDict_SetItemString(PyAcquireItem_Type.tp_dict, "StatIdle", - MkPyNumber(pkgAcquire::Item::StatIdle)); - PyDict_SetItemString(PyAcquireItem_Type.tp_dict, "StatFetching", - MkPyNumber(pkgAcquire::Item::StatFetching)); - PyDict_SetItemString(PyAcquireItem_Type.tp_dict, "StatDone", - MkPyNumber(pkgAcquire::Item::StatDone)); - PyDict_SetItemString(PyAcquireItem_Type.tp_dict, "StatError", - MkPyNumber(pkgAcquire::Item::StatError)); - PyDict_SetItemString(PyAcquireItem_Type.tp_dict, "StatAuthError", - MkPyNumber(pkgAcquire::Item::StatAuthError)); -#endif #if PY_MAJOR_VERSION >= 3 && PY_MINOR_VERSION >= 1 PyObject *PyCapsule = PyCapsule_New(&API, "apt_pkg._C_API", NULL); @@ -1030,38 +904,7 @@ extern "C" void initapt_pkg() // DEPRECATED API - #ifdef COMPAT_0_7 - PyModule_AddObject(Module,"RewritePackageOrder", - CharCharToList(TFRewritePackageOrder)); - PyModule_AddObject(Module,"RewriteSourceOrder", - CharCharToList(TFRewriteSourceOrder)); - PyModule_AddStringConstant(Module,"LibVersion",(char *)pkgLibVersion); - PyModule_AddStringConstant(Module,"Date",__DATE__); - PyModule_AddStringConstant(Module,"Time",__TIME__); - 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); - PyModule_AddIntConstant(Module,"CurStateNotInstalled",pkgCache::State::NotInstalled); - PyModule_AddIntConstant(Module,"CurStateUnPacked",pkgCache::State::UnPacked); - PyModule_AddIntConstant(Module,"CurStateHalfConfigured",pkgCache::State::HalfConfigured); - PyModule_AddIntConstant(Module,"CurStateHalfInstalled",pkgCache::State::HalfInstalled); - PyModule_AddIntConstant(Module,"CurStateConfigFiles",pkgCache::State::ConfigFiles); - PyModule_AddIntConstant(Module,"CurStateInstalled",pkgCache::State::Installed); - PyModule_AddIntConstant(Module,"SelStateUnknown",pkgCache::State::Unknown); - PyModule_AddIntConstant(Module,"SelStateInstall",pkgCache::State::Install); - PyModule_AddIntConstant(Module,"SelStateHold",pkgCache::State::Hold); - PyModule_AddIntConstant(Module,"SelStateDeInstall",pkgCache::State::DeInstall); - PyModule_AddIntConstant(Module,"SelStatePurge",pkgCache::State::Purge); - PyModule_AddIntConstant(Module,"InstStateOk",pkgCache::State::Ok); - PyModule_AddIntConstant(Module,"InstStateReInstReq",pkgCache::State::ReInstReq); - PyModule_AddIntConstant(Module,"InstStateHold",pkgCache::State::Hold); - PyModule_AddIntConstant(Module,"InstStateHoldReInstReq",pkgCache::State::HoldReInstReq); - PyModule_AddIntConstant(Module,"_COMPAT_0_7",1); - #else PyModule_AddIntConstant(Module,"_COMPAT_0_7",0); - #endif #if PY_MAJOR_VERSION >= 3 return Module; #endif diff --git a/python/cache.cc b/python/cache.cc index 01330adb..65b99210 100644 --- a/python/cache.cc +++ b/python/cache.cc @@ -161,63 +161,10 @@ static PyObject *PkgCacheUpdate(PyObject *Self,PyObject *Args) return HandleErrors(PyRes); } -#ifdef COMPAT_0_7 -static PyObject *PkgCacheClose(PyObject *Self,PyObject *Args) -{ - PyErr_WarnEx(PyExc_DeprecationWarning, "Cache.Close() is deprecated, " - "because it causes segfaults. Delete the Cache instead.", 1); - PyObject *CacheFilePy = GetOwner(Self); - pkgCacheFile *Cache = GetCpp(CacheFilePy); - Cache->Close(); - - Py_INCREF(Py_None); - return HandleErrors(Py_None); -} - -static PyObject *PkgCacheOpen(PyObject *Self,PyObject *Args) -{ - PyErr_WarnEx(PyExc_DeprecationWarning, "Cache.Open() is deprecated, " - "because it causes memory leaks. Create a new Cache instead.", - 1); - PyObject *CacheFilePy = GetOwner(Self); - pkgCacheFile *Cache = GetCpp(CacheFilePy); - - PyObject *pyCallbackInst = 0; - if (PyArg_ParseTuple(Args, "|O", &pyCallbackInst) == 0) - return 0; - - if(pyCallbackInst != 0) { - PyOpProgress progress; - progress.setCallbackInst(pyCallbackInst); - if (Cache->Open(progress,false) == false) - return HandleErrors(); - } else { - OpTextProgress Prog; - if (Cache->Open(Prog,false) == false) - return HandleErrors(); - } - - //std::cout << "new cache is " << (pkgCache*)(*Cache) << std::endl; - - // ensure that the states are correct (LP: #659438) - pkgApplyStatus(*Cache); - - // update the cache pointer after the cache was rebuild - ((CppPyObject *)Self)->Object = (pkgCache*)(*Cache); - - Py_INCREF(Py_None); - return HandleErrors(Py_None); -} -#endif static PyMethodDef PkgCacheMethods[] = { {"update",PkgCacheUpdate,METH_VARARGS,cache_update_doc}, -#ifdef COMPAT_0_7 - {"Open", PkgCacheOpen, METH_VARARGS, - "Open the cache; deprecated and unsafe"}, - {"Close", PkgCacheClose, METH_VARARGS,"Close the cache"}, -#endif {} }; @@ -1654,11 +1601,3 @@ PyTypeObject PyDependencyList_Type = /*}}}*/ -#ifdef COMPAT_0_7 -PyObject *TmpGetCache(PyObject *Self,PyObject *Args) -{ - PyErr_WarnEx(PyExc_DeprecationWarning, "apt_pkg.GetCache() is deprecated. " - "Please see apt_pkg.Cache() for the replacement.", 1); - return PkgCacheNew(&PyCache_Type,Args,0); -} -#endif diff --git a/python/cdrom.cc b/python/cdrom.cc index 46bb769c..392dd834 100644 --- a/python/cdrom.cc +++ b/python/cdrom.cc @@ -78,38 +78,10 @@ static PyObject *cdrom_ident(PyObject *Self,PyObject *Args) } } -#ifdef COMPAT_0_7 -static PyObject *cdrom_ident_old(PyObject *Self,PyObject *Args) -{ - PyErr_WarnEx(PyExc_DeprecationWarning, "Method 'Ident' of the " - "'apt_pkg.Cdrom' object is deprecated, use 'ident' instead.", - 1); - pkgCdrom &Cdrom = GetCpp(Self); - - PyObject *pyCdromProgressInst = 0; - if (PyArg_ParseTuple(Args, "O", &pyCdromProgressInst) == 0) { - return 0; - } - - PyCdromProgress progress; - progress.setCallbackInst(pyCdromProgressInst); - - std::string ident; - bool res = Cdrom.Ident(ident, &progress); - - PyObject *boolres = PyBool_FromLong(res); - PyObject *result = Py_BuildValue("(Os)", boolres, ident.c_str()); - - return HandleErrors(result); -} -#endif static PyMethodDef cdrom_methods[] = { {"add",cdrom_add,METH_VARARGS,cdrom_add_doc}, {"ident",cdrom_ident,METH_VARARGS,cdrom_ident_doc}, -#ifdef COMPAT_0_7 - {"Ident",cdrom_ident_old,METH_VARARGS,"DEPRECATED. DO NOT USE"}, -#endif {} }; @@ -165,11 +137,3 @@ PyTypeObject PyCdrom_Type = { cdrom_new, // tp_new }; -#ifdef COMPAT_0_7 -PyObject *GetCdrom(PyObject *Self,PyObject *Args) -{ - PyErr_WarnEx(PyExc_DeprecationWarning, "apt_pkg.GetCdrom() is deprecated. " - "Please see apt_pkg.Cdrom() for the replacement.", 1); - return cdrom_new(&PyCdrom_Type,Args,0); -} -#endif diff --git a/python/depcache.cc b/python/depcache.cc index 73993c82..acd41a85 100644 --- a/python/depcache.cc +++ b/python/depcache.cc @@ -794,14 +794,6 @@ PyTypeObject PyDepCache_Type = PkgDepCacheNew, // tp_new }; -#ifdef COMPAT_0_7 -PyObject *GetDepCache(PyObject *Self,PyObject *Args) -{ - PyErr_WarnEx(PyExc_DeprecationWarning,"apt_pkg.GetDepCache() is deprecated" - ". Please see apt_pkg.DepCache() for the replacement.",1); - return PkgDepCacheNew(&PyDepCache_Type,Args,0); -} -#endif @@ -829,14 +821,6 @@ static PyObject *PkgProblemResolverNew(PyTypeObject *type,PyObject *Args,PyObjec return PkgProblemResolverPyObj; } -#ifdef COMPAT_0_7 -PyObject *GetPkgProblemResolver(PyObject *Self,PyObject *Args) { - PyErr_WarnEx(PyExc_DeprecationWarning, "apt_pkg.GetPkgProblemResolver() is" - " deprecated. Please see apt_pkg.ProblemResolver() for the " - "replacement.", 1); - return PkgProblemResolverNew(&PyProblemResolver_Type,Args,0); -} -#endif static PyObject *PkgProblemResolverResolve(PyObject *Self,PyObject *Args) { @@ -1121,15 +1105,6 @@ PyTypeObject PyActionGroup_Type = PkgActionGroupNew, // tp_new }; -#ifdef COMPAT_0_7 -PyObject *GetPkgActionGroup(PyObject *Self,PyObject *Args) -{ - PyErr_WarnEx(PyExc_DeprecationWarning, "apt_pkg.GetPkgActionGroup() is " - "deprecated. Please see apt_pkg.ActionGroup() for the " - "replacement.", 1); - return PkgActionGroupNew(&PyActionGroup_Type,Args,0); -} -#endif /*}}}*/ diff --git a/python/generic.cc b/python/generic.cc index e04743ff..8e65c4f3 100644 --- a/python/generic.cc +++ b/python/generic.cc @@ -49,75 +49,6 @@ PyObject *HandleErrors(PyObject *Res) return 0; } -# ifdef COMPAT_0_7 -// Helpers for deprecation. - -// Given the name of the old attribute, return the name of the new attribute -// in a PyObject. -static PyObject *_PyApt_NewNameForAttribute(const char *attr) { - // Some exceptions from the standard algorithm. - if (strcasecmp(attr, "FileName") == 0) return PyString_FromString("filename"); - if (strcasecmp(attr, "DestFile") == 0) return PyString_FromString("destfile"); - if (strcasecmp(attr, "FileSize") == 0) return PyString_FromString("filesize"); - if (strcasecmp(attr, "SubTree") == 0) return PyString_FromString("subtree"); - if (strcasecmp(attr, "ReadPinFile") == 0) return PyString_FromString("read_pinfile"); - if (strcasecmp(attr, "SetReInstall") == 0) return PyString_FromString("set_reinstall"); - if (strcasecmp(attr, "URI") == 0) return PyString_FromString("uri"); - if (strcasecmp(attr, "ArchiveURI") == 0) return PyString_FromString("archive_uri"); - if (strcasecmp(attr, "MD5Hash") == 0) return PyString_FromString("md5_hash"); - if (strcasecmp(attr, "SHA1Hash") == 0) return PyString_FromString("sha1_hash"); - if (strcasecmp(attr, "SHA256Hash") == 0) return PyString_FromString("sha256_hash"); - if (strcasecmp(attr, "UntranslatedDepType") == 0) return PyString_FromString("dep_type_untranslated"); - size_t attrlen = strlen(attr); - // Reserve the old name + 5, this should reduce resize to a minimum. - string new_name; - new_name.reserve(attrlen + 5); - for(unsigned int i=0; i < attrlen; i++) { - // Replace all uppercase ASCII characters with their lower-case ones. - if (attr[i] > 64 && attr[i] < 91) { - if (i > 0) - new_name += "_"; - new_name += attr[i] + 32; - } else { - new_name += attr[i]; - } - } - return CppPyString(new_name); -} - -// Handle deprecated attributes by setting a warning and returning the new -// attribute. -PyObject *_PyAptObject_getattro(PyObject *self, PyObject *attr) { - PyObject *value = PyObject_GenericGetAttr(self, attr); - if (value == NULL) { - PyObject *ptype, *pvalue, *ptraceback; - PyErr_Fetch(&ptype, &pvalue, &ptraceback); - const char *attrname = PyObject_AsString(attr); - PyObject *newattr = _PyApt_NewNameForAttribute(attrname); - value = PyObject_GenericGetAttr(self, newattr); - if (value != NULL) { - const char *newattrname = PyString_AsString(newattr); - const char *cls = self->ob_type->tp_name; - char *warning_string = new char[strlen(newattrname) + strlen(cls) + - strlen(attrname) + 66]; - sprintf(warning_string, "Attribute '%s' of the '%s' object is " - "deprecated, use '%s' instead.", attrname, cls, newattrname); - PyErr_WarnEx(PyExc_DeprecationWarning, warning_string, 1); - delete[] warning_string; - } else { - Py_XINCREF(ptype); - Py_XINCREF(pvalue); - Py_XINCREF(ptraceback); - PyErr_Restore(ptype, pvalue, ptraceback); - } - Py_DECREF(newattr); - Py_XDECREF(ptype); - Py_XDECREF(pvalue); - Py_XDECREF(ptraceback); - } - return value; -} -# endif //COMPAT_0_7 /*}}}*/ // ListToCharChar - Convert a list to an array of char char /*{{{*/ // --------------------------------------------------------------------- diff --git a/python/generic.h b/python/generic.h index 914456e2..e4679c6c 100644 --- a/python/generic.h +++ b/python/generic.h @@ -58,8 +58,6 @@ typedef int Py_ssize_t; #define PyInt_Check PyLong_Check #define PyInt_AsLong PyLong_AsLong #define PyInt_FromLong PyLong_FromLong -// Force 0.7 compatibility to be off in Python 3 builds -#undef COMPAT_0_7 #else // Compatibility for Python 2.5 and previous. #if (PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION <= 5) @@ -251,10 +249,6 @@ inline PyObject *MkPyNumber(char o) { return PyInt_FromLong(o); } inline PyObject *MkPyNumber(double o) { return PyFloat_FromDouble(o); } -# ifdef COMPAT_0_7 -PyObject *_PyAptObject_getattro(PyObject *self, PyObject *attr); -# else # define _PyAptObject_getattro 0 -# endif #endif diff --git a/python/pkgmanager.cc b/python/pkgmanager.cc index 9a5d0e5b..5fff1e57 100644 --- a/python/pkgmanager.cc +++ b/python/pkgmanager.cc @@ -225,15 +225,6 @@ static PyObject *PkgManagerNew(PyTypeObject *type,PyObject *Args,PyObject *kwds) return PkgManagerObj; } -#ifdef COMPAT_0_7 -PyObject *GetPkgManager(PyObject *Self,PyObject *Args) -{ - PyErr_WarnEx(PyExc_DeprecationWarning, "apt_pkg.GetPackageManager() is " - "deprecated. Please see apt_pkg.PackageManager() for the " - "replacement.", 1); - return PkgManagerNew(&PyPackageManager2_Type,Args,0); -} -#endif static PyObject *PkgManagerInstall(PyObject *Self,PyObject *Args) { diff --git a/python/pkgrecords.cc b/python/pkgrecords.cc index 8d2cb502..8e6084a9 100644 --- a/python/pkgrecords.cc +++ b/python/pkgrecords.cc @@ -218,12 +218,3 @@ PyTypeObject PyPackageRecords_Type = /*}}}*/ -#ifdef COMPAT_0_7 -PyObject *GetPkgRecords(PyObject *Self,PyObject *Args) -{ - PyErr_WarnEx(PyExc_DeprecationWarning, "apt_pkg.GetPkgRecords() is " - "deprecated. Please see apt_pkg.Records() for the " - "replacement.", 1); - return PkgRecordsNew(&PyPackageRecords_Type,Args,0); -} -#endif diff --git a/python/pkgsrcrecords.cc b/python/pkgsrcrecords.cc index 4c889129..6a60a9af 100644 --- a/python/pkgsrcrecords.cc +++ b/python/pkgsrcrecords.cc @@ -205,29 +205,6 @@ static PyObject *PkgSrcRecordsGetBuildDepends(PyObject *Self,void*) { return Dict; } -#ifdef COMPAT_0_7 -static PyObject *PkgSrcRecordsGetBuildDepends_old(PyObject *Self,void*) { - PkgSrcRecordsStruct &Struct = GetStruct(Self,"BuildDepends"); - if (Struct.Last == 0) - return 0; - PyObject *List = PyList_New(0); - - vector bd; - if(!Struct.Last->BuildDepends(bd, false /* arch-only*/)) - return NULL; // error - - PyObject *v; - for(unsigned int i=0;i(NULL, &PySourceRecords_Type)); -} -#endif diff --git a/python/progress.cc b/python/progress.cc index 9e870875..aedd7581 100644 --- a/python/progress.cc +++ b/python/progress.cc @@ -95,15 +95,7 @@ void PyOpProgress::Update() setattr(callbackInst, "subop", "s", SubOp.c_str()); setattr(callbackInst, "major_change", "b", MajorChange); setattr(callbackInst, "percent", "N", MkPyNumber(Percent)); -#ifdef COMPAT_0_7 - setattr(callbackInst, "Op", "s", Op.c_str()); - setattr(callbackInst, "subOp", "s", SubOp.c_str()); - setattr(callbackInst, "majorChange", "b", MajorChange); - PyObject *arglist = Py_BuildValue("(N)", MkPyNumber(Percent)); - RunSimpleCallback("update", arglist); -#else RunSimpleCallback("update"); -#endif } void PyOpProgress::Done() @@ -241,13 +233,6 @@ void PyFetchProgress::Start() //std::cout << "Start" << std::endl; pkgAcquireStatus::Start(); -#ifdef COMPAT_0_7 - setattr(callbackInst, "currentCPS", "N", MkPyNumber(0)); - setattr(callbackInst, "currentBytes", "N", MkPyNumber(0)); - setattr(callbackInst, "currentItems", "N", MkPyNumber(0)); - setattr(callbackInst, "totalItems", "N", MkPyNumber(0)); - setattr(callbackInst, "totalBytes", "N", MkPyNumber(0)); -#endif RunSimpleCallback("start"); /* After calling the start method we can safely allow @@ -314,106 +299,7 @@ bool PyFetchProgress::Pulse(pkgAcquire * Owner) PyCbObj_BEGIN_ALLOW_THREADS return true; } -#ifdef COMPAT_0_7 - setattr(callbackInst, "currentCPS", "N", MkPyNumber(CurrentCPS)); - setattr(callbackInst, "currentBytes", "N", MkPyNumber(CurrentBytes)); - setattr(callbackInst, "totalBytes", "N", MkPyNumber(TotalBytes)); - setattr(callbackInst, "fetchedBytes", "N", MkPyNumber(FetchedBytes)); - setattr(callbackInst, "currentItems", "N", MkPyNumber(CurrentItems)); - setattr(callbackInst, "totalItems", "N", MkPyNumber(TotalItems)); - // Go through the list of items and add active items to the - // activeItems vector. - map activeItemMap; - - for(pkgAcquire::Worker *Worker = Owner->WorkersBegin(); - Worker != 0; Worker = Owner->WorkerStep(Worker)) { - - if (Worker->CurrentItem == 0) { - // Ignore workers with no item running - continue; - } - activeItemMap.insert(std::make_pair(Worker, Worker->CurrentItem)); - } - - // Create the tuple that is passed as argument to pulse(). - // This tuple contains activeItemMap.size() item tuples. - PyObject *arglist; - - if (((int)activeItemMap.size()) > 0) { - PyObject *itemsTuple = PyTuple_New((Py_ssize_t) activeItemMap.size()); - - // Go through activeItems, create an item tuple in the form - // (URI, Description, ShortDesc, FileSize, PartialSize) and - // add that tuple to itemsTuple. - map::iterator iter; - int tuplePos; - - for(tuplePos = 0, iter = activeItemMap.begin(); - iter != activeItemMap.end(); ++iter, tuplePos++) { - pkgAcquire::Worker *worker = iter->first; - pkgAcquire::ItemDesc *itm = iter->second; - - PyObject *itmTuple = Py_BuildValue("(sssNN)", itm->URI.c_str(), - itm->Description.c_str(), - itm->ShortDesc.c_str(), - MkPyNumber(worker->TotalSize), - MkPyNumber(worker->CurrentSize)); - PyTuple_SetItem(itemsTuple, tuplePos, itmTuple); - } - - // Now our itemsTuple is ready for being passed to pulse(). - // pulse() is going to receive a single argument, being the - // tuple of items, which again contains one tuple with item - // information per item. - // - // Python Example: - // - // class MyFetchProgress(FetchProgress): - // def pulse(self, items): - // for itm in items: - // uri, desc, shortdesc, filesize, partialsize = itm - // - arglist = PyTuple_Pack(1, itemsTuple); - } - else { - arglist = Py_BuildValue("(())"); - } - - PyObject *result; - bool res = true; - - if (RunSimpleCallback("pulse_items", arglist, &result)) { - if (result != NULL && PyArg_Parse(result, "b", &res) && res == false) { - // the user returned a explicit false here, stop - PyCbObj_BEGIN_ALLOW_THREADS - return false; - } - } - - - arglist = Py_BuildValue("()"); - if (!RunSimpleCallback("pulse", arglist, &result)) { - PyCbObj_BEGIN_ALLOW_THREADS - return true; - } - - if((result == NULL) || (!PyArg_Parse(result, "b", &res))) - { - // most of the time the user who subclasses the pulse() - // method forgot to add a return {True,False} so we just - // assume he wants a True. There may be a Python exception on the stack - // that must be cleared. - PyErr_Clear(); - PyCbObj_BEGIN_ALLOW_THREADS - return true; - } - - PyCbObj_BEGIN_ALLOW_THREADS - // fetching can be canceld by returning false - return res; -#else return false; -#endif } @@ -548,9 +434,6 @@ void PyCdromProgress::Update(std::string text, int current) { PyObject *arglist = Py_BuildValue("(si)", text.c_str(), current); setattr(callbackInst, "total_steps", "i", totalSteps); - #ifdef COMPAT_0_7 - setattr(callbackInst, "totalSteps", "i", totalSteps); - #endif RunSimpleCallback("update", arglist); } diff --git a/python/sourcelist.cc b/python/sourcelist.cc index 784b161e..a38cb1bb 100644 --- a/python/sourcelist.cc +++ b/python/sourcelist.cc @@ -168,12 +168,3 @@ PyTypeObject PySourceList_Type = PkgSourceListNew, // tp_new }; -#ifdef COMPAT_0_7 -PyObject *GetPkgSourceList(PyObject *Self,PyObject *Args) -{ - PyErr_WarnEx(PyExc_DeprecationWarning, "apt_pkg.GetPkgSourceList() is " - "deprecated. Please see apt_pkg.SourceList() for the " - "replacement.", 1); - return PkgSourceListNew(&PySourceList_Type,Args,0); -} -#endif diff --git a/python/tag.cc b/python/tag.cc index 6ae439f5..a0f526ad 100644 --- a/python/tag.cc +++ b/python/tag.cc @@ -418,16 +418,6 @@ static PyObject *TagSecNew(PyTypeObject *type,PyObject *Args,PyObject *kwds) { return New; } -#ifdef COMPAT_0_7 -char *doc_ParseSection = "ParseSection(Text) -> TagSection()\n\nDeprecated."; -PyObject *ParseSection(PyObject *self,PyObject *Args) -{ - PyErr_WarnEx(PyExc_DeprecationWarning, "apt_pkg.ParseSection() is " - "deprecated. Please see apt_pkg.TagSection() for the " - "replacement.", 1); - return TagSecNew(&PyTagSection_Type,Args,0); -} -#endif /*}}}*/ // ParseTagFile - Parse a tagd file /*{{{*/ // --------------------------------------------------------------------- @@ -507,15 +497,6 @@ static PyObject *TagFileNew(PyTypeObject *type,PyObject *Args,PyObject *kwds) return HandleErrors(New); } -#ifdef COMPAT_0_7 -char *doc_ParseTagFile = "ParseTagFile(file) -> TagFile()\n\nDeprecated."; -PyObject *ParseTagFile(PyObject *self,PyObject *Args) { - PyErr_WarnEx(PyExc_DeprecationWarning, "apt_pkg.ParseTagFile() is " - "deprecated. Please see apt_pkg.TagFile() for the " - "replacement.", 1); - return TagFileNew(&PyTagFile_Type,Args,0); -} -#endif /*}}}*/ // RewriteSection - Rewrite a section.. /*{{{*/ // --------------------------------------------------------------------- diff --git a/python/tar.cc b/python/tar.cc deleted file mode 100644 index e42a9c50..00000000 --- a/python/tar.cc +++ /dev/null @@ -1,197 +0,0 @@ -// -*- mode: cpp; mode: fold -*- -// Description /*{{{*/ -// $Id: tar.cc,v 1.4 2004/12/12 17:55:54 mdz Exp $ -/* ###################################################################### - - Tar Inteface - * THIS FILE IS COMPLETELY DEPRECATED, AND NOT USED ANYMORE IF BUILT * - * WITHOUT COMPATIBILITY. * - - ##################################################################### */ - /*}}}*/ -// Include Files /*{{{*/ -#ifdef COMPAT_0_7 -#include "generic.h" - -#include -#include -#include -#include "apt_instmodule.h" - -#include - /*}}}*/ - -class ProcessTar : public pkgDirStream -{ - public: - - PyObject *Function; - - virtual bool DoItem(Item &Itm,int &Fd); - - ProcessTar(PyObject *Function) : Function(Function) - { - Py_INCREF(Function); - } - virtual ~ProcessTar() - { - Py_DECREF(Function); - } -}; - -// ProcessTar::DoItem - Feed an item to a python function /*{{{*/ -// --------------------------------------------------------------------- -/* The function is called with a tuple that has: - (FileName,Link,Mode,UID,GID,Size,MTime,Major,Minor) */ -bool ProcessTar::DoItem(Item &Itm,int &Fd) -{ - const char *Type; - switch (Itm.Type) - { - case Item::File: - Type = "FILE"; - break; - - case Item::HardLink: - Type = "HARDLINK"; - break; - - case Item::SymbolicLink: - Type = "SYMLINK"; - break; - - case Item::CharDevice: - Type = "CHARDEV"; - break; - - case Item::BlockDevice: - Type = "BLKDEV"; - break; - - case Item::Directory: - Type = "DIR"; - break; - - case Item::FIFO: - Type = "FIFO"; - break; - - default: - return false; - } - - - if (PyObject_CallFunction(Function,"sssiiiiiii",Type,Itm.Name, - Itm.LinkTarget,Itm.Mode,Itm.UID,Itm.GID,Itm.Size, - Itm.MTime,Itm.Major,Itm.Minor) == 0) - return false; - - Fd = -1; - return true; -} - /*}}}*/ - -// tarExtract - Examine files from a tar /*{{{*/ -// --------------------------------------------------------------------- -/* */ -char *doc_tarExtract = -"tarExtract(File,Func,Comp) -> None\n" -"The tar file referenced by the file object File, Func called for each\n" -"Tar member. Comp must be the string \"gzip\" (gzip is automatically invoked) \n"; -PyObject *tarExtract(PyObject *Self,PyObject *Args) -{ - PyObject *File; - PyObject *Function; - char *Comp; - - if (PyArg_ParseTuple(Args,"OOs",&File, &Function,&Comp) == 0) - return 0; - - if (PyCallable_Check(Function) == 0) - { - PyErr_SetString(PyExc_TypeError,"argument 2: expected something callable."); - return 0; - } - - { - // Open the file and associate the tar - int fileno = PyObject_AsFileDescriptor(File); - if (fileno == -1) - return 0; - - FileFd Fd(fileno,false); - ExtractTar Tar(Fd,0xFFFFFFFF,Comp); - if (_error->PendingError() == true) - return HandleErrors(); - - ProcessTar Proc(Function); - if (Tar.Go(Proc) == false) - return HandleErrors(); - } - - Py_INCREF(Py_None); - return HandleErrors(Py_None); -} - /*}}}*/ - -// debExtract - Examine files from a deb /*{{{*/ -// --------------------------------------------------------------------- -/* */ -char *doc_debExtract = -"debExtract(File,Func,Chunk) -> None\n" -"The deb referenced by the file object File is examined. The AR member\n" -"given by Chunk is treated as a tar.gz and fed through Func like\n" -"tarExtract\n"; -PyObject *debExtract(PyObject *Self,PyObject *Args) -{ - PyObject *File; - PyObject *Function; - char *Chunk; - const char *Comp = "gzip"; - - if (PyArg_ParseTuple(Args,"OOs",&File,&Function,&Chunk) == 0) - return 0; - - if (PyCallable_Check(Function) == 0) - { - PyErr_SetString(PyExc_TypeError,"argument 2: expected something callable."); - return 0; - } - - int fileno = PyObject_AsFileDescriptor(File); - if (fileno == -1) - return 0; - { - // Open the file and associate the tar - // Open the file and associate the .deb - FileFd Fd(fileno,false); - debDebFile Deb(Fd); - if (_error->PendingError() == true) - return HandleErrors(); - - // Get the archive member and positition the file - const ARArchive::Member *Member = Deb.GotoMember(Chunk); - if (Member == 0) - { - _error->Error("Cannot find chunk %s",Chunk); - return HandleErrors(); - } - - // Extract it. - if (strcmp(".bz2", &Chunk[strlen(Chunk)-4]) == 0) - Comp = "bzip2"; - else if(strcmp(".lzma", &Chunk[strlen(Chunk)-5]) == 0) - Comp = "lzma"; - else if(strcmp(".xz", &Chunk[strlen(Chunk)-3]) == 0) - Comp = "xz"; - ExtractTar Tar(Deb.GetFile(),Member->Size,Comp); - ProcessTar Proc(Function); - if (Tar.Go(Proc) == false) - return HandleErrors(); - } - - Py_INCREF(Py_None); - return HandleErrors(Py_None); -} - /*}}}*/ -#endif // defined(COMPAT_0_7) diff --git a/setup.py b/setup.py index 8af5c2a6..0c4561c0 100644 --- a/setup.py +++ b/setup.py @@ -43,7 +43,7 @@ files = sorted(['python/' + fname for fname in files], key=lambda s: s[:-3]) apt_pkg = Extension("apt_pkg", files, libraries=["apt-pkg"]) # The apt_inst module -files = ["python/apt_instmodule.cc", "python/generic.cc", "python/tar.cc", +files = ["python/apt_instmodule.cc", "python/generic.cc", "python/arfile.cc", "python/tarfile.cc"] apt_inst = Extension("apt_inst", files, libraries=["apt-pkg", "apt-inst"]) -- cgit v1.2.3 From b3934f4303c419bb6b517f71cce59749cf13f9c4 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Mon, 26 Aug 2013 13:45:40 +0200 Subject: Completely remove deprecated stuff --- apt/__init__.py | 6 - apt/cache.py | 26 --- apt/cdrom.py | 4 - apt/deprecation.py | 106 ------------ apt/package.py | 234 -------------------------- apt/progress/__init__.py | 7 - apt/progress/gtk2.py | 83 --------- apt/progress/old.py | 259 ----------------------------- aptsources/sourceslist.py | 4 - debian/python-apt-common.install | 2 - debian/python-apt-common.lintian-overrides | 2 - doc/source/conf.py | 2 - python/apt_pkgmodule.cc | 2 - utils/migrate-0.8.py | 254 ---------------------------- 14 files changed, 991 deletions(-) delete mode 100644 apt/deprecation.py delete mode 100644 apt/progress/old.py delete mode 100644 debian/python-apt-common.lintian-overrides delete mode 100755 utils/migrate-0.8.py diff --git a/apt/__init__.py b/apt/__init__.py index 677a625b..4ded8e29 100644 --- a/apt/__init__.py +++ b/apt/__init__.py @@ -25,12 +25,6 @@ from apt.package import Package from apt.cache import Cache, ProblemResolver from apt.cdrom import Cdrom -if apt_pkg._COMPAT_0_7: - from apt.progress.old import (OpProgress, FetchProgress, InstallProgress, - CdromProgress) - from apt_pkg import (size_to_str as SizeToStr, time_to_str as TimeToStr, - version_compare as VersionCompare) - # init the package system apt_pkg.init() diff --git a/apt/cache.py b/apt/cache.py index 9842cb2a..928a6207 100644 --- a/apt/cache.py +++ b/apt/cache.py @@ -26,8 +26,6 @@ import weakref import apt_pkg from apt import Package from apt_pkg import gettext as _ -from apt.deprecation import (AttributeDeprecatedBy, function_deprecated_by, - deprecated_args) import apt.progress.text @@ -242,7 +240,6 @@ class Cache(object): changes.append(package) return changes - @deprecated_args def upgrade(self, dist_upgrade=False): """Upgrade all packages. @@ -398,7 +395,6 @@ class Cache(object): providers.add(package) return list(providers) - @deprecated_args def update(self, fetch_progress=None, pulse_interval=0, raise_on_error=True, sources_list=None): """Run the equivalent of apt-get update. @@ -450,7 +446,6 @@ class Cache(object): apt_pkg.config.set("Dir::Etc::sourceparts", old_sources_list_d) apt_pkg.config.set("APT::List-Cleanup", old_cleanup) - @deprecated_args def install_archives(self, pm, install_progress): """ The first parameter *pm* refers to an object returned by @@ -471,7 +466,6 @@ class Cache(object): install_progress.finish_update() return res - @deprecated_args def commit(self, fetch_progress=None, install_progress=None): """Apply the marked changes to the cache. @@ -593,20 +587,6 @@ class Cache(object): """Return the number of packages marked as keep.""" return self._depcache.keep_count - if apt_pkg._COMPAT_0_7: - _runCallbacks = function_deprecated_by(_run_callbacks) - getChanges = function_deprecated_by(get_changes) - requiredDownload = AttributeDeprecatedBy('required_download') - additionalRequiredSpace = AttributeDeprecatedBy('required_space') - reqReinstallPkgs = AttributeDeprecatedBy('req_reinstall_pkgs') - _runFetcher = function_deprecated_by(_run_fetcher) - _fetchArchives = function_deprecated_by(_fetch_archives) - isVirtualPackage = function_deprecated_by(is_virtual_package) - getProvidingPackages = function_deprecated_by(get_providing_packages) - installArchives = function_deprecated_by(install_archives) - cachePostChange = function_deprecated_by(cache_post_change) - cachePreChange = function_deprecated_by(cache_pre_change) - class ProblemResolver(object): """Resolve problems due to dependencies and conflicts. @@ -736,12 +716,6 @@ class FilteredCache(object): #print "getattr: %s " % key return getattr(self.cache, key) - if apt_pkg._COMPAT_0_7: - _reapplyFilter = function_deprecated_by(_reapply_filter) - setFilter = function_deprecated_by(set_filter) - filterCachePostChange = function_deprecated_by(\ - filter_cache_post_change) - def cache_pre_changed(): print "cache pre changed" diff --git a/apt/cdrom.py b/apt/cdrom.py index 9688de9e..3c48fd07 100644 --- a/apt/cdrom.py +++ b/apt/cdrom.py @@ -23,7 +23,6 @@ import glob import apt_pkg -from apt.deprecation import AttributeDeprecatedBy from apt.progress.base import CdromProgress @@ -84,6 +83,3 @@ class Cdrom(apt_pkg.Cdrom): if not line.lstrip().startswith("#") and cd_id in line: return True return False - - if apt_pkg._COMPAT_0_7: - inSourcesList = AttributeDeprecatedBy('in_sources_list') diff --git a/apt/deprecation.py b/apt/deprecation.py deleted file mode 100644 index 0f39ad63..00000000 --- a/apt/deprecation.py +++ /dev/null @@ -1,106 +0,0 @@ -# deprecation.py - Module providing classes and functions for deprecation. -# -# Copyright (c) 2009 Julian Andres Klode -# Copyright (c) 2009 Ben Finney -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -# USA -"""Classes and functions for deprecating features. - -This is used for internal purposes only and not part of the official API. Do -not use it for anything outside the apt package. -""" -import re -import operator -import warnings - -import apt_pkg - -__all__ = [] - - -class AttributeDeprecatedBy(object): - """Property acting as a proxy for a new attribute. - - When accessed, the property issues a DeprecationWarning and (on get) calls - attrgetter() for the attribute 'attribute' on the current object or (on - set) uses setattr to set the value of the wrapped attribute. - """ - - def __init__(self, attribute): - """Initialize the property.""" - self.attribute = attribute - self.__doc__ = 'Deprecated, please use \'%s\' instead' % attribute - self.getter = operator.attrgetter(attribute) - - def __get__(self, obj, type_=None): - """Issue a DeprecationWarning and return the requested value.""" - if obj is None: - return getattr(type_, self.attribute, self) - warnings.warn(self.__doc__, DeprecationWarning, stacklevel=2) - return self.getter(obj or type_) - - def __set__(self, obj, value): - """Issue a DeprecationWarning and set the requested value.""" - warnings.warn(self.__doc__, DeprecationWarning, stacklevel=2) - setattr(obj, self.attribute, value) - - -def function_deprecated_by(func, convert_names=True): - """Return a function that warns it is deprecated by another function. - - Returns a new function that warns it is deprecated by function 'func', - then acts as a pass-through wrapper for 'func'. - - This function also converts all keyword argument names from mixedCase to - lowercase_with_underscores, but only if 'convert_names' is True (default). - """ - warning = 'Deprecated, please use \'%s()\' instead' % func.__name__ - - def deprecated_function(*args, **kwds): - """Wrapper around a deprecated function.""" - warnings.warn(warning, DeprecationWarning, stacklevel=2) - if convert_names: - for key in kwds.keys(): - kwds[re.sub('([A-Z])', '_\\1', key).lower()] = kwds.pop(key) - return func(*args, **kwds) - return deprecated_function - - -def deprecated_args(func): - """A function with deprecated arguments. - - Similar to function_deprecated_by() but warns on every deprecated argument - instead of function calls. - """ - if not apt_pkg._COMPAT_0_7: - return func - - def deprecated_function(*args, **kwds): - """Wrapper around a function with deprecated arguments.""" - for key in kwds.keys(): - new_key = re.sub('([A-Z])', '_\\1', key).lower() - if new_key != key: - warnings.warn("Deprecated parameter %r" % key) - kwds[new_key] = kwds.pop(key) - return func(*args, **kwds) - - # Wrap the function completely (same as functools.wraps) - # pylint: disable-msg=W0622 - deprecated_function.__name__ = func.__name__ - deprecated_function.__doc__ = func.__doc__ - deprecated_function.__module__ = func.__module__ - deprecated_function.__dict__.update(func.__dict__) - return deprecated_function diff --git a/apt/package.py b/apt/package.py index dbaab320..f311eaff 100644 --- a/apt/package.py +++ b/apt/package.py @@ -41,8 +41,6 @@ except ImportError: import apt_pkg import apt.progress.text from apt_pkg import gettext as _ -from apt.deprecation import (function_deprecated_by, AttributeDeprecatedBy, - deprecated_args) __all__ = ('BaseDependency', 'Dependency', 'Origin', 'Package', 'Record', 'Version', 'VersionList') @@ -90,9 +88,6 @@ class BaseDependency(object): return ('' % (self.name, self.relation, self.version, self.pre_depend)) - if apt_pkg._COMPAT_0_7: - preDepend = AttributeDeprecatedBy('pre_depend') - class Dependency(list): """Represent an Or-group of dependencies. @@ -109,25 +104,6 @@ class Dependency(list): def or_dependencies(self): return self -class DeprecatedProperty(property): - """A property which gives DeprecationWarning on access. - - This is only used for providing the properties in Package, which have been - replaced by the ones in Version. - """ - - def __init__(self, fget=None, fset=None, fdel=None, doc=None): - property.__init__(self, fget, fset, fdel, doc) - self.__doc__ = (doc or fget.__doc__ or '') - - def __get__(self, obj, type_=None): - if obj is not None: - warnings.warn("Accessed deprecated property %s.%s, please see the " - "Version class for alternatives." % - ((obj.__class__.__name__ or type_.__name__), - self.fget.__name__), DeprecationWarning, 2) - return property.__get__(self, obj, type_) - class Origin(object): """The origin of a version. @@ -806,36 +782,6 @@ class Package(object): """Return True if the package is an essential part of the system.""" return self._pkg.essential - @DeprecatedProperty - def installedVersion(self): #pylint: disable-msg=C0103 - """Return the installed version as string. - - .. deprecated:: 0.7.9""" - return getattr(self.installed, 'version', None) - - @DeprecatedProperty - def candidateVersion(self): #pylint: disable-msg=C0103 - """Return the candidate version as string. - - .. deprecated:: 0.7.9""" - return getattr(self.candidate, "version", None) - - @DeprecatedProperty - def candidateDependencies(self): #pylint: disable-msg=C0103 - """Return a list of candidate dependencies. - - .. deprecated:: 0.7.9 - """ - return getattr(self.candidate, "dependencies", None) - - @DeprecatedProperty - def installedDependencies(self): #pylint: disable-msg=C0103 - """Return a list of installed dependencies. - - .. deprecated:: 0.7.9 - """ - return getattr(self.installed, 'dependencies', []) - def architecture(self): """Return the Architecture of the package. @@ -846,107 +792,11 @@ class Package(object): """ return self._pkg.architecture - @DeprecatedProperty - def candidateDownloadable(self): #pylint: disable-msg=C0103 - """Return ``True`` if the candidate is downloadable. - - .. deprecated:: 0.7.9 - """ - return getattr(self.candidate, "downloadable", None) - - @DeprecatedProperty - def installedDownloadable(self): #pylint: disable-msg=C0103 - """Return ``True`` if the installed version is downloadable. - - .. deprecated:: 0.7.9 - """ - return getattr(self.installed, 'downloadable', False) - - @DeprecatedProperty - def sourcePackageName(self): #pylint: disable-msg=C0103 - """Return the source package name as string. - - .. deprecated:: 0.7.9 - """ - try: - return self.candidate._records.source_pkg or self._pkg.name - except AttributeError: - try: - return self.installed._records.source_pkg or self._pkg.name - except AttributeError: - return self._pkg.name - - @DeprecatedProperty - def homepage(self): - """Return the homepage field as string. - - .. deprecated:: 0.7.9 - """ - return getattr(self.candidate, "homepage", None) - @property def section(self): """Return the section of the package.""" return self._pkg.section - @DeprecatedProperty - def priority(self): - """Return the priority (of the candidate version). - - .. deprecated:: 0.7.9 - """ - return getattr(self.candidate, "priority", None) - - @DeprecatedProperty - def installedPriority(self): #pylint: disable-msg=C0103 - """Return the priority (of the installed version). - - .. deprecated:: 0.7.9 - """ - return getattr(self.installed, 'priority', None) - - @DeprecatedProperty - def summary(self): - """Return the short description (one line summary). - - .. deprecated:: 0.7.9 - """ - return getattr(self.candidate, "summary", None) - - @DeprecatedProperty - def description(self): - """Return the formatted long description. - - Return the formatted long description according to the Debian policy - (Chapter 5.6.13). - See http://www.debian.org/doc/debian-policy/ch-controlfields.html - for more information. - - .. deprecated:: 0.7.9 - """ - return getattr(self.candidate, "description", None) - - @DeprecatedProperty - def rawDescription(self): #pylint: disable-msg=C0103 - """return the long description (raw). - - .. deprecated:: 0.7.9""" - return getattr(self.candidate, "raw_description", None) - - @DeprecatedProperty - def candidateRecord(self): #pylint: disable-msg=C0103 - """Return the Record of the candidate version of the package. - - .. deprecated:: 0.7.9""" - return getattr(self.candidate, "record", None) - - @DeprecatedProperty - def installedRecord(self): #pylint: disable-msg=C0103 - """Return the Record of the candidate version of the package. - - .. deprecated:: 0.7.9""" - return getattr(self.installed, 'record', '') - # depcache states @property @@ -1007,39 +857,6 @@ class Package(object): return self._pcache._depcache.is_auto_installed(self._pkg) # sizes - @DeprecatedProperty - def packageSize(self): #pylint: disable-msg=C0103 - """Return the size of the candidate deb package. - - .. deprecated:: 0.7.9 - """ - return getattr(self.candidate, "size", None) - - @DeprecatedProperty - def installedPackageSize(self): #pylint: disable-msg=C0103 - """Return the size of the installed deb package. - - .. deprecated:: 0.7.9 - """ - return getattr(self.installed, 'size', 0) - - @DeprecatedProperty - def candidateInstalledSize(self): #pylint: disable-msg=C0103 - """Return the size of the candidate installed package. - - .. deprecated:: 0.7.9 - """ - return getattr(self.candidate, "installed_size", None) - - @DeprecatedProperty - def installedSize(self): #pylint: disable-msg=C0103 - """Return the size of the currently installed package. - - - .. deprecated:: 0.7.9 - """ - return getattr(self.installed, 'installed_size', 0) - @property def installed_files(self): """Return a list of files installed by the package. @@ -1216,14 +1033,6 @@ class Package(object): socket.setdefaulttimeout(timeout) return self._changelog - @DeprecatedProperty - def candidateOrigin(self): #pylint: disable-msg=C0103 - """Return a list of `Origin()` objects for the candidate version. - - .. deprecated:: 0.7.9 - """ - return getattr(self.candidate, "origins", None) - @property def versions(self): """Return a VersionList() object for all available versions. @@ -1250,7 +1059,6 @@ class Package(object): self._pcache._depcache.mark_keep(self._pkg) self._pcache.cache_post_change() - @deprecated_args def mark_delete(self, auto_fix=True, purge=False): """Mark a package for deletion. @@ -1272,7 +1080,6 @@ class Package(object): fix.resolve() self._pcache.cache_post_change() - @deprecated_args def mark_install(self, auto_fix=True, auto_inst=True, from_user=True): """Mark a package for install. @@ -1328,47 +1135,6 @@ class Package(object): self._pcache._depcache.commit(fprogress, iprogress) - if not apt_pkg._COMPAT_0_7: - del installedVersion - del candidateVersion - del candidateDependencies - del installedDependencies - del architecture - del candidateDownloadable - del installedDownloadable - del sourcePackageName - del homepage - del priority - del installedPriority - del summary - del description - del rawDescription - del candidateRecord - del installedRecord - del packageSize - del installedPackageSize - del candidateInstalledSize - del installedSize - del candidateOrigin - else: - markedInstalled = AttributeDeprecatedBy('marked_installed') - markedInstall = AttributeDeprecatedBy('marked_install') - markedUpgrade = AttributeDeprecatedBy('marked_upgrade') - markedDelete = AttributeDeprecatedBy('marked_delete') - markedKeep = AttributeDeprecatedBy('marked_keep') - markedDowngrade = AttributeDeprecatedBy('marked_downgrade') - markedReinstall = AttributeDeprecatedBy('marked_reinstall') - isInstalled = AttributeDeprecatedBy('is_installed') - isUpgradable = AttributeDeprecatedBy('is_upgradable') - isAutoRemovable = AttributeDeprecatedBy('is_auto_removable') - installedFiles = AttributeDeprecatedBy('installed_files') - getChangelog = function_deprecated_by(get_changelog) - markDelete = function_deprecated_by(mark_delete) - markInstall = function_deprecated_by(mark_install) - markKeep = function_deprecated_by(mark_keep) - markUpgrade = function_deprecated_by(mark_upgrade) - - def _test(): """Self-test.""" print "Self-test for the Package modul" diff --git a/apt/progress/__init__.py b/apt/progress/__init__.py index 10c11021..00dc768f 100644 --- a/apt/progress/__init__.py +++ b/apt/progress/__init__.py @@ -26,10 +26,3 @@ import apt_pkg __all__ = [] - - -if apt_pkg._COMPAT_0_7: - from apt.progress.old import (CdromProgress, DpkgInstallProgress, - DumbInstallProgress, FetchProgress, - InstallProgress, OpProgress, - OpTextProgress, TextFetchProgress) diff --git a/apt/progress/gtk2.py b/apt/progress/gtk2.py index c2635ca0..63e531fa 100644 --- a/apt/progress/gtk2.py +++ b/apt/progress/gtk2.py @@ -36,12 +36,8 @@ import vte import apt_pkg from apt_pkg import gettext as _ -from apt.deprecation import function_deprecated_by, AttributeDeprecatedBy from apt.progress import base -if apt_pkg._COMPAT_0_7: - from apt.progress import old - __all__ = ['GAcquireProgress', 'GInstallProgress', 'GOpProgress', 'GtkAptProgress'] @@ -90,9 +86,6 @@ class GOpProgress(gobject.GObject, base.OpProgress): base.OpProgress.done(self) self.emit("status-finished") - if apt_pkg._COMPAT_0_7: - subOp = AttributeDeprecatedBy('subop') - Op = AttributeDeprecatedBy('op') class GInstallProgress(gobject.GObject, base.InstallProgress): @@ -204,14 +197,6 @@ class GInstallProgress(gobject.GObject, base.InstallProgress): time.sleep(0.02) return self.apt_status - if apt_pkg._COMPAT_0_7: - updateInterface = function_deprecated_by(update_interface) - startUpdate = function_deprecated_by(start_update) - finishUpdate = function_deprecated_by(finish_update) - statusChange = function_deprecated_by(status_change) - waitChild = function_deprecated_by(wait_child) - childExited = function_deprecated_by(child_exited) - GDpkgInstallProgress = GInstallProgress @@ -272,59 +257,6 @@ class GAcquireProgress(gobject.GObject, base.AcquireProgress): self._context.iteration() return self._continue -if apt_pkg._COMPAT_0_7: - - class GFetchProgress(gobject.GObject, old.FetchProgress): - """A Fetch Progress with GObject signals. - - Signals: - - * status-changed(str: description, int: percent) - * status-started() - * status-finished() - - DEPRECATED. - """ - - __gsignals__ = {"status-changed": mksig((str, int)), - "status-started": mksig(), - "status-finished": mksig()} - - def __init__(self): - old.FetchProgress.__init__(self) - gobject.GObject.__init__(self) - self._continue = True - self._context = glib.main_context_default() - - def start(self): - self.emit("status-started") - - def stop(self): - self.emit("status-finished") - - def cancel(self): - self._continue = False - - def pulse(self): - old.FetchProgress.pulse(self) - current_item = self.currentItems + 1 - if current_item > self.totalItems: - current_item = self.totalItems - if self.current_cps > 0: - text = (_("Downloading file %(current)li of %(total)li with " - "%(speed)s/s") % \ - {"current": current_item, - "total": self.totalItems, - "speed": apt_pkg.size_to_str(self.currentCPS)}) - else: - text = (_("Downloading file %(current)li of %(total)li") % \ - {"current": current_item, - "total": self.totalItems}) - self.emit("status-changed", text, self.percent) - while self._context.pending(): - self._context.iteration() - return self._continue - class GtkAptProgress(gtk.VBox): """Graphical progress for installation/fetch/operations. @@ -403,21 +335,6 @@ class GtkAptProgress(gtk.VBox): """Return the install progress handler for dpkg.""" return self._progress_install - if apt_pkg._COMPAT_0_7: - - @property - def fetch(self): - """Return the fetch progress handler.""" - if self._progress_fetch is None: - self._progress_fetch = GFetchProgress() - self._progress_fetch.connect("status-changed", - self._on_status_changed) - self._progress_fetch.connect("status-started", - self._on_status_started) - self._progress_fetch.connect("status-finished", - self._on_status_finished) - return self._progress_fetch - @property def acquire(self): """Return the acquire progress handler.""" diff --git a/apt/progress/old.py b/apt/progress/old.py deleted file mode 100644 index 364cd2ce..00000000 --- a/apt/progress/old.py +++ /dev/null @@ -1,259 +0,0 @@ -# progress.py - progress reporting classes -# -# Copyright (c) 2005-2009 Canonical -# -# Author: Michael Vogt -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -# USA -# pylint: disable-msg = C0103 -"""Deprecated progress reporting classes. - -This module provides classes for compatibility with python-apt 0.7. They are -completely deprecated and should not be used anymore. -""" - - -import os -import sys - -import apt_pkg -from apt.deprecation import AttributeDeprecatedBy, function_deprecated_by -import warnings -from apt.progress import base, text - -__all__ = [] - - -class OpProgress(base.OpProgress): - """Abstract class to implement reporting on cache opening.""" - - def __init__(self): - base.OpProgress.__init__(self) - warnings.warn("apt.progress.OpProgress is deprecated.", - DeprecationWarning, stacklevel=2) - - subOp = AttributeDeprecatedBy('subop') - Op = AttributeDeprecatedBy('op') - - -class OpTextProgress(OpProgress, text.OpProgress): - """A simple text based cache open reporting class.""" - - def __init__(self): - text.OpProgress.__init__(self) - warnings.warn("apt.progress.OpTextProgress is deprecated.", - DeprecationWarning, stacklevel=2) - - -class FetchProgress(object): - """Report the download/fetching progress.""" - - # download status constants - (dlDone, dlQueued, dlFailed, dlHit, dlIgnored) = range(5) - dlStatusStr = {dlDone: "Done", dlQueued: "Queued", dlFailed: "Failed", - dlHit: "Hit", dlIgnored: "Ignored"} - - def __init__(self): - self.eta = 0.0 - self.percent = 0.0 - # Make checking easier - self.currentBytes = 0 - self.currentItems = 0 - self.totalBytes = 0 - self.totalItems = 0 - self.currentCPS = 0 - warnings.warn("apt.progress.FetchProgress is deprecated.", - DeprecationWarning, stacklevel=2) - - def start(self): - """Called when the fetching starts.""" - - def stop(self): - """Called when all files have been fetched.""" - - def updateStatus(self, uri, descr, short_descr, status): - """Called when the status of an item changes. - - This happens eg. when the downloads fails or is completed. - """ - - def update_status_full(self, uri, descr, short_descr, status, file_size, - partial_size): - """Called when the status of an item changes. - - This happens eg. when the downloads fails or is completed. This - version include information on current filesize and partial size - """ - - def pulse(self): - """Called periodically to update the user interface. - - Return True to continue or False to cancel. - """ - self.percent = (((self.currentBytes + self.currentItems) * 100.0) / - float(self.totalBytes + self.totalItems)) - if self.currentCPS > 0: - self.eta = ((self.totalBytes - self.currentBytes) / - float(self.currentCPS)) - return True - - def pulse_items(self, items): - """Called periodically to update the user interface. - This function includes details about the items being fetched - Return True to continue or False to cancel. - - """ - self.percent = (((self.currentBytes + self.currentItems) * 100.0) / - float(self.totalBytes + self.totalItems)) - if self.currentCPS > 0: - self.eta = ((self.totalBytes - self.currentBytes) / - float(self.currentCPS)) - return True - - def mediaChange(self, medium, drive): - """react to media change events.""" - - -class TextFetchProgress(FetchProgress): - """ Ready to use progress object for terminal windows """ - - def __init__(self): - FetchProgress.__init__(self) - self.items = {} - - def updateStatus(self, uri, descr, short_descr, status): - """Called when the status of an item changes. - - This happens eg. when the downloads fails or is completed. - """ - if status != self.dlQueued: - print "\r%s %s" % (self.dlStatusStr[status], descr) - self.items[uri] = status - - def pulse(self): - """Called periodically to update the user interface. - - Return True to continue or False to cancel. - """ - FetchProgress.pulse(self) - - if self.currentCPS > 0: - s = "[%2.f%%] %sB/s %s" % (self.percent, - apt_pkg.size_to_str(self.currentCPS), - apt_pkg.time_to_str(long(self.eta))) - else: - s = "%2.f%% [Working]" % (self.percent) - print "\r%s" % (s), - sys.stdout.flush() - return True - - def stop(self): - """Called when all files have been fetched.""" - print "\rDone downloading " - - def mediaChange(self, medium, drive): - """react to media change events.""" - print ("Media change: please insert the disc labeled " - "'%s' in the drive '%s' and press enter") % (medium, drive) - - return raw_input() not in ('c', 'C') - - -class CdromProgress(object): - """Report the cdrom add progress.""" - - def __init__(self): - warnings.warn("apt.progress.CdromProgress is deprecated.", - DeprecationWarning, stacklevel=2) - - def askCdromName(self): - """Ask for a cdrom name""" - - def changeCdrom(self): - """Change cdrom""" - - def update(self, text, current): - """Update.""" - - -class DumbInstallProgress(base.InstallProgress): - """Report the install progress.""" - - def __init__(self): - base.InstallProgress.__init__(self) - warnings.warn("apt.progress.*InstallProgress are deprecated.", - DeprecationWarning, stacklevel=2) - - def updateInterface(self): - # *_stream were not available in the old progress reporting classes, - # create the attributes if they do not exist yet; as they are used - # in base.InstallProgress.update_interface(). - if hasattr(self, "writefd") and not hasattr(self, "write_stream"): - self.write_stream = os.fdopen(self.writefd, "w") - if hasattr(self, "statusfd") and not hasattr(self, "status_stream"): - self.status_stream = os.fdopen(self.statusfd, "r") - return base.InstallProgress.update_interface(self) - - def update_interface(self): - return self.updateInterface() - - def startUpdate(self): - return base.InstallProgress.start_update(self) - - def start_update(self): - return self.startUpdate() - - def finishUpdate(self): - return base.InstallProgress.finish_update(self) - - def finish_update(self): - return self.finishUpdate() - - -class InstallProgress(DumbInstallProgress, base.InstallProgress): - """An InstallProgress that is pretty useful. - - It supports the attributes 'percent' 'status' and callbacks for the dpkg - errors and conffiles and status changes. - """ - - selectTimeout = AttributeDeprecatedBy('select_timeout') - - def statusChange(self, pkg, percent, status): - return base.InstallProgress.status_change(self, pkg, percent, status) - - def status_change(self, pkg, percent, status): - return self.statusChange(pkg, percent, status) - - def waitChild(self): - return base.InstallProgress.wait_child(self) - - def wait_child(self): - return self.waitChild() - - -class DpkgInstallProgress(InstallProgress): - """Progress handler for a local Debian package installation.""" - - debfile = "" - debname = "" - - def run(self, debfile): - """Start installing the given Debian package.""" - # Deprecated stuff - self.debfile = debfile - self.debname = os.path.basename(debfile).split("_")[0] - return base.InstallProgress.run(self, debfile) diff --git a/aptsources/sourceslist.py b/aptsources/sourceslist.py index f5a86ecb..48839d6e 100644 --- a/aptsources/sourceslist.py +++ b/aptsources/sourceslist.py @@ -34,7 +34,6 @@ import time import apt_pkg from .distinfo import DistInfo -from apt.deprecation import function_deprecated_by #from apt_pkg import gettext as _ @@ -352,9 +351,6 @@ class SourcesList(object): if os.path.exists(file+backup_ext): shutil.copy(file+backup_ext, file) - if apt_pkg._COMPAT_0_7: - restoreBackup = function_deprecated_by(restore_backup) - def backup(self, backup_ext=None): """ make a backup of the current source files, if no backup extension is given, the current date/time is used (and returned) """ diff --git a/debian/python-apt-common.install b/debian/python-apt-common.install index bea48037..d21f9b8e 100644 --- a/debian/python-apt-common.install +++ b/debian/python-apt-common.install @@ -1,4 +1,2 @@ usr/share/locale usr/share/python-apt -# Install the migration helper -utils/migrate-0.8.py usr/share/python-apt diff --git a/debian/python-apt-common.lintian-overrides b/debian/python-apt-common.lintian-overrides deleted file mode 100644 index f0eddf6b..00000000 --- a/debian/python-apt-common.lintian-overrides +++ /dev/null @@ -1,2 +0,0 @@ -# package depends on python | python3 -python-script-but-no-python-dep usr/share/python-apt/migrate-0.8.py diff --git a/doc/source/conf.py b/doc/source/conf.py index 8fbf2c11..bdf0579b 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -32,8 +32,6 @@ if os.path.exists("../../build"): sys.path.pop(0) else: sys.stdout.write('I: Found apt_pkg.so in %s\n' % sys.path[0]) - # Hack: Disable compatibility mode - apt_pkg._COMPAT_0_7 = 0 break diff --git a/python/apt_pkgmodule.cc b/python/apt_pkgmodule.cc index 5e48be04..4cffcaa5 100644 --- a/python/apt_pkgmodule.cc +++ b/python/apt_pkgmodule.cc @@ -903,8 +903,6 @@ extern "C" void initapt_pkg() PyModule_AddIntConstant(Module,"INSTSTATE_HOLD_REINSTREQ",pkgCache::State::HoldReInstReq); - // DEPRECATED API - PyModule_AddIntConstant(Module,"_COMPAT_0_7",0); #if PY_MAJOR_VERSION >= 3 return Module; #endif diff --git a/utils/migrate-0.8.py b/utils/migrate-0.8.py deleted file mode 100755 index 555257a9..00000000 --- a/utils/migrate-0.8.py +++ /dev/null @@ -1,254 +0,0 @@ -#!/usr/bin/python2.6 -# -# migrate-0.8.py - Find use of deprecated methods/attributes in the code. -# -# Copyright (C) 2009 Julian Andres Klode -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -# USA -"""migrate-0.8.py - Find all occurences of funcs./attrs. deprecated in 0.8. - -Usage: python2.6 migrate-0.8.py [options] ... - -This reads the list of all functions and attributes available only in -COMPAT_0_7 builds and checks for occurences in the given Python modules. Has -to be run from the python-apt source code directory. - -Requires python2.6 to be installed. - -Parameters: - -h Display this help - -c Colorize the matching parts in the output. -""" -import _ast -import ast -import glob -import linecache -import os -import re -import sys -import types -from collections import defaultdict -from textwrap import fill - -color=False -if len(sys.argv) > 1 and sys.argv[1] in ('-c', '--color', '--colour'): - color=True - del sys.argv[1] - -if '-h' in sys.argv or '--help' in sys.argv or not sys.argv[1:]: - print __doc__.strip() - sys.exit(0) - -if os.path.dirname(__file__).endswith('utils'): - sys.path.insert(0, os.path.dirname(os.path.dirname(__file__))) - -deprecated_cpp_stuff = set([ - '.Add', '.AllTargets', '.Arch', '.Architecture', '.Archive', - '.ArchiveURI', '.Auto', '.Base64Encode', '.Binaries', '.BrokenCount', - '.BuildDepends', '.Bytes', '.CheckDep', '.CheckDomainList', '.Clear', - '.Close', '.Commit', '.CompType', '.Complete', '.Component', '.Config', - '.CurStateConfigFiles', '.CurStateHalfConfigured', - '.CurStateHalfInstalled', '.CurStateInstalled', '.CurStateNotInstalled', - '.CurStateUnPacked', '.CurrentState', '.CurrentVer', '.Date', - '.DeQuoteString', '.DebSize', '.DelCount', '.DepType', '.DependsCount', - '.DependsList', '.DependsListStr', '.DescURI', '.Describe', '.DestFile', - '.Dist', '.DoInstall', '.Downloadable', '.ErrorText', '.Essential', - '.Exists', '.FetchNeeded', '.FileList', '.FileName', '.FileSize', - '.Files', '.Find', '.FindB', '.FindDir', '.FindFile', '.FindFlag', - '.FindI', '.FindIndex', '.FindRaw', '.FixBroken', '.FixMissing', - '.GetAcquire', '.GetArchives', '.GetCache', '.GetCandidateVer', - '.GetCdrom', '.GetDepCache', '.GetIndexes', '.GetLock', - '.GetPackageManager', '.GetPkgAcqFile', '.GetPkgActionGroup', - '.GetPkgProblemResolver', '.GetPkgRecords', '.GetPkgSourceList', - '.GetPkgSrcRecords', '.HasPackages', '.Hash', '.Homepage', '.ID', - '.Ident', '.Important', '.Index', '.IndexFiles', '.IndexType', '.Init', - '.InitConfig', '.InitSystem', '.InstCount', '.InstState', - '.InstStateHold', '.InstStateHoldReInstReq', '.InstStateOk', - '.InstStateReInstReq', '.InstallProtect', '.InstalledSize', - '.IsAutoInstalled', '.IsGarbage', '.IsInstBroken', '.IsNowBroken', - '.IsTrusted', '.IsUpgradable', '.Items', '.Jump', '.KeepCount', - '.Label', '.LanguageCode', '.LibVersion', '.List', '.Local', - '.LongDesc', '.Lookup', '.MD5Hash', '.Maintainer', '.MarkDelete', - '.MarkInstall', '.MarkKeep', '.MarkedDelete', '.MarkedDowngrade', - '.MarkedInstall', '.MarkedKeep', '.MarkedReinstall', '.MarkedUpgrade', - '.MinimizeUpgrade', '.MyTag', '.Name', '.NotAutomatic', '.NotSource', - '.Offset', '.Open', '.Origin', '.Package', '.PackageCount', - '.PackageFileCount', '.Packages', '.ParentPkg', '.ParentVer', - '.ParseCommandLine', '.ParseDepends', '.ParseSection', - '.ParseSrcDepends', '.ParseTagFile', '.PartialPresent', - '.PkgSystemLock', '.PkgSystemUnLock', '.PriExtra', '.PriImportant', - '.PriOptional', '.PriRequired', '.PriStandard', '.Priority', - '.PriorityStr', '.Protect', '.ProvidesCount', '.ProvidesList', - '.QuoteString', '.ReadConfigDir', '.ReadConfigFile', - '.ReadConfigFileISC', '.ReadMainList', '.ReadPinFile', '.Record', - '.Remove', '.Resolve', '.ResolveByKeep', '.Restart', '.RevDependsList', - '.RewriteSection', '.RewriteSourceOrder', '.Run', '.SHA1Hash', - '.SHA256Hash', '.Section', '.SelStateDeInstall', '.SelStateHold', - '.SelStateInstall', '.SelStatePurge', '.SelStateUnknown', - '.SelectedState', '.Set', '.SetCandidateVer', '.SetReInstall', - '.ShortDesc', '.Shutdown', '.Site', '.Size', '.SizeToStr', - '.SmartTargetPkg', '.SourcePkg', '.SourceVer', '.Status', '.Step', - '.StrToTime', '.StringToBool', '.SubTree', '.TargetPkg', '.TargetVer', - '.Time', '.TimeRFC1123', '.TimeToStr', '.TotalNeeded', - '.TranslationDescription', '.URI', '.URItoFileName', '.Update', - '.Upgrade', '.UpstreamVersion', '.UsrSize', '.ValueList', - '.VerFileCount', '.VerStr', '.Version', '.VersionCompare', - '.VersionCount', '.VersionList', '.newConfiguration', 'Base64Encode', - 'CheckDep', 'CheckDomainList', 'Config', 'CurStateConfigFiles', - 'CurStateHalfConfigured', 'CurStateHalfInstalled', 'CurStateInstalled', - 'CurStateNotInstalled', 'CurStateUnPacked', 'Date', 'DeQuoteString', - 'GetAcquire', 'GetCache', 'GetCdrom', 'GetDepCache', 'GetLock', - 'GetPackageManager', 'GetPkgAcqFile', 'GetPkgActionGroup', - 'GetPkgProblemResolver', 'GetPkgRecords', 'GetPkgSourceList', - 'GetPkgSrcRecords', 'InitConfig', 'InitSystem', 'InstStateHold', - 'InstStateHoldReInstReq', 'InstStateOk', 'InstStateReInstReq', - 'LibVersion', 'ParseCommandLine', 'ParseDepends', 'ParseSection', - 'ParseSrcDepends', 'ParseTagFile', 'PkgSystemLock', 'PkgSystemUnLock', - 'PriExtra', 'PriImportant', 'PriOptional', 'PriRequired', 'PriStandard', - 'QuoteString', 'ReadConfigDir', 'ReadConfigFile', 'ReadConfigFileISC', - 'RewriteSection', 'RewriteSourceOrder', 'SelStateDeInstall', - 'SelStateHold', 'SelStateInstall', 'SelStatePurge', 'SelStateUnknown', - 'SizeToStr', 'StrToTime', 'StringToBool', 'Time', 'TimeRFC1123', - 'TimeToStr', 'URItoFileName', 'UpstreamVersion', 'VersionCompare', - 'newConfiguration', '.has_key']) - -def do_color(string, words): - """Colorize (red) the given words in the given string.""" - if not color: - return string - for word in words: - word = re.escape(word) - string = re.sub('([^_]*)(%s)([^_]*)' % word, "\\1\033[31m\033[1m" + - r"\2" + "\033[0m\\3", string) - return string - -def find_deprecated_py(): - """Find all the deprecated functions and attributes. - - Import apt_pkg, set _COMPAT_0_7 to 0, import apt and aptsources and - create a list of all attributes. Then remove the imported modules, - reimport them (with _COMPAT_0_7=1), and see which functions do not - exist anymore. - """ - - modules = ('apt', 'apt.package', 'apt.cdrom', 'apt.cache', 'apt.debfile', - 'apt.progress', 'apt.progress.old', 'aptsources.distinfo', - 'aptsources.distro', 'aptsources.sourceslist') - - import apt_pkg - apt_pkg._COMPAT_0_7 = 0 - - empty = set(sys.modules) - new, deprecated = set(), set() - - for mname in sorted(modules): - module = __import__(mname, fromlist=['*']) - - for clsname in dir(module): - cls = getattr(module, clsname) - if not isinstance(cls, types.TypeType): - new.add(clsname) - continue - # Attributes/Methods - new.update(clsname + '.' + name for name in dir(cls)) - - for mname in sys.modules.keys(): - if not mname in empty: - del sys.modules[mname] - - apt_pkg._COMPAT_0_7 = 1 - - for mname in sorted(modules): - module = __import__(mname, fromlist=['*']) - for clsname in dir(module): - cls = getattr(module, clsname) - if not isinstance(cls, types.TypeType): - deprecated.add(clsname) - continue - for name in dir(cls): - if not clsname + '.' + name in new: - # Attributes/Methods, which are deprecated (not in new). - deprecated.add('.' + name) - - for mname in sys.modules.keys(): - if not mname in empty: - del sys.modules[mname] - - return deprecated.difference(new) - - -def find_occurences(all_old, files): - """Find all ocurrences in the given Python files.""" - for fname in files: - if not os.path.exists(fname): - continue - if not (fname in sys.argv or fname.endswith('.py') or - re.match('^#.*python.*', open(fname).readline())): - continue - - words = defaultdict(lambda: set()) - try: - node = ast.parse(open(fname, "rU").read(), fname) - except Exception as e: - print >> sys.stderr, "Ignoring %s: %s" % (fname, e) - continue - for i in ast.walk(node): - if isinstance(i, _ast.ImportFrom): - for alias in i.names: - if alias.name in all_old: - words[i.lineno].add(alias.name) - if isinstance(i, _ast.Name) and i.id in all_old: - words[i.lineno].add(i.id) - - if isinstance(i, _ast.Attribute) and ('.' + i.attr in all_old): - words[i.lineno].add(i.attr) - - for lineno in sorted(words): - line = do_color(linecache.getline(fname, lineno).rstrip('\n'), - words[lineno]) - print '%s:%s:%s' % (fname, lineno, line) - -# Now, let's find them in the code. - -print __doc__.split("\n")[0] -print -print fill('Information: Please verify that the results are correct before ' - 'you modify any code, because there may be false positives.', 79) -print -if color: - print fill('Information: The color is not always correct, because we ' - 'simply highlight the matched words (like grep).', 79) - print - -all_old = deprecated_cpp_stuff - -if not '-P' in sys.argv: - all_old |= find_deprecated_py() -else: - sys.argv.remove('-P') - -files = set() -for path in sys.argv[1:]: - if not os.path.exists(path): - raise ValueError('Path does not exist: %s' % path) - if os.path.isfile(path): - files.add(path) - else: - for root, dirs, files_ in os.walk(path): - for fname in files_: - files.add(os.path.normpath(os.path.join(root, fname))) - -find_occurences(all_old, sorted(files)) -- cgit v1.2.3 From af280830c12f4e29862733a8155e87985d57c574 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Mon, 26 Aug 2013 13:46:55 +0200 Subject: Update changelog --- debian/changelog | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index d1cc10ee..a0e11dae 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,10 +1,14 @@ -python-apt (0.8.9.2) UNRELEASED; urgency=low +python-apt (0.9.0) UNRELEASED; urgency=low + [ Michael Vogt ] * some fixes from the "coverity" scan * merge from Ubuntu: - data/templates/Ubuntu.info.in: add "Saucy Salamander" to - debian/control: add "Multi-Arch: allowed" + [ Julian Andres Klode ] + * Completely remove all old-API support code + -- Michael Vogt Mon, 05 Aug 2013 22:55:02 +0200 python-apt (0.8.9.1) unstable; urgency=low -- cgit v1.2.3 From 7c03e56db77a3ae69f3710f588342a6e1fde2250 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Tue, 8 Oct 2013 17:36:16 +0200 Subject: python/generic.h: Introduce a PyApt_Filename class On Python 3, we need to encode filenames. We could use PyUnicode_FSConverter but this introduces unneeded complexity in all callees, and is only available in Python 3.1 anyway. --- python/generic.h | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) diff --git a/python/generic.h b/python/generic.h index e4679c6c..97806e17 100644 --- a/python/generic.h +++ b/python/generic.h @@ -251,4 +251,64 @@ inline PyObject *MkPyNumber(double o) { return PyFloat_FromDouble(o); } # define _PyAptObject_getattro 0 + +/** + * Magic class for file name handling + * + * This manages decoding file names from Python objects; bytes and unicode + * objects. On Python 2, this does the same conversion as PyObject_AsString, + * on Python3, it uses PyUnicode_EncodeFSDefault for unicode objects. + */ +class PyApt_Filename { +public: + PyObject *object; + const char *path; + + PyApt_Filename() { + object = NULL; + path = NULL; + } + + int init(PyObject *object) { + this->object = NULL; + this->path = NULL; + +#if PY_MAJOR_VERSION < 3 || (PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION < 2) + this->path = PyObject_AsString(object); + return this->path ? 1 : 0; +#else + if (PyUnicode_Check(object)) { + object = PyUnicode_EncodeFSDefault(object); + } else if (PyBytes_Check(object)) { + Py_INCREF(object); + } else { + return 0; + } + + this->object = object; + this->path = PyBytes_AS_STRING(this->object); + return 1; +#endif + } + + ~PyApt_Filename() { + Py_XDECREF(object); + } + + static int Converter(PyObject *object, void *out) { + return static_cast(out)->init(object); + } + + operator const char *() { + return path; + } + operator const std::string() { + return path; + } + + void operator=(const char *path) { + this->path = path; + } +}; + #endif -- cgit v1.2.3 From 5889aba6bd426673fa64a4080747fca762f8ef58 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Tue, 8 Oct 2013 17:40:37 +0200 Subject: apt_inst: Support paths supplied as bytes objects (Closes: #680971) --- python/arfile.cc | 41 ++++++++++++++++++++++------------------- python/tarfile.cc | 22 +++++++++++----------- 2 files changed, 33 insertions(+), 30 deletions(-) diff --git a/python/arfile.cc b/python/arfile.cc index 96702f57..50cd1246 100644 --- a/python/arfile.cc +++ b/python/arfile.cc @@ -147,14 +147,14 @@ static const char *ararchive_getmember_doc = "LookupError if there is no ArMember with the given name."; static PyObject *ararchive_getmember(PyArArchiveObject *self, PyObject *arg) { - const char *name; + PyApt_Filename name; CppPyObject *ret; - if (! (name = PyObject_AsString(arg))) + if (!name.init(arg)) return 0; const ARArchive::Member *member = self->Object->FindMember(name); if (!member) { - PyErr_Format(PyExc_LookupError,"No member named '%s'",name); + PyErr_Format(PyExc_LookupError,"No member named '%s'",name.path); return 0; } @@ -171,12 +171,12 @@ static const char *ararchive_extractdata_doc = "LookupError if there is no ArMember with the given name."; static PyObject *ararchive_extractdata(PyArArchiveObject *self, PyObject *args) { - char *name = 0; - if (PyArg_ParseTuple(args, "s:extractdata", &name) == 0) + PyApt_Filename name; + if (PyArg_ParseTuple(args, "O&:extractdata", PyApt_Filename::Converter, &name) == 0) return 0; const ARArchive::Member *member = self->Object->FindMember(name); if (!member) { - PyErr_Format(PyExc_LookupError,"No member named '%s'",name); + PyErr_Format(PyExc_LookupError,"No member named '%s'",name.path); return 0; } if (!self->Fd.Seek(member->Start)) @@ -247,15 +247,17 @@ static const char *ararchive_extract_doc = "does not exist, raise LookupError."; static PyObject *ararchive_extract(PyArArchiveObject *self, PyObject *args) { - char *name = 0; - char *target = ""; - if (PyArg_ParseTuple(args, "s|s:extract", &name, &target) == 0) + PyApt_Filename name; + PyApt_Filename target; + + target = ""; + if (PyArg_ParseTuple(args, "O&|O&:extract", PyApt_Filename::Converter, &name, PyApt_Filename::Converter, &target) == 0) return 0; const ARArchive::Member *member = self->Object->FindMember(name); if (!member) { - PyErr_Format(PyExc_LookupError,"No member named '%s'",name); + PyErr_Format(PyExc_LookupError,"No member named '%s'",name.path); return 0; } return _extract(self->Fd, member, target); @@ -269,8 +271,9 @@ static const char *ararchive_extractall_doc = static PyObject *ararchive_extractall(PyArArchiveObject *self, PyObject *args) { - char *target = ""; - if (PyArg_ParseTuple(args, "|s:extractall", &target) == 0) + PyApt_Filename target; + target = ""; + if (PyArg_ParseTuple(args, "|O&:extractall", PyApt_Filename::Converter, &target) == 0) return 0; const ARArchive::Member *member = self->Object->Members(); @@ -292,14 +295,14 @@ static const char *ararchive_gettar_doc = "It just opens a new TarFile on the given position in the stream."; static PyObject *ararchive_gettar(PyArArchiveObject *self, PyObject *args) { - const char *name; + PyApt_Filename name; const char *comp; - if (PyArg_ParseTuple(args, "ss:gettar", &name, &comp) == 0) + if (PyArg_ParseTuple(args, "O&s:gettar", PyApt_Filename::Converter, &name, &comp) == 0) return 0; const ARArchive::Member *member = self->Object->FindMember(name); if (!member) { - PyErr_Format(PyExc_LookupError,"No member named '%s'",name); + PyErr_Format(PyExc_LookupError,"No member named '%s'",name.path); return 0; } @@ -374,13 +377,13 @@ static PyObject *ararchive_new(PyTypeObject *type, PyObject *args, { PyObject *file; PyArArchiveObject *self; - char *filename = 0; + PyApt_Filename filename; int fileno; if (PyArg_ParseTuple(args,"O:__new__",&file) == 0) return 0; // We receive a filename. - if ((filename = (char*)PyObject_AsString(file))) { + if (filename.init(file)) { self = (PyArArchiveObject *)CppPyObject_NEW(0,type); new (&self->Fd) FileFd(filename,FileFd::ReadOnly); } @@ -409,8 +412,8 @@ static void ararchive_dealloc(PyObject *self) // Return bool or -1 (exception). static int ararchive_contains(PyObject *self, PyObject *arg) { - const char *name = PyObject_AsString(arg); - if (!name) + PyApt_Filename name; + if (!name.init(arg)) return -1; return (GetCpp(self)->FindMember(name) != 0); } diff --git a/python/tarfile.cc b/python/tarfile.cc index 920f032e..7f65a5c7 100644 --- a/python/tarfile.cc +++ b/python/tarfile.cc @@ -309,7 +309,7 @@ static PyObject *tarfile_new(PyTypeObject *type,PyObject *args,PyObject *kwds) { PyObject *file; PyTarFileObject *self; - char *filename; + PyApt_Filename filename; int fileno; int min = 0; int max = 0xFFFFFFFF; @@ -323,8 +323,8 @@ static PyObject *tarfile_new(PyTypeObject *type,PyObject *args,PyObject *kwds) self = (PyTarFileObject*)CppPyObject_NEW(file,type); // We receive a filename. - if ((filename = (char*)PyObject_AsString(file))) - new (&self->Fd) FileFd(filename,FileFd::ReadOnly); + if (filename.init(file)) + new (&self->Fd) FileFd((const char *) filename,FileFd::ReadOnly); else if ((fileno = PyObject_AsFileDescriptor(file)) != -1) { // clear the error set by PyObject_AsString(). PyErr_Clear(); @@ -349,8 +349,8 @@ static const char *tarfile_extractall_doc = static PyObject *tarfile_extractall(PyObject *self, PyObject *args) { std::string cwd = SafeGetCWD(); - char *rootdir = 0; - if (PyArg_ParseTuple(args,"|s:extractall",&rootdir) == 0) + PyApt_Filename rootdir; + if (PyArg_ParseTuple(args,"|O&:extractall", PyApt_Filename::Converter, &rootdir) == 0) return 0; if (rootdir) { @@ -384,8 +384,8 @@ static const char *tarfile_go_doc = static PyObject *tarfile_go(PyObject *self, PyObject *args) { PyObject *callback; - char *member = 0; - if (PyArg_ParseTuple(args,"O|s",&callback,&member) == 0) + PyApt_Filename member; + if (PyArg_ParseTuple(args,"O|O&",&callback, PyApt_Filename::Converter, &member) == 0) return 0; if (member && strcmp(member, "") == 0) member = 0; @@ -397,7 +397,7 @@ static PyObject *tarfile_go(PyObject *self, PyObject *args) return 0; if (member && !stream.py_data) return PyErr_Format(PyExc_LookupError, "There is no member named '%s'", - member); + member.path); return HandleErrors(PyBool_FromLong(res)); } @@ -407,8 +407,8 @@ static const char *tarfile_extractdata_doc = "LookupError if there is no member with the given name."; static PyObject *tarfile_extractdata(PyObject *self, PyObject *args) { - const char *member; - if (PyArg_ParseTuple(args,"s",&member) == 0) + PyApt_Filename member; + if (PyArg_ParseTuple(args,"O&", PyApt_Filename::Converter, &member) == 0) return 0; PyDirStream stream(NULL, member); ((PyTarFileObject*)self)->Fd.Seek(((PyTarFileObject*)self)->min); @@ -417,7 +417,7 @@ static PyObject *tarfile_extractdata(PyObject *self, PyObject *args) if (!stream.py_data) return PyErr_Format(PyExc_LookupError, "There is no member named '%s'", - member); + member.path); if (stream.error) { return 0; } -- cgit v1.2.3 From 7aedf6d986f15d31d9597c139d91c761baf98f73 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Tue, 8 Oct 2013 17:45:32 +0200 Subject: PyApt_Filename: Add return value to assignment operator --- python/generic.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/python/generic.h b/python/generic.h index 97806e17..7dc89ca6 100644 --- a/python/generic.h +++ b/python/generic.h @@ -306,8 +306,8 @@ public: return path; } - void operator=(const char *path) { - this->path = path; + const char *operator=(const char *path) { + return this->path = path; } }; -- cgit v1.2.3 From 222a1e27d5a50e255dfacf5378225b9ec78dd124 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Tue, 8 Oct 2013 17:59:31 +0200 Subject: apt_pkg: Support paths supplied as bytes objects (See: #680971) We should be done now. DO NOT MERGE --- python/acquire-item.cc | 9 ++++++--- python/apt_pkgmodule.cc | 4 ++-- python/configuration.cc | 12 ++++++------ python/indexfile.cc | 4 ++-- python/indexrecords.cc | 4 ++-- python/lock.cc | 5 +++-- python/pkgmanager.cc | 4 ++-- python/policy.cc | 10 ++++++---- python/tag.cc | 5 ++--- 9 files changed, 31 insertions(+), 26 deletions(-) diff --git a/python/acquire-item.cc b/python/acquire-item.cc index 53c3802b..5589a1f2 100644 --- a/python/acquire-item.cc +++ b/python/acquire-item.cc @@ -224,7 +224,8 @@ PyTypeObject PyAcquireItem_Type = { static PyObject *acquirefile_new(PyTypeObject *type, PyObject *Args, PyObject * kwds) { PyObject *pyfetcher; - char *uri, *md5, *descr, *shortDescr, *destDir, *destFile; + const char *uri, *md5, *descr, *shortDescr; + PyApt_Filename destDir, destFile; int size = 0; uri = md5 = descr = shortDescr = destDir = destFile = ""; @@ -232,9 +233,11 @@ static PyObject *acquirefile_new(PyTypeObject *type, PyObject *Args, PyObject * "destdir", "destfile", NULL }; - if (PyArg_ParseTupleAndKeywords(Args, kwds, "O!s|sissss", kwlist, + if (PyArg_ParseTupleAndKeywords(Args, kwds, "O!s|sissO&O&", kwlist, &PyAcquire_Type, &pyfetcher, &uri, &md5, - &size, &descr, &shortDescr, &destDir, &destFile) == 0) + &size, &descr, &shortDescr, + PyApt_Filename::Converter, &destDir, + PyApt_Filename::Converter, &destFile) == 0) return 0; pkgAcquire *fetcher = GetCpp(pyfetcher); diff --git a/python/apt_pkgmodule.cc b/python/apt_pkgmodule.cc index 4cffcaa5..5b06f721 100644 --- a/python/apt_pkgmodule.cc +++ b/python/apt_pkgmodule.cc @@ -434,9 +434,9 @@ static char *doc_GetLock = "provided by apt_pkg.FileLock instead using the with-statement."; static PyObject *GetLock(PyObject *Self,PyObject *Args) { - const char *file; + PyApt_Filename file; char errors = false; - if (PyArg_ParseTuple(Args,"s|b",&file,&errors) == 0) + if (PyArg_ParseTuple(Args,"O&|b",PyApt_Filename::Converter, &file,&errors) == 0) return 0; int fd = GetLock(file, errors); diff --git a/python/configuration.cc b/python/configuration.cc index 37374625..c57bc79c 100644 --- a/python/configuration.cc +++ b/python/configuration.cc @@ -351,8 +351,8 @@ char *doc_LoadConfig = "options in the configuration object."; PyObject *LoadConfig(PyObject *Self,PyObject *Args) { - char *Name = 0; - if (PyArg_ParseTuple(Args,"Os",&Self,&Name) == 0) + PyApt_Filename Name; + if (PyArg_ParseTuple(Args,"OO&",&Self,PyApt_Filename::Converter, &Name) == 0) return 0; if (PyConfiguration_Check(Self)== 0) { @@ -373,8 +373,8 @@ char *doc_LoadConfigISC = "configuration files."; PyObject *LoadConfigISC(PyObject *Self,PyObject *Args) { - char *Name = 0; - if (PyArg_ParseTuple(Args,"Os",&Self,&Name) == 0) + PyApt_Filename Name; + if (PyArg_ParseTuple(Args,"OO&",&Self,PyApt_Filename::Converter, &Name) == 0) return 0; if (PyConfiguration_Check(Self)== 0) { @@ -394,8 +394,8 @@ char *doc_LoadConfigDir = "correct order."; PyObject *LoadConfigDir(PyObject *Self,PyObject *Args) { - char *Name = 0; - if (PyArg_ParseTuple(Args,"Os",&Self,&Name) == 0) + PyApt_Filename Name; + if (PyArg_ParseTuple(Args,"OO&",&Self,PyApt_Filename::Converter, &Name) == 0) return 0; if (PyConfiguration_Check(Self)== 0) { diff --git a/python/indexfile.cc b/python/indexfile.cc index bf0df516..1a146bac 100644 --- a/python/indexfile.cc +++ b/python/indexfile.cc @@ -18,9 +18,9 @@ static PyObject *IndexFileArchiveURI(PyObject *Self,PyObject *Args) { pkgIndexFile *File = GetCpp(Self); - char *path; + PyApt_Filename path; - if (PyArg_ParseTuple(Args, "s",&path) == 0) + if (PyArg_ParseTuple(Args, "O&", PyApt_Filename::Converter, &path) == 0) return 0; return HandleErrors(Safe_FromString(File->ArchiveURI(path).c_str())); } diff --git a/python/indexrecords.cc b/python/indexrecords.cc index c7623cfd..ae8671ab 100644 --- a/python/indexrecords.cc +++ b/python/indexrecords.cc @@ -51,8 +51,8 @@ static char *indexrecords_lookup_doc = "and the second element 'size' is an int object."; static PyObject *indexrecords_lookup(PyObject *self,PyObject *args) { - const char *keyname; - if (PyArg_ParseTuple(args, "s", &keyname) == 0) + PyApt_Filename keyname; + if (PyArg_ParseTuple(args, "O&", PyApt_Filename::Converter, &keyname) == 0) return 0; indexRecords *records = GetCpp(self); const indexRecords::checkSum *result = records->Lookup(keyname); diff --git a/python/lock.cc b/python/lock.cc index 38a2bc74..7a76c9fd 100644 --- a/python/lock.cc +++ b/python/lock.cc @@ -183,9 +183,10 @@ static PyObject *filelock_exit(filelock_object *self, PyObject *args) static PyObject *filelock_new(PyTypeObject *type, PyObject *args, PyObject *kwds) { - char *filename = 0; + PyApt_Filename filename; char *kwlist[] = {"filename", NULL}; - if (PyArg_ParseTupleAndKeywords(args, kwds, "s:__init__", kwlist, + if (PyArg_ParseTupleAndKeywords(args, kwds, "O&:__init__", kwlist, + PyApt_Filename::Converter, &filename) == 0) { return NULL; } diff --git a/python/pkgmanager.cc b/python/pkgmanager.cc index 5fff1e57..cf19e6bf 100644 --- a/python/pkgmanager.cc +++ b/python/pkgmanager.cc @@ -230,9 +230,9 @@ static PyObject *PkgManagerInstall(PyObject *Self,PyObject *Args) { PyPkgManager *pm = GetCpp(Self); PyObject *pkg; - const char *file; + PyApt_Filename file; - if (PyArg_ParseTuple(Args, "O!s", &PyPackage_Type,&pkg, &file) == 0) + if (PyArg_ParseTuple(Args, "O!O&", &PyPackage_Type,&pkg, PyApt_Filename::Converter, &file) == 0) return 0; return HandleErrors(PyBool_FromLong(pm->callInstall(PyPackage_ToCpp(pkg), file))); diff --git a/python/policy.cc b/python/policy.cc index 96b83abd..ac9a1ace 100644 --- a/python/policy.cc +++ b/python/policy.cc @@ -93,11 +93,12 @@ static char *policy_read_pinfile_doc = "and add it to the policy."; static PyObject *policy_read_pinfile(PyObject *self, PyObject *arg) { - if (!PyString_Check(arg)) + PyApt_Filename name; + if (!name.init(arg)) return 0; pkgPolicy *policy = GetCpp(self); - return PyBool_FromLong(ReadPinFile(*policy, PyString_AsString(arg))); + return PyBool_FromLong(ReadPinFile(*policy, name)); } #if (APT_PKG_MAJOR >= 4 && APT_PKG_MINOR >= 8) @@ -107,11 +108,12 @@ static char *policy_read_pindir_doc = "and add them to the policy."; static PyObject *policy_read_pindir(PyObject *self, PyObject *arg) { - if (!PyString_Check(arg)) + PyApt_Filename name; + if (!name.init(arg)) return 0; pkgPolicy *policy = GetCpp(self); - return PyBool_FromLong(ReadPinDir(*policy, PyString_AsString(arg))); + return PyBool_FromLong(ReadPinDir(*policy, name)); } #endif diff --git a/python/tag.cc b/python/tag.cc index a0f526ad..9f175cc4 100644 --- a/python/tag.cc +++ b/python/tag.cc @@ -435,9 +435,8 @@ static PyObject *TagFileNew(PyTypeObject *type,PyObject *Args,PyObject *kwds) // check if we got a filename or a file object int fileno = -1; - const char *filename = NULL; - filename = PyObject_AsString(File); - if (filename == NULL) { + PyApt_Filename filename; + if (!filename.init(File)) { PyErr_Clear(); fileno = PyObject_AsFileDescriptor(File); } -- cgit v1.2.3 From 637e6987516caed3b61ca025cda3105d0b81bef0 Mon Sep 17 00:00:00 2001 From: Jeremy Bicha Date: Sat, 14 Sep 2013 16:25:43 -0400 Subject: data/templates/Ubuntu.info.in: add 'devel' series --- data/templates/Ubuntu.info.in | 107 ++++++++++++++++++++++++++++++++++++++++++ debian/changelog | 3 ++ 2 files changed, 110 insertions(+) diff --git a/data/templates/Ubuntu.info.in b/data/templates/Ubuntu.info.in index 9de9d75f..314ba053 100644 --- a/data/templates/Ubuntu.info.in +++ b/data/templates/Ubuntu.info.in @@ -1,5 +1,112 @@ _ChangelogURI: http://changelogs.ubuntu.com/changelogs/pool/%s/%s/%s/%s_%s/changelog +Suite: devel +RepositoryType: deb +BaseURI: http://ports.ubuntu.com/ubuntu-ports/ +MatchURI: ports.ubuntu.com/ubuntu-ports +BaseURI-amd64: http://archive.ubuntu.com/ubuntu +MatchURI-amd64: archive.ubuntu.com/ubuntu +BaseURI-i386: http://archive.ubuntu.com/ubuntu +MatchURI-i386: archive.ubuntu.com/ubuntu +MirrorsFile-amd64: Ubuntu.mirrors +MirrorsFile-i386: Ubuntu.mirrors +_Description: Ubuntu development series +Component: main +_CompDescription: Officially supported +_CompDescriptionLong: Canonical-supported free and open-source software +Component: universe +_CompDescription: Community-maintained +_CompDescriptionLong: Community-maintained free and open-source software +Component: restricted +_CompDescription: Non-free drivers +_CompDescriptionLong: Proprietary drivers for devices +Component: multiverse +ParentComponent: universe +_CompDescription: Restricted software +_CompDescriptionLong: Software restricted by copyright or legal issues + +Suite: devel +ParentSuite: devel +RepositoryType: deb-src +BaseURI: http://archive.ubuntu.com/ubuntu/ +MatchURI: archive.ubuntu.com/ubuntu|ports.ubuntu.com/ubuntu-ports +_Description: Ubuntu development series + +Suite: devel +Official: false +RepositoryType: deb +BaseURI: http://archive.canonical.com +MatchURI: archive.canonical.com +_Description: Canonical Partners +Component: partner +_CompDescription: Software packaged by Canonical for their partners +_CompDescriptionLong: This software is not part of Ubuntu. + +Suite: devel +Official: false +RepositoryType: deb +BaseURI: http://extras.ubuntu.com +MatchURI: extras.ubuntu.com +_Description: Independent +Component: main +_CompDescription: Provided by third-party software developers +_CompDescriptionLong: Software offered by third party developers. + +Suite: devel-security +ParentSuite: devel +RepositoryType: deb +BaseURI: http://ports.ubuntu.com/ubuntu-ports/ +MatchURI: ports.ubuntu.com/ubuntu-ports +BaseURI-amd64: http://security.ubuntu.com/ubuntu/ +MatchURI-amd64: archive.ubuntu.com/ubuntu|security.ubuntu.com +BaseURI-i386: http://security.ubuntu.com/ubuntu/ +MatchURI-i386: archive.ubuntu.com/ubuntu|security.ubuntu.com +_Description: Important security updates + +Suite: devel-security +ParentSuite: devel +RepositoryType: deb-src +BaseURI: http://archive.ubuntu.com/ubuntu/ +MatchURI: archive.ubuntu.com/ubuntu|ports.ubuntu.com/ubuntu-ports|security.ubuntu.com +_Description: Important security updates + +Suite: devel-updates +ParentSuite: devel +RepositoryType: deb +_Description: Recommended updates + +Suite: devel-updates +ParentSuite: devel +RepositoryType: deb-src +BaseURI: http://archive.ubuntu.com/ubuntu/ +MatchURI: archive.ubuntu.com/ubuntu|ports.ubuntu.com/ubuntu-ports +_Description: Recommended updates + +Suite: devel-proposed +ParentSuite: devel +RepositoryType: deb +_Description: Pre-released updates + +Suite: devel-proposed +ParentSuite: devel +RepositoryType: deb-src +BaseURI: http://archive.ubuntu.com/ubuntu/ +MatchURI: archive.ubuntu.com/ubuntu|ports.ubuntu.com/ubuntu-ports +_Description: Pre-released updates + +Suite: devel-backports +ParentSuite: devel +RepositoryType: deb +_Description: Unsupported updates + +Suite: devel-backports +ParentSuite: devel +RepositoryType: deb-src +BaseURI: http://archive.ubuntu.com/ubuntu/ +MatchURI: archive.ubuntu.com/ubuntu|ports.ubuntu.com/ubuntu-ports +_Description: Unsupported updates + + Suite: saucy RepositoryType: deb BaseURI: http://ports.ubuntu.com/ubuntu-ports/ diff --git a/debian/changelog b/debian/changelog index a0e11dae..ca844f38 100644 --- a/debian/changelog +++ b/debian/changelog @@ -9,6 +9,9 @@ python-apt (0.9.0) UNRELEASED; urgency=low [ Julian Andres Klode ] * Completely remove all old-API support code + [ Jeremy Bicha ] + * data/templates/Ubuntu.info.in: add 'devel' series (Closes: #722961) + -- Michael Vogt Mon, 05 Aug 2013 22:55:02 +0200 python-apt (0.8.9.1) unstable; urgency=low -- cgit v1.2.3 From 328fd48b06f75e756a9adb15e2bdf408fba47da3 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Tue, 8 Oct 2013 20:32:46 +0200 Subject: aptsources/sourceslist.py: Fix uniq docstring and hide it (Closes: #723815) We accidentally exported this and people wrongly assumed that it was intended for SourcesList objects. --- aptsources/sourceslist.py | 10 +++++++++- debian/changelog | 2 ++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/aptsources/sourceslist.py b/aptsources/sourceslist.py index 48839d6e..43729246 100644 --- a/aptsources/sourceslist.py +++ b/aptsources/sourceslist.py @@ -39,6 +39,9 @@ from .distinfo import DistInfo # some global helpers +__all__ = ['is_mirror', 'SourceEntry', 'NullMatcher', 'SourcesList', + 'SourceEntryMatcher'] + def is_mirror(master_uri, compare_uri): """ check if the given add_url is idential or a mirror of orig_uri @@ -71,7 +74,12 @@ def is_mirror(master_uri, compare_uri): def uniq(s): - """ simple and efficient way to return uniq list """ + """ simple and efficient way to return uniq collection + + This is not intended for use with a SourceList. It is provided + for internal use only. It does not have a leading underscore to + not break any old code that uses it; but it should not be used + in new code (and is not listed in __all__).""" return list(set(s)) diff --git a/debian/changelog b/debian/changelog index ca844f38..1d3bbaa5 100644 --- a/debian/changelog +++ b/debian/changelog @@ -8,6 +8,8 @@ python-apt (0.9.0) UNRELEASED; urgency=low [ Julian Andres Klode ] * Completely remove all old-API support code + * aptsources/sourceslist.py + - Document correct use of uniq and hide it using __all__ (Closes: #723815) [ Jeremy Bicha ] * data/templates/Ubuntu.info.in: add 'devel' series (Closes: #722961) -- cgit v1.2.3 From 08f525a905f7f76f7d810c7d4f02859fd0575414 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Tue, 8 Oct 2013 20:43:57 +0200 Subject: python-apt: formatting error in library/index.rst (Closes: #692484) --- debian/changelog | 3 +++ doc/source/library/index.rst | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index 1d3bbaa5..e1bcc2ae 100644 --- a/debian/changelog +++ b/debian/changelog @@ -14,6 +14,9 @@ python-apt (0.9.0) UNRELEASED; urgency=low [ Jeremy Bicha ] * data/templates/Ubuntu.info.in: add 'devel' series (Closes: #722961) + [ Jakub Wilk ] + * python-apt: formatting error in library/index.rst (Closes: #692484) + -- Michael Vogt Mon, 05 Aug 2013 22:55:02 +0200 python-apt (0.8.9.1) unstable; urgency=low diff --git a/doc/source/library/index.rst b/doc/source/library/index.rst index 70e91f84..dbd58375 100644 --- a/doc/source/library/index.rst +++ b/doc/source/library/index.rst @@ -10,7 +10,7 @@ When going through the library, the first two modules are :mod:`apt_pkg` and apt-pkg and apt-inst libraries and the base for the rest of python-apt. Going forward, the :mod:`apt` package appears. This package is using -:mod:`apt_pkg` and :mod`apt_inst` to provide easy to use ways to manipulate +:mod:`apt_pkg` and :mod:`apt_inst` to provide easy to use ways to manipulate the cache, fetch packages, or install new packages. It also provides useful progress classes, for text and GTK+ interfaces. The last package is :mod:`aptsources`. The aptsources package provides classes and functions to -- cgit v1.2.3 From 29415534292efd2b0c4d2306857ad5c7db5369c5 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Tue, 8 Oct 2013 20:50:28 +0200 Subject: python/apt_pkgmodule.cc: Fix documentation of version_compare (Closes: #680891) This was supposed to be fixed some time ago in mvo's bzr branch but it seems that it did not survive the git migration. --- debian/changelog | 2 ++ python/apt_pkgmodule.cc | 5 +++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/debian/changelog b/debian/changelog index e1bcc2ae..06a8ca4f 100644 --- a/debian/changelog +++ b/debian/changelog @@ -10,6 +10,8 @@ python-apt (0.9.0) UNRELEASED; urgency=low * Completely remove all old-API support code * aptsources/sourceslist.py - Document correct use of uniq and hide it using __all__ (Closes: #723815) + * python/apt_pkgmodule.cc: + - Fix documentation of version_compare (Closes: #680891) [ Jeremy Bicha ] * data/templates/Ubuntu.info.in: add 'devel' series (Closes: #722961) diff --git a/python/apt_pkgmodule.cc b/python/apt_pkgmodule.cc index 5b06f721..65a7c950 100644 --- a/python/apt_pkgmodule.cc +++ b/python/apt_pkgmodule.cc @@ -59,8 +59,9 @@ static PyObject *py_gettext(PyObject *self, PyObject *Args) { // These are kind of legacy.. static char *doc_VersionCompare = "version_compare(a: str, b: str) -> int\n\n" - "Compare the given versions; return -1 if 'a' is smaller than 'b',\n" - "0 if they are equal, and 2 if 'a' is larger than 'b'."; + "Compare the given versions; return a strictly negative value if 'a' is \n" + "smaller than 'b', 0 if they are equal, and a strictly positive value if\n" + "'a' is larger than 'b'."; static PyObject *VersionCompare(PyObject *Self,PyObject *Args) { char *A; -- cgit v1.2.3 From d0739a17f824a7bf3cfa217223b88979c571e7dd Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Tue, 8 Oct 2013 21:09:08 +0200 Subject: apt/package.py: Add a Package.has_config_files property (Closes: #712749) The name might be a bit misleading, but I cannot find a short name that completely describes this check. --- apt/package.py | 5 +++++ debian/changelog | 2 ++ 2 files changed, 7 insertions(+) diff --git a/apt/package.py b/apt/package.py index f311eaff..f5aa5237 100644 --- a/apt/package.py +++ b/apt/package.py @@ -1051,6 +1051,11 @@ class Package(object): """Return True if the installed package is broken.""" return self._pcache._depcache.is_now_broken(self._pkg) + @property + def has_config_files(self): + """Checks whether the package is is the config-files state.""" + return self. _pkg.current_state == apt_pkg.CURSTATE_CONFIG_FILES + # depcache actions def mark_keep(self): diff --git a/debian/changelog b/debian/changelog index 06a8ca4f..b994b62d 100644 --- a/debian/changelog +++ b/debian/changelog @@ -12,6 +12,8 @@ python-apt (0.9.0) UNRELEASED; urgency=low - Document correct use of uniq and hide it using __all__ (Closes: #723815) * python/apt_pkgmodule.cc: - Fix documentation of version_compare (Closes: #680891) + * apt/package.py: + - Add a Package.has_config_files property (Closes: #712749) [ Jeremy Bicha ] * data/templates/Ubuntu.info.in: add 'devel' series (Closes: #722961) -- cgit v1.2.3 From 9305bd3ff845eb61649767b86688bb36b54d9437 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Tue, 8 Oct 2013 18:46:37 +0200 Subject: python/generic.cc: Move PyApt_Filename::init here --- python/generic.cc | 23 +++++++++++++++++++++++ python/generic.h | 22 +--------------------- 2 files changed, 24 insertions(+), 21 deletions(-) diff --git a/python/generic.cc b/python/generic.cc index 8e65c4f3..5e712899 100644 --- a/python/generic.cc +++ b/python/generic.cc @@ -93,3 +93,26 @@ PyObject *CharCharToList(const char **List,unsigned long Size) return PList; } /*}}}*/ + +int PyApt_Filename::init(PyObject *object) +{ + this->object = NULL; + this->path = NULL; + +#if PY_MAJOR_VERSION < 3 || (PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION < 2) + this->path = PyObject_AsString(object); + return this->path ? 1 : 0; +#else + if (PyUnicode_Check(object)) { + object = PyUnicode_EncodeFSDefault(object); + } else if (PyBytes_Check(object)) { + Py_INCREF(object); + } else { + return 0; + } + + this->object = object; + this->path = PyBytes_AS_STRING(this->object); + return 1; +#endif +} diff --git a/python/generic.h b/python/generic.h index 7dc89ca6..c9db916c 100644 --- a/python/generic.h +++ b/python/generic.h @@ -269,27 +269,7 @@ public: path = NULL; } - int init(PyObject *object) { - this->object = NULL; - this->path = NULL; - -#if PY_MAJOR_VERSION < 3 || (PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION < 2) - this->path = PyObject_AsString(object); - return this->path ? 1 : 0; -#else - if (PyUnicode_Check(object)) { - object = PyUnicode_EncodeFSDefault(object); - } else if (PyBytes_Check(object)) { - Py_INCREF(object); - } else { - return 0; - } - - this->object = object; - this->path = PyBytes_AS_STRING(this->object); - return 1; -#endif - } + int init(PyObject *object); ~PyApt_Filename() { Py_XDECREF(object); -- cgit v1.2.3 From 0c14ca98b696f25e6359da695601c50a8217c423 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Tue, 8 Oct 2013 22:01:41 +0200 Subject: Accept bytes object for file names (Closes: #680971) I accidentally pushed those changes to debian/sid, but the test suite still runs, so everything should be fine. We're still missing some automatic tests, though. --- debian/changelog | 1 + 1 file changed, 1 insertion(+) diff --git a/debian/changelog b/debian/changelog index b994b62d..44bf70c9 100644 --- a/debian/changelog +++ b/debian/changelog @@ -8,6 +8,7 @@ python-apt (0.9.0) UNRELEASED; urgency=low [ Julian Andres Klode ] * Completely remove all old-API support code + * Accept bytes object for file names (Closes: #680971) * aptsources/sourceslist.py - Document correct use of uniq and hide it using __all__ (Closes: #723815) * python/apt_pkgmodule.cc: -- cgit v1.2.3 From 03b1e193ecf6ef09f38982ab752ee6998cf626d8 Mon Sep 17 00:00:00 2001 From: Daniel Hartwig Date: Wed, 5 Sep 2012 11:31:03 +0800 Subject: apt/package.py: mark_upgrade misuses FromUser to set auto-installed Package.mark_upgrade uses FromUser for it's side effect of setting a package as auto-installed (or not). However, FromUser is also influential in pkgDepCache::IsModeChangeOk to determine whether an action should override a dpkg hold, etc.. Closes: #686726 --- apt/package.py | 5 +++-- debian/changelog | 4 ++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/apt/package.py b/apt/package.py index f5aa5237..04d4dddd 100644 --- a/apt/package.py +++ b/apt/package.py @@ -1109,11 +1109,12 @@ class Package(object): fixer.resolve(True) self._pcache.cache_post_change() - def mark_upgrade(self): + def mark_upgrade(self, from_user=True): """Mark a package for upgrade.""" if self.is_upgradable: - from_user = not self._pcache._depcache.is_auto_installed(self._pkg) + auto = self.is_auto_installed self.mark_install(from_user=from_user) + self.mark_auto(auto) else: # FIXME: we may want to throw a exception here sys.stderr.write(("MarkUpgrade() called on a non-upgrable pkg: " diff --git a/debian/changelog b/debian/changelog index 44bf70c9..39306d8b 100644 --- a/debian/changelog +++ b/debian/changelog @@ -22,6 +22,10 @@ python-apt (0.9.0) UNRELEASED; urgency=low [ Jakub Wilk ] * python-apt: formatting error in library/index.rst (Closes: #692484) + [ Daniel Hartwig ] + * apt/package.py: + - mark_upgrade misuses FromUser to set auto-installed (Closes: #686726) + -- Michael Vogt Mon, 05 Aug 2013 22:55:02 +0200 python-apt (0.8.9.1) unstable; urgency=low -- cgit v1.2.3 From 571618374ee880d00477d7379aaf01a36718db64 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Thu, 10 Oct 2013 14:54:41 +0200 Subject: tests: Do not set dir::etc::sourceparts to /tmp This can cause build failures if *.list files are present in /tmp. Use /dev/null instead (not a directory, but APT silently ignores this). --- debian/changelog | 2 ++ tests/test_apt_cache.py | 3 ++- tests/test_progress.py | 3 ++- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/debian/changelog b/debian/changelog index 39306d8b..77c64d82 100644 --- a/debian/changelog +++ b/debian/changelog @@ -15,6 +15,8 @@ python-apt (0.9.0) UNRELEASED; urgency=low - Fix documentation of version_compare (Closes: #680891) * apt/package.py: - Add a Package.has_config_files property (Closes: #712749) + * tests: + - Do not set dir::etc::sourceparts to /tmp [ Jeremy Bicha ] * data/templates/Ubuntu.info.in: add 'devel' series (Closes: #722961) diff --git a/tests/test_apt_cache.py b/tests/test_apt_cache.py index 21dfeb98..9940374f 100644 --- a/tests/test_apt_cache.py +++ b/tests/test_apt_cache.py @@ -188,7 +188,8 @@ class TestAptCache(TestCase): old_source_list = apt_pkg.config.find("dir::etc::sourcelist") old_source_parts = apt_pkg.config.find("dir::etc::sourceparts") apt_pkg.config.set("dir::etc::sourcelist", base_sources) - apt_pkg.config.set("dir::etc::sourceparts", "/tmp") + # TODO: /dev/null is not a dir, perhaps find something better + apt_pkg.config.set("dir::etc::sourceparts", "/dev/null") # main sources.list sources_list = base_sources with open(sources_list, "w") as f: diff --git a/tests/test_progress.py b/tests/test_progress.py index b7bba02f..e4a5fa3c 100644 --- a/tests/test_progress.py +++ b/tests/test_progress.py @@ -27,7 +27,8 @@ class TestProgress(unittest.TestCase): apt_pkg.init() apt_pkg.config.set("APT::Architecture", "amd64") apt_pkg.config.set("Dir::Etc", basedir) - apt_pkg.config.set("Dir::Etc::sourceparts", "/tmp") + # TODO: /dev/null is not a dir, perhaps find something better + apt_pkg.config.set("Dir::Etc::sourceparts", "/dev/null") # setup lists dir if not os.path.exists("./tmp/partial"): os.makedirs("./tmp/partial") -- cgit v1.2.3 From 1d62185fb1eb7b9523ec45666c3d96863b91e9af Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Thu, 10 Oct 2013 15:12:11 +0200 Subject: apt, aptsources: Only call init_config() if not already initialized Based on an idea by the bug reporter. Reported-by: Dominique Lasserre Closes: #686403 --- apt/__init__.py | 6 ++++-- aptsources/__init__.py | 7 +++++-- debian/changelog | 2 ++ 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/apt/__init__.py b/apt/__init__.py index 4ded8e29..7b04befb 100644 --- a/apt/__init__.py +++ b/apt/__init__.py @@ -25,7 +25,9 @@ from apt.package import Package from apt.cache import Cache, ProblemResolver from apt.cdrom import Cdrom -# init the package system -apt_pkg.init() +# init the package system, but do not re-initialize config +if "APT" not in apt_pkg.config: + apt_pkg.init_config() +apt_pkg.init_system() __all__ = ['Cache', 'Cdrom', 'Package'] diff --git a/aptsources/__init__.py b/aptsources/__init__.py index c02341c2..0929e12b 100644 --- a/aptsources/__init__.py +++ b/aptsources/__init__.py @@ -1,4 +1,7 @@ import apt_pkg -# init the package system -apt_pkg.init() + +# init the package system, but do not re-initialize config +if "APT" not in apt_pkg.config: + apt_pkg.init_config() +apt_pkg.init_system() diff --git a/debian/changelog b/debian/changelog index 77c64d82..81e30b64 100644 --- a/debian/changelog +++ b/debian/changelog @@ -17,6 +17,8 @@ python-apt (0.9.0) UNRELEASED; urgency=low - Add a Package.has_config_files property (Closes: #712749) * tests: - Do not set dir::etc::sourceparts to /tmp + * apt, aptsources: + - Only call init_config() if not already initialized (Closes: #686403) [ Jeremy Bicha ] * data/templates/Ubuntu.info.in: add 'devel' series (Closes: #722961) -- cgit v1.2.3 From ca19a1977a715359471d104a2adbecfa540f3af5 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Mon, 14 Oct 2013 17:21:55 +0200 Subject: python/indexrecords.cc: IndexRecords.load() needs to accept bytes as well --- python/indexrecords.cc | 4 ++-- tests/test_paths.py | 29 +++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 2 deletions(-) create mode 100644 tests/test_paths.py diff --git a/python/indexrecords.cc b/python/indexrecords.cc index ae8671ab..9446fad1 100644 --- a/python/indexrecords.cc +++ b/python/indexrecords.cc @@ -37,8 +37,8 @@ static PyObject *indexrecords_new(PyTypeObject *type,PyObject *Args, static PyObject *indexrecords_load(PyObject *self,PyObject *args) { - const char *filename; - if (PyArg_ParseTuple(args, "s", &filename) == 0) + PyApt_Filename filename; + if (PyArg_ParseTuple(args, "O&", PyApt_Filename::Converter, &filename) == 0) return 0; indexRecords *records = GetCpp(self); return HandleErrors(PyBool_FromLong(records->Load(filename))); diff --git a/tests/test_paths.py b/tests/test_paths.py new file mode 100644 index 00000000..d83ef14b --- /dev/null +++ b/tests/test_paths.py @@ -0,0 +1,29 @@ +# +# Test that both unicode and bytes path names work +# +import unittest + +import apt_pkg + + +class TestPath(unittest.TestCase): + + def setUp(self): + apt_pkg.init() + + def test_index_records(self): + index = apt_pkg.IndexRecords() + index.load(u"./data/misc/foo_Release") + index.load(b"./data/misc/foo_Release") + + hash1, size1 = index.lookup(u"main/i18n/Index") + hash2, size2 = index.lookup(b"main/i18n/Index") + + self.assertEqual(size1, size2) + self.assertEqual(str(hash1), str(hash2)) + self.assertEqual(str(hash1), ("SHA256:fefed230e286d832ab6eb0fb7b72" + + "442165b50df23a68402ae6e9d265a31920a2")) + + +if __name__ == '__main__': + unittest.main() -- cgit v1.2.3 From 173e3de24749ebf27903603bd5a7c84aadfdeea8 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Mon, 14 Oct 2013 19:01:52 +0200 Subject: Add tests for (all except one) functions accepting paths Test the functions with a unicode and a byte object each. I ignore PackageManager.install, because I cannot imagine an easy way to test that one. --- tests/test_paths.py | 106 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 106 insertions(+) diff --git a/tests/test_paths.py b/tests/test_paths.py index d83ef14b..d4fe21d0 100644 --- a/tests/test_paths.py +++ b/tests/test_paths.py @@ -1,15 +1,89 @@ # # Test that both unicode and bytes path names work # +import os +import shutil +import tempfile import unittest +import apt_inst import apt_pkg class TestPath(unittest.TestCase): + dir_unicode = u'data/tmp' + dir_bytes = b'data/tmp' + file_unicode = u'data/tmp/python-apt-test' + file_bytes = b'data/tmp/python-apt-test' + def setUp(self): apt_pkg.init() + if os.path.exists(self.dir_bytes): + shutil.rmtree(self.dir_bytes) + + os.mkdir(self.dir_bytes) + + def tearDown(self): + shutil.rmtree(self.dir_bytes) + + def test_acquire(self): + apt_pkg.AcquireFile(apt_pkg.Acquire(), "http://example.com", + destdir=self.file_bytes, destfile=self.file_bytes) + apt_pkg.AcquireFile(apt_pkg.Acquire(), "http://example.com", + destdir=self.file_unicode, destfile=self.file_unicode) + + def test_ararchive(self): + archive = apt_inst.ArArchive(u"data/test_debs/data-tar-xz.deb") + + apt_inst.ArArchive(b"data/test_debs/data-tar-xz.deb") + + archive.extract(u"debian-binary", u"data/tmp") + archive.extract(b"debian-binary", b"data/tmp") + archive.extractall(u"data/tmp") + archive.extractall(b"data/tmp") + self.assertEqual(archive.extractdata(u"debian-binary"), b"2.0\n") + self.assertEqual(archive.extractdata(b"debian-binary"), b"2.0\n") + self.assertTrue(archive.getmember(u"debian-binary")) + self.assertTrue(archive.getmember(b"debian-binary")) + self.assertTrue(u"debian-binary" in archive) + self.assertTrue(b"debian-binary" in archive) + self.assertTrue(archive[b"debian-binary"]) + self.assertTrue(archive[u"debian-binary"]) + + tar = archive.gettar(u"control.tar.gz", "gzip") + tar = archive.gettar(b"control.tar.gz", "gzip") + + tar.extractall(self.dir_unicode) + tar.extractall(self.dir_bytes) + self.assertRaises(LookupError, tar.extractdata, u"Do-not-exist") + self.assertRaises(LookupError, tar.extractdata, b"Do-not-exist") + tar.extractdata(b"control") + tar.extractdata(u"control") + + apt_inst.TarFile(os.path.join(self.dir_unicode, u"control.tar.gz")) + apt_inst.TarFile(os.path.join(self.dir_bytes, b"control.tar.gz")) + + def test_configuration(self): + with open(self.file_unicode, 'w' ) as config: + config.write("Hello { World 1; };") + apt_pkg.read_config_file(apt_pkg.config, self.file_bytes) + apt_pkg.read_config_file(apt_pkg.config, self.file_unicode) + apt_pkg.read_config_file_isc(apt_pkg.config, self.file_bytes) + apt_pkg.read_config_file_isc(apt_pkg.config, self.file_unicode) + apt_pkg.read_config_dir(apt_pkg.config, self.dir_unicode) + apt_pkg.read_config_dir(apt_pkg.config, b"/etc/apt/apt.conf.d") + + def test_index_file(self): + apt_pkg.config["rootdir"] = "data/test_debs" + cache = apt_pkg.Cache(None) + slist = apt_pkg.SourceList() + slist.read_main_list() + + for meta in slist.list: + for index in meta.index_files: + index.archive_uri(self.file_bytes) + index.archive_uri(self.file_unicode) def test_index_records(self): index = apt_pkg.IndexRecords() @@ -24,6 +98,38 @@ class TestPath(unittest.TestCase): self.assertEqual(str(hash1), ("SHA256:fefed230e286d832ab6eb0fb7b72" + "442165b50df23a68402ae6e9d265a31920a2")) + def test_lock(self): + apt_pkg.get_lock(self.file_unicode, True) + apt_pkg.get_lock(self.file_bytes, True) + + with apt_pkg.FileLock(self.file_unicode): + pass + with apt_pkg.FileLock(self.file_bytes): + pass + + def test_policy(self): + apt_pkg.config["rootdir"] = "data/test_debs" + cache = apt_pkg.Cache(None) + policy = apt_pkg.Policy(cache) + file_unicode = os.path.join(self.dir_unicode, u"test.prefs") + file_bytes = os.path.join(self.dir_bytes, b"test.prefs") + + self.assertTrue(policy.read_pinfile(file_unicode)) + self.assertTrue(policy.read_pinfile(file_bytes)) + self.assertTrue(policy.read_pindir(self.dir_unicode)) + self.assertTrue(policy.read_pindir(self.dir_bytes)) + + def test_tag(self): + with open(self.file_bytes, "w") as tag: + tag.write("Key: value\n") + tag1 = apt_pkg.TagFile(self.file_unicode) + tag2 = apt_pkg.TagFile(self.file_bytes) + + self.assertEqual(next(tag1)["Key"], "value") + self.assertEqual(next(tag2)["Key"], "value") + + self.assertRaises(StopIteration, next, tag1) + self.assertRaises(StopIteration, next, tag2) if __name__ == '__main__': unittest.main() -- cgit v1.2.3 From 10641ad184e53e165cb655f3bcf01ece430cc00e Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Mon, 14 Oct 2013 19:14:29 +0200 Subject: tests/test_path.py: Use "Dir" option instead of "RootDir", and reset in tearDown This fixes tests/test_all.py. --- tests/test_paths.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/test_paths.py b/tests/test_paths.py index d4fe21d0..17f562d2 100644 --- a/tests/test_paths.py +++ b/tests/test_paths.py @@ -25,6 +25,7 @@ class TestPath(unittest.TestCase): os.mkdir(self.dir_bytes) def tearDown(self): + apt_pkg.config["dir"] = "/" shutil.rmtree(self.dir_bytes) def test_acquire(self): @@ -75,8 +76,7 @@ class TestPath(unittest.TestCase): apt_pkg.read_config_dir(apt_pkg.config, b"/etc/apt/apt.conf.d") def test_index_file(self): - apt_pkg.config["rootdir"] = "data/test_debs" - cache = apt_pkg.Cache(None) + apt_pkg.config["dir"] = "data/test_debs" slist = apt_pkg.SourceList() slist.read_main_list() @@ -108,7 +108,7 @@ class TestPath(unittest.TestCase): pass def test_policy(self): - apt_pkg.config["rootdir"] = "data/test_debs" + apt_pkg.config["dir"] = "data/test_debs" cache = apt_pkg.Cache(None) policy = apt_pkg.Policy(cache) file_unicode = os.path.join(self.dir_unicode, u"test.prefs") -- cgit v1.2.3 From 4e993e56261be9730f565f86e728ad6928b99ea4 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Mon, 14 Oct 2013 19:19:01 +0200 Subject: utils/get_ubuntu_mirrors_from_lp.py: Switch to Python 3 again --- pre-build.sh | 2 +- utils/get_ubuntu_mirrors_from_lp.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pre-build.sh b/pre-build.sh index 1c5a9183..08c0bef6 100755 --- a/pre-build.sh +++ b/pre-build.sh @@ -1,7 +1,7 @@ #!/bin/sh set -e -dpkg-checkbuilddeps -d 'python-debian, python-feedparser' +dpkg-checkbuilddeps -d 'python-debian, python3-feedparser' echo "updating Ubuntu mirror list from launchpad" if [ -n "$https_proxy" ]; then diff --git a/utils/get_ubuntu_mirrors_from_lp.py b/utils/get_ubuntu_mirrors_from_lp.py index ef049f78..7c4d3831 100755 --- a/utils/get_ubuntu_mirrors_from_lp.py +++ b/utils/get_ubuntu_mirrors_from_lp.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # get_ubuntu_lp_mirrors.py # -- cgit v1.2.3 From 01995674f11c2ce21d4daf1b82160fc60215abc4 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Tue, 15 Oct 2013 23:24:54 +0200 Subject: python/apt_pkgmodule.cc: Document second parameter of parse_{,src_}depends The functions apt_pkg.parse_depends and apt_pkg.parse_src_depends take a second positional argument telling it whether to strip multi-arch strings or not. --- python/apt_pkgmodule.cc | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/python/apt_pkgmodule.cc b/python/apt_pkgmodule.cc index 65a7c950..a3916021 100644 --- a/python/apt_pkgmodule.cc +++ b/python/apt_pkgmodule.cc @@ -129,17 +129,19 @@ static PyObject *UpstreamVersion(PyObject *Self,PyObject *Args) } static const char *doc_ParseDepends = -"parse_depends(s: str) -> list\n" +"parse_depends(s: str[, strip_multi_arch : bool = True]) -> list\n" "\n" "Parse the dependencies given by 's' and return a list of lists. Each of\n" "these lists represents one or more options for an 'or' dependency in\n" "the form of '(pkg, ver, comptype)' tuples. The tuple element 'pkg'\n" "is the name of the package; the element 'ver' is the version, or ''\n" "if no version was requested. The element 'ver' is a comparison\n" -"operator ('<', '<=', '=', '>=', or '>')."; +"operator ('<', '<=', '=', '>=', or '>').\n\n" +"If 'strip_multi_arch' is True, :any (and potentially other special values)\n" +"will be stripped from the full package name"; static const char *parse_src_depends_doc = -"parse_src_depends(s: str) -> list\n" +"parse_src_depends(s: str[, strip_multi_arch : bool = True]) -> list\n" "\n" "Parse the dependencies given by 's' and return a list of lists. Each of\n" "these lists represents one or more options for an 'or' dependency in\n" @@ -150,7 +152,9 @@ static const char *parse_src_depends_doc = "\n\n" "Dependencies may be restricted to certain architectures and the result\n" "only contains those dependencies for the architecture set in the\n" -"configuration variable APT::Architecture"; +"configuration variable APT::Architecture\n\n" +"If 'strip_multi_arch' is True, :any (and potentially other special values)\n" +"will be stripped from the full package name"; static PyObject *RealParseDepends(PyObject *Self,PyObject *Args, bool ParseArchFlags, std::string name, bool debStyle=false) -- cgit v1.2.3 From c7fd83fdfca918a7cf0b416d341bf7687a11792f Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Mon, 21 Oct 2013 10:49:29 +0200 Subject: apt/debfile.py: Pass strip_multi_arch=False to parse_depends. Patch by Michael, tests derived from the ones provided by the reporter. I included the test debs without the source package, as for our use case, all needed "source code" is included in the package itself anyway. Reported-By: Francois Gouget Closes: #717859 Closes: #717861 --- apt/debfile.py | 14 ++++---- debian/changelog | 4 +++ .../test_debs/testdep-allowed-any_1.0-1_i386.deb | Bin 0 -> 1128 bytes .../test_debs/testdep-same-arch_1.0-1_i386.deb | Bin 0 -> 1236 bytes tests/data/test_debs/var/lib/dpkg/status | 39 +++++++++++++++++++++ tests/test_debfile.py | 17 +++++++++ 6 files changed, 68 insertions(+), 6 deletions(-) create mode 100644 tests/data/test_debs/testdep-allowed-any_1.0-1_i386.deb create mode 100644 tests/data/test_debs/testdep-same-arch_1.0-1_i386.deb diff --git a/apt/debfile.py b/apt/debfile.py index adf9b348..7f9cf9fc 100644 --- a/apt/debfile.py +++ b/apt/debfile.py @@ -102,6 +102,8 @@ class DebPackage(object): def _maybe_append_multiarch_suffix(self, pkgname, in_conflict_checking=False): # trivial cases + if ":" in pkgname: + return pkgname if not self._multiarch: return pkgname elif self._cache.is_virtual_package(pkgname): @@ -276,7 +278,7 @@ class DebPackage(object): """List of package names conflicting with this package.""" key = "Conflicts" try: - return apt_pkg.parse_depends(self._sections[key]) + return apt_pkg.parse_depends(self._sections[key], False) except KeyError: return [] @@ -287,7 +289,7 @@ class DebPackage(object): # find depends for key in "Depends", "Pre-Depends": try: - depends.extend(apt_pkg.parse_depends(self._sections[key])) + depends.extend(apt_pkg.parse_depends(self._sections[key], False)) except KeyError: pass return depends @@ -297,7 +299,7 @@ class DebPackage(object): """List of virtual packages which are provided by this package.""" key = "Provides" try: - return apt_pkg.parse_depends(self._sections[key]) + return apt_pkg.parse_depends(self._sections[key], False) except KeyError: return [] @@ -306,7 +308,7 @@ class DebPackage(object): """List of packages which are replaced by this package.""" key = "Replaces" try: - return apt_pkg.parse_depends(self._sections[key]) + return apt_pkg.parse_depends(self._sections[key], False) except KeyError: return [] @@ -499,7 +501,7 @@ class DebPackage(object): def satisfy_depends_str(self, dependsstr): """Satisfy the dependencies in the given string.""" - return self._satisfy_depends(apt_pkg.parse_depends(dependsstr)) + return self._satisfy_depends(apt_pkg.parse_depends(dependsstr, False)) def _satisfy_depends(self, depends): """Satisfy the dependencies.""" @@ -744,7 +746,7 @@ def _test(): s = DscSrcPackage(cache=cache) d = "libc6 (>= 2.3.2), libaio (>= 0.3.96) | libaio1 (>= 0.3.96)" - print s._satisfy_depends(apt_pkg.parse_depends(d)) + print s._satisfy_depends(apt_pkg.parse_depends(d, False)) if __name__ == "__main__": _test() diff --git a/debian/changelog b/debian/changelog index 81e30b64..39298b86 100644 --- a/debian/changelog +++ b/debian/changelog @@ -19,6 +19,10 @@ python-apt (0.9.0) UNRELEASED; urgency=low - Do not set dir::etc::sourceparts to /tmp * apt, aptsources: - Only call init_config() if not already initialized (Closes: #686403) + * apt/debfile.py: + - Pass strip_multi_arch=False to parse_depends. Patch by Michael, tests + derived from the ones provided by the reporter. + Closes: #717859. Closes: #717861. [ Jeremy Bicha ] * data/templates/Ubuntu.info.in: add 'devel' series (Closes: #722961) diff --git a/tests/data/test_debs/testdep-allowed-any_1.0-1_i386.deb b/tests/data/test_debs/testdep-allowed-any_1.0-1_i386.deb new file mode 100644 index 00000000..c56f8192 Binary files /dev/null and b/tests/data/test_debs/testdep-allowed-any_1.0-1_i386.deb differ diff --git a/tests/data/test_debs/testdep-same-arch_1.0-1_i386.deb b/tests/data/test_debs/testdep-same-arch_1.0-1_i386.deb new file mode 100644 index 00000000..872f3b6f Binary files /dev/null and b/tests/data/test_debs/testdep-same-arch_1.0-1_i386.deb differ diff --git a/tests/data/test_debs/var/lib/dpkg/status b/tests/data/test_debs/var/lib/dpkg/status index f0c48151..5c2c48a0 100644 --- a/tests/data/test_debs/var/lib/dpkg/status +++ b/tests/data/test_debs/var/lib/dpkg/status @@ -51,3 +51,42 @@ Description: Debian configuration management system Debconf is a configuration management system for debian packages. Packages use Debconf to ask questions when they are installed. Python-Version: 2.6, 3.1 + +Package: testdep-same +Status: install ok installed +Source: testdep +Version: 1.0-1 +Architecture: amd64 +Maintainer: Francois Gouget +Installed-Size: 25 +Provides: testdep-virtual-same +Section: unknown +Priority: extra +Multi-Arch: same +Description: Multi-arch = same package, no dependency + This is a multiarch package that can only satisfy dependencies for the same + architecture. But multiple instances of this package can be co-installed, + one for each architecture. + . + Library and development packages typically fall into this category. + +Package: testdep-allowed +Status: install ok installed +Source: testdep +Version: 1.0-1 +Architecture: amd64 +Maintainer: Francois Gouget +Installed-Size: 25 +Provides: testdep-virtual-allowed +Section: unknown +Priority: extra +Multi-Arch: allowed +Description: Multi-arch = allowed package, no dependency + This is a multiarch package. By default it can only satisfy dependencies for + packages of the same architecture but that can be changed with ':any' + dependencies. + . + It can only be installed for one architecture at a time. Trying to install the + same package for another architecture will remove the first one. + . + Packages providing tools or shells typically fall into this category. diff --git a/tests/test_debfile.py b/tests/test_debfile.py index 2ae73a45..3e933944 100644 --- a/tests/test_debfile.py +++ b/tests/test_debfile.py @@ -137,6 +137,23 @@ Description: testpackage for gdebi - contains usr/bin/binary for file reading deb = apt.debfile.DebPackage("./data/test_debs/data-tar-xz.deb") self.assertTrue("Package" in deb) + def test_multi_arch_allowed(self): + apt_pkg.config["APT::Architectures::"] = "i386" + apt_pkg.config["APT::Architectures::"] = "amd64" + apt_pkg.config["APT::Architecture"] = "amd64" + apt_pkg.init_system() + + allowed_any = apt.debfile.DebPackage("./data/test_debs/testdep-allowed-any_1.0-1_i386.deb") + self.assertTrue(allowed_any.check(), allowed_any._failure_string) + + def test_multi_arch_same(self): + apt_pkg.config["APT::Architectures::"] = "i386" + apt_pkg.config["APT::Architectures::"] = "amd64" + apt_pkg.config["APT::Architecture"] = "amd64" + apt_pkg.init_system() + same = apt.debfile.DebPackage("./data/test_debs/testdep-same-arch_1.0-1_i386.deb") + self.assertTrue(same.check(), same._failure_string) + if __name__ == "__main__": #logging.basicConfig(level=logging.DEBUG) -- cgit v1.2.3 From 71796ca442960efe89fe3519e8bc6dbfe96b56dc Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Mon, 21 Oct 2013 11:23:35 +0200 Subject: python/cache.cc: Set NoDelete=true when creating Policy, fixes segfault in destructor --- debian/changelog | 2 ++ python/cache.cc | 8 ++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/debian/changelog b/debian/changelog index 39298b86..a8be3040 100644 --- a/debian/changelog +++ b/debian/changelog @@ -13,6 +13,8 @@ python-apt (0.9.0) UNRELEASED; urgency=low - Document correct use of uniq and hide it using __all__ (Closes: #723815) * python/apt_pkgmodule.cc: - Fix documentation of version_compare (Closes: #680891) + * python/cache.cc: + - Set NoDelete=true when creating Policy, fixes segfault in destructor * apt/package.py: - Add a Package.has_config_files property (Closes: #712749) * tests: diff --git a/python/cache.cc b/python/cache.cc index 65b99210..40782838 100644 --- a/python/cache.cc +++ b/python/cache.cc @@ -180,8 +180,12 @@ static PyObject *PkgCacheGetGroups(PyObject *Self, void*) { static PyObject *PkgCacheGetPolicy(PyObject *Self, void*) { pkgCacheFile *CacheFile = GetCpp(Self); - std::cerr << "policy: " << CacheFile->Policy << std::endl; - return CppPyObject_NEW(Self,&PyPolicy_Type,CacheFile->Policy); + CppPyObject *obj; + + obj = CppPyObject_NEW(Self,&PyPolicy_Type,CacheFile->Policy); + obj->NoDelete = true; + + return obj; } static PyObject *PkgCacheGetPackages(PyObject *Self, void*) { -- cgit v1.2.3 From ce50049ebd837697c947ed332a8a81bc56c75fb4 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Mon, 21 Oct 2013 11:34:36 +0200 Subject: doc/source/examples/dpkg-info.py: Use apt_inst.DebFile We previously used deb_extract_control, but this does not exist. Closes: #671784 --- debian/changelog | 2 ++ doc/source/examples/dpkg-info.py | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/debian/changelog b/debian/changelog index a8be3040..f1e40039 100644 --- a/debian/changelog +++ b/debian/changelog @@ -25,6 +25,8 @@ python-apt (0.9.0) UNRELEASED; urgency=low - Pass strip_multi_arch=False to parse_depends. Patch by Michael, tests derived from the ones provided by the reporter. Closes: #717859. Closes: #717861. + * doc/source/examples/dpkg-info.py: + - Use apt_inst.DebFile (Closes: #671784) [ Jeremy Bicha ] * data/templates/Ubuntu.info.in: add 'devel' series (Closes: #722961) diff --git a/doc/source/examples/dpkg-info.py b/doc/source/examples/dpkg-info.py index 6be8595c..af220590 100644 --- a/doc/source/examples/dpkg-info.py +++ b/doc/source/examples/dpkg-info.py @@ -2,7 +2,7 @@ """Emulate dpkg --info package.deb control-file""" import sys -from apt_inst import deb_extract_control +from apt_inst import DebFile def main(): @@ -12,7 +12,7 @@ def main(): sys.exit(0) fobj = open(sys.argv[1]) try: - print deb_extract_control(fobj, sys.argv[2]) + print DebFile(fobj).control.extractdata(sys.argv[2]) finally: fobj.close() -- cgit v1.2.3 From abc9feb18b268cbc4ddb79aabb30ce352e31b44a Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Mon, 21 Oct 2013 14:35:33 +0200 Subject: doc/examples: Start updating to new API --- doc/examples/acquire.py | 41 ++++++------- doc/examples/action.py | 132 ++++++++++++++++++++--------------------- doc/examples/all_deps.py | 14 ++--- doc/examples/build-deps-old.py | 32 +++++----- doc/examples/build-deps.py | 14 ++--- doc/examples/cdrom.py | 6 +- doc/examples/checkstate.py | 18 +++--- doc/examples/config.py | 18 +++--- doc/examples/configisc.py | 22 +++---- doc/examples/deb_inspect.py | 14 ++--- 10 files changed, 156 insertions(+), 155 deletions(-) diff --git a/doc/examples/acquire.py b/doc/examples/acquire.py index 96426a32..ec6f6576 100644 --- a/doc/examples/acquire.py +++ b/doc/examples/acquire.py @@ -1,5 +1,6 @@ #!/usr/bin/python import apt +import apt.progress.text import apt_pkg import os @@ -8,8 +9,8 @@ def get_file(fetcher, uri, destfile): # get the file af = apt_pkg.AcquireFile(fetcher, uri=uri, descr="sample descr", destfile=destfile) - res = fetcher.Run() - if res != fetcher.ResultContinue: + res = fetcher.run() + if res != fetcher.RESULT_CONTINUE: return False return True @@ -24,30 +25,30 @@ depcache = apt_pkg.DepCache(cache) recs = apt_pkg.PackageRecords(cache) list = apt_pkg.SourceList() -list.ReadMainList() +list.read_main_list() # show the amount fetch needed for a dist-upgrade -depcache.Upgrade(True) -progress = apt.progress.TextFetchProgress() +depcache.upgrade(True) +progress = apt.progress.text.AcquireProgress() fetcher = apt_pkg.Acquire(progress) pm = apt_pkg.PackageManager(depcache) -pm.GetArchives(fetcher, list, recs) -print "%s (%s)" % (apt_pkg.SizeToStr(fetcher.FetchNeeded), fetcher.FetchNeeded) +pm.get_archives(fetcher, list, recs) +print "%s (%s)" % (apt_pkg.size_to_str(fetcher.fetch_needed), fetcher.fetch_needed) actiongroup = apt_pkg.ActionGroup(depcache) -for pkg in cache.Packages: - depcache.MarkKeep(pkg) +for pkg in cache.packages: + depcache.mark_keep(pkg) try: os.mkdir("/tmp/pyapt-test") os.mkdir("/tmp/pyapt-test/partial") except OSError: pass -apt_pkg.Config.Set("Dir::Cache::archives", "/tmp/pyapt-test") +apt_pkg.config.set("Dir::Cache::archives", "/tmp/pyapt-test") pkg = cache["3ddesktop"] -depcache.MarkInstall(pkg) +depcache.mark_install(pkg) -progress = apt.progress.TextFetchProgress() +progress = apt.progress.text.AcquireProgress() fetcher = apt_pkg.Acquire(progress) #fetcher = apt_pkg.Acquire() pm = apt_pkg.PackageManager(depcache) @@ -57,20 +58,20 @@ print fetcher get_file(fetcher, "ftp://ftp.debian.org/debian/dists/README", "/tmp/lala") -pm.GetArchives(fetcher, list, recs) +pm.get_archives(fetcher, list, recs) -for item in fetcher.Items: +for item in fetcher.items: print item - if item.Status == item.StatError: - print "Some error ocured: '%s'" % item.ErrorText - if item.Complete == False: - print "No error, still nothing downloaded (%s)" % item.ErrorText + if item.status == item.STAT_ERROR: + print "Some error ocured: '%s'" % item.error_text + if item.complete == False: + print "No error, still nothing downloaded (%s)" % item.error_text print -res = fetcher.Run() +res = fetcher.run() print "fetcher.Run() returned: %s" % res print "now runing pm.DoInstall()" -res = pm.DoInstall(1) +res = pm.do_install(1) print "pm.DoInstall() returned: %s"% res diff --git a/doc/examples/action.py b/doc/examples/action.py index 512945df..0399bddc 100644 --- a/doc/examples/action.py +++ b/doc/examples/action.py @@ -3,19 +3,19 @@ import apt_pkg import sys -from apt.progress import OpTextProgress +from apt.progress.text import OpProgress from progress import TextFetchProgress # init apt_pkg.init() -progress = OpTextProgress() +progress = OpProgress() cache = apt_pkg.Cache(progress) -print "Available packages: %s " % cache.PackageCount +print "Available packages: %s " % cache.package_count print "Fetching" progress = TextFetchProgress() -cache.Update(progress) +cache.update(progress) print "Exiting" sys.exit(0) @@ -26,85 +26,85 @@ print "example package iter: %s" % iter # get depcache print "\n\n depcache" depcache = apt_pkg.DepCache(cache, progress) -depcache.ReadPinFile() +depcache.read_pin_file() print "got a depcache: %s " % depcache -print "Marked for install: %s " % depcache.InstCount +print "Marked for install: %s " % depcache.inst_count print "\n\n Reinit" -depcache.Init(progress) +depcache.init(progress) #sys.exit() # get a canidate version -ver= depcache.GetCandidateVer(iter) +ver= depcache.get_candidate_ver(iter) print "Candidate version: %s " % ver print "\n\nQuerry interface" -print "%s.IsUpgradable(): %s" % (iter.Name, depcache.IsUpgradable(iter)) +print "%s.is_upgradable(): %s" % (iter.name, depcache.is_upgradable(iter)) print "\nMarking interface" -print "Marking '%s' for install" % iter.Name -depcache.MarkInstall(iter) -print "Install count: %s " % depcache.InstCount -print "%s.MarkedInstall(): %s" % (iter.Name, depcache.MarkedInstall(iter)) -print "%s.MarkedUpgrade(): %s" % (iter.Name, depcache.MarkedUpgrade(iter)) -print "%s.MarkedDelete(): %s" % (iter.Name, depcache.MarkedDelete(iter)) - -print "Marking %s for delete" % iter.Name -depcache.MarkDelete(iter) -print "DelCount: %s " % depcache.DelCount -print "%s.MarkedDelete(): %s" % (iter.Name, depcache.MarkedDelete(iter)) +print "Marking '%s' for install" % iter.name +depcache.mark_install(iter) +print "Install count: %s " % depcache.inst_count +print "%s.marked_install(): %s" % (iter.name, depcache.marked_install(iter)) +print "%s.marked_upgrade(): %s" % (iter.name, depcache.marked_upgrade(iter)) +print "%s.marked_delete(): %s" % (iter.name, depcache.marked_delete(iter)) + +print "Marking %s for delete" % iter.name +depcache.mark_delete(iter) +print "del_count: %s " % depcache.del_count +print "%s.marked_delete(): %s" % (iter.name, depcache.marked_delete(iter)) iter = cache["3dchess"] -print "\nMarking '%s' for install" % iter.Name -depcache.MarkInstall(iter) -print "Install count: %s " % depcache.InstCount -print "%s.MarkedInstall(): %s" % (iter.Name, depcache.MarkedInstall(iter)) -print "%s.MarkedUpgrade(): %s" % (iter.Name, depcache.MarkedUpgrade(iter)) -print "%s.MarkedDelete(): %s" % (iter.Name, depcache.MarkedDelete(iter)) +print "\nMarking '%s' for install" % iter.name +depcache.mark_install(iter) +print "Install count: %s " % depcache.inst_count +print "%s.marked_install(): %s" % (iter.name, depcache.marked_install(iter)) +print "%s.marked_upgrade(): %s" % (iter.name, depcache.marked_upgrade(iter)) +print "%s.marked_delete(): %s" % (iter.name, depcache.marked_delete(iter)) -print "Marking %s for keep" % iter.Name -depcache.MarkKeep(iter) -print "Install: %s " % depcache.InstCount +print "Marking %s for keep" % iter.name +depcache.mark_keep(iter) +print "Install: %s " % depcache.inst_count iter = cache["3dwm-server"] -print "\nMarking '%s' for install" % iter.Name -depcache.MarkInstall(iter) -print "Install: %s " % depcache.InstCount -print "Broken count: %s" % depcache.BrokenCount -print "FixBroken() " -depcache.FixBroken() -print "Broken count: %s" % depcache.BrokenCount - -print "\nPerforming Upgrade" -depcache.Upgrade() -print "Keep: %s " % depcache.KeepCount -print "Install: %s " % depcache.InstCount -print "Delete: %s " % depcache.DelCount -print "UsrSize: %s " % apt_pkg.SizeToStr(depcache.UsrSize) -print "DebSize: %s " % apt_pkg.SizeToStr(depcache.DebSize) - -for pkg in cache.Packages: - if pkg.CurrentVer is not None and not depcache.MarkedInstall(pkg) \ - and depcache.IsUpgradable(pkg): - print "Upgrade didn't upgrade (kept): %s" % pkg.Name - -print "\nPerforming DistUpgrade" -depcache.Upgrade(True) -print "Keep: %s " % depcache.KeepCount -print "Install: %s " % depcache.InstCount -print "Delete: %s " % depcache.DelCount -print "UsrSize: %s " % apt_pkg.SizeToStr(depcache.UsrSize) -print "DebSize: %s " % apt_pkg.SizeToStr(depcache.DebSize) +print "\nMarking '%s' for install" % iter.name +depcache.mark_install(iter) +print "Install: %s " % depcache.inst_count +print "Broken count: %s" % depcache.broken_count +print "fix_broken() " +depcache.fix_broken() +print "Broken count: %s" % depcache.broken_count + +print "\nPerforming upgrade" +depcache.upgrade() +print "Keep: %s " % depcache.keep_count +print "Install: %s " % depcache.inst_count +print "Delete: %s " % depcache.del_count +print "usr_size: %s " % apt_pkg.size_to_str(depcache.usr_size) +print "deb_size: %s " % apt_pkg.size_to_str(depcache.deb_size) + +for pkg in cache.packages: + if pkg.current_ver is not None and not depcache.marked_install(pkg) \ + and depcache.is_upgradable(pkg): + print "upgrade didn't upgrade (kept): %s" % pkg.name + +print "\nPerforming Distupgrade" +depcache.upgrade(True) +print "Keep: %s " % depcache.keep_count +print "Install: %s " % depcache.inst_count +print "Delete: %s " % depcache.del_count +print "usr_size: %s " % apt_pkg.size_to_str(depcache.usr_size) +print "deb_size: %s " % apt_pkg.size_to_str(depcache.deb_size) # overview about what would happen -for pkg in cache.Packages: - if depcache.MarkedInstall(pkg): - if pkg.CurrentVer is not None: - print "Marked upgrade: %s " % pkg.Name +for pkg in cache.packages: + if depcache.marked_install(pkg): + if pkg.current_ver is not None: + print "Marked upgrade: %s " % pkg.name else: - print "Marked install: %s" % pkg.Name - elif depcache.MarkedDelete(pkg): - print "Marked delete: %s" % pkg.Name - elif depcache.MarkedKeep(pkg): - print "Marked keep: %s" % pkg.Name + print "Marked install: %s" % pkg.name + elif depcache.marked_delete(pkg): + print "Marked delete: %s" % pkg.name + elif depcache.marked_keep(pkg): + print "Marked keep: %s" % pkg.name diff --git a/doc/examples/all_deps.py b/doc/examples/all_deps.py index 992e98d8..179501f4 100644 --- a/doc/examples/all_deps.py +++ b/doc/examples/all_deps.py @@ -6,19 +6,19 @@ import apt def dependencies(cache, pkg, deps, key="Depends"): #print "pkg: %s (%s)" % (pkg.name, deps) - candver = cache._depcache.GetCandidateVer(pkg._pkg) + candver = cache._depcache.get_candidate_ver(pkg._pkg) if candver is None: return deps - dependslist = candver.DependsList + dependslist = candver.depends_list if key in dependslist: for depVerList in dependslist[key]: for dep in depVerList: - if dep.TargetPkg.Name in cache: - if pkg.name != dep.TargetPkg.Name and \ - not dep.TargetPkg.Name in deps: - deps.add(dep.TargetPkg.Name) + if dep.target_pkg.name in cache: + if pkg.name != dep.target_pkg.name and \ + not dep.target_pkg.name in deps: + deps.add(dep.target_pkg.name) dependencies( - cache, cache[dep.TargetPkg.Name], deps, key) + cache, cache[dep.target_pkg.name], deps, key) return deps diff --git a/doc/examples/build-deps-old.py b/doc/examples/build-deps-old.py index 656f1361..924c6191 100755 --- a/doc/examples/build-deps-old.py +++ b/doc/examples/build-deps-old.py @@ -7,15 +7,15 @@ import sys def get_source_pkg(pkg, records, depcache): """ get the source package name of a given package """ - version = depcache.GetCandidateVer(pkg) + version = depcache.get_candidate_ver(pkg) if not version: return None - file, index = version.FileList.pop(0) - records.Lookup((file, index)) - if records.SourcePkg != "": - srcpkg = records.SourcePkg + file, index = version.file_list.pop(0) + records.lookup((file, index)) + if records.source_pkg != "": + srcpkg = records.source_pkg else: - srcpkg = pkg.Name + srcpkg = pkg.name return srcpkg @@ -23,7 +23,7 @@ def get_source_pkg(pkg, records, depcache): apt_pkg.init() cache = apt_pkg.Cache() depcache = apt_pkg.DepCache(cache) -depcache.Init() +depcache.init() records = apt_pkg.PackageRecords(cache) srcrecords = apt_pkg.SourceRecords() @@ -42,29 +42,29 @@ all_build_depends = set() srcpkg_name = get_source_pkg(base, records, depcache) print "srcpkg_name: %s " % srcpkg_name if not srcpkg_name: - print "Can't find source package for '%s'" % pkg.Name -srcrec = srcrecords.Lookup(srcpkg_name) + print "Can't find source package for '%s'" % pkg.mame +srcrec = srcrecords.lookup(srcpkg_name) if srcrec: print "Files:" - print srcrecords.Files - bd = srcrecords.BuildDepends + print srcrecords.files + bd = srcrecords.build_depends print "build-depends of the package: %s " % bd for b in bd: all_build_depends.add(b[0]) # calculate the build depends for all dependencies -depends = depcache.GetCandidateVer(base).DependsList +depends = depcache.get_candidate_ver(base).depends_list for dep in depends["Depends"]: # FIXME: do we need to consider PreDepends? - pkg = dep[0].TargetPkg + pkg = dep[0].target_pkg srcpkg_name = get_source_pkg(pkg, records, depcache) if not srcpkg_name: - print "Can't find source package for '%s'" % pkg.Name + print "Can't find source package for '%s'" % pkg.name continue - srcrec = srcrecords.Lookup(srcpkg_name) + srcrec = srcrecords.lookup(srcpkg_name) if srcrec: #print srcrecords.Package #print srcrecords.Binaries - bd = srcrecords.BuildDepends + bd = srcrecords.build_depends #print "%s: %s " % (srcpkg_name, bd) for b in bd: all_build_depends.add(b[0]) diff --git a/doc/examples/build-deps.py b/doc/examples/build-deps.py index 5d243943..a189cdfa 100755 --- a/doc/examples/build-deps.py +++ b/doc/examples/build-deps.py @@ -24,12 +24,12 @@ all_build_depends = set() srcpkg_name = base.candidate.source_name print "srcpkg_name: %s " % srcpkg_name if not srcpkg_name: - print "Can't find source package for '%s'" % pkg.Name -srcrec = srcrecords.Lookup(srcpkg_name) + print "Can't find source package for '%s'" % pkg.name +srcrec = srcrecords.lookup(srcpkg_name) if srcrec: print "Files:" - print srcrecords.Files - bd = srcrecords.BuildDepends + print srcrecords.files + bd = srcrecords.build_depends print "build-depends of the package: %s " % bd for b in bd: all_build_depends.add(b[0]) @@ -41,13 +41,13 @@ for or_dep in depends: pkg = cache[dep.name] srcpkg_name = pkg.candidate.source_name if not srcpkg_name: - print "Can't find source package for '%s'" % pkg.Name + print "Can't find source package for '%s'" % pkg.name continue - srcrec = srcrecords.Lookup(srcpkg_name) + srcrec = srcrecords.lookup(srcpkg_name) if srcrec: #print srcrecords.Package #print srcrecords.Binaries - bd = srcrecords.BuildDepends + bd = srcrecords.build_depends #print "%s: %s " % (srcpkg_name, bd) for b in bd: all_build_depends.add(b[0]) diff --git a/doc/examples/cdrom.py b/doc/examples/cdrom.py index 78f2a8af..2fbc8f34 100644 --- a/doc/examples/cdrom.py +++ b/doc/examples/cdrom.py @@ -15,11 +15,11 @@ print cdrom progress = TextCdromProgress() -(res, ident) = cdrom.Ident(progress) +(res, ident) = cdrom.ident(progress) print "ident result is: %s (%s) " % (res, ident) -apt_pkg.Config.Set("APT::CDROM::Rename", "True") -cdrom.Add(progress) +apt_pkg.config["APT::CDROM::Rename"] = "True" +cdrom.add(progress) print "Exiting" sys.exit(0) diff --git a/doc/examples/checkstate.py b/doc/examples/checkstate.py index 41040b6c..7f046c5d 100755 --- a/doc/examples/checkstate.py +++ b/doc/examples/checkstate.py @@ -9,27 +9,27 @@ import apt_pkg apt_pkg.init() cache = apt_pkg.Cache() -packages = cache.Packages +packages = cache.packages uninstalled, updated, upgradable = {}, {}, {} for package in packages: - versions = package.VersionList + versions = package.version_list if not versions: continue version = versions[0] for other_version in versions: - if apt_pkg.VersionCompare(version.VerStr, other_version.VerStr)<0: + if apt_pkg.version_compare(version.ver_str, other_version.ver_str)<0: version = other_version - if package.CurrentVer: - current = package.CurrentVer - if apt_pkg.VersionCompare(current.VerStr, version.VerStr)<0: - upgradable[package.Name] = version + if package.current_ver: + current = package.current_ver + if apt_pkg.version_compare(current.ver_str, version.ver_str)<0: + upgradable[package.name] = version break else: - updated[package.Name] = current + updated[package.name] = current else: - uninstalled[package.Name] = version + uninstalled[package.name] = version for l in (uninstalled, updated, upgradable): diff --git a/doc/examples/config.py b/doc/examples/config.py index 0dff4cac..c364fe16 100755 --- a/doc/examples/config.py +++ b/doc/examples/config.py @@ -26,9 +26,9 @@ Cnf = apt_pkg.Configuration() print "Command line is", sys.argv # Load the default configuration file, InitConfig() does this better.. -Cnf.Set("config-file", "/etc/apt/apt.conf") # or Cnf["config-file"] = ".." -if posixpath.exists(Cnf.FindFile("config-file")): - apt_pkg.ReadConfigFile(Cnf, "/etc/apt/apt.conf") +Cnf.set("config-file", "/etc/apt/apt.conf") # or Cnf["config-file"] = ".." +if posixpath.exists(Cnf.find_file("config-file")): + apt_pkg.read_config_file(Cnf, "/etc/apt/apt.conf") # Merge the command line arguments into the configuration space Arguments = [('h', "help", "help"), @@ -36,17 +36,17 @@ Arguments = [('h', "help", "help"), ('q', "quiet", "quiet", "IntLevel"), ('c', "config-file", "", "ConfigFile"), ('o', "option", "", "ArbItem")] -print "FileNames", apt_pkg.ParseCommandLine(Cnf, Arguments, sys.argv) +print "FileNames", apt_pkg.parse_commandline(Cnf, Arguments, sys.argv) -print "Quiet level selected is", Cnf.FindI("quiet", 0) +print "Quiet level selected is", Cnf.find_i("quiet", 0) # Do some stuff with it -if Cnf.FindB("version", 0) == 1: +if Cnf.find_b("version", 0) == 1: print "Version selected - 1.1" -if Cnf.FindB("help", 0) == 1: - print "python-apt", apt_pkg.Version, \ - "compiled on", apt_pkg.Date, apt_pkg.Time +if Cnf.find_b("help", 0) == 1: + print "python-apt", apt_pkg.VERSION, \ + "compiled on", apt_pkg.DATE, apt_pkg.TIME print "Hi, I am the help text for this program" sys.exit(0) diff --git a/doc/examples/configisc.py b/doc/examples/configisc.py index fe3d161b..fea5893e 100755 --- a/doc/examples/configisc.py +++ b/doc/examples/configisc.py @@ -11,14 +11,14 @@ import apt_pkg import sys -ConfigFile = apt_pkg.ParseCommandLine(apt_pkg.Config, [], sys.argv) +ConfigFile = apt_pkg.parse_commandLine(apt_pkg.config, [], sys.argv) if len(ConfigFile) != 1: print "Must have exactly 1 file name" sys.exit(0) Cnf = apt_pkg.Configuration() -apt_pkg.ReadConfigFileISC(Cnf, ConfigFile[0]) +apt_pkg.read_config_file_isc(Cnf, ConfigFile[0]) # Print the configuration space #print "The Configuration space looks like:" @@ -26,18 +26,18 @@ apt_pkg.ReadConfigFileISC(Cnf, ConfigFile[0]) # print "%s \"%s\";" % (I, Cnf[I]) # bind8 config file.. -if Cnf.Exists("Zone"): - print "Zones: ", Cnf.SubTree("zone").List() - for I in Cnf.List("zone"): - SubCnf = Cnf.SubTree(I) - if SubCnf.Find("type") == "slave": +if "Zone" in Cnf: + print "Zones: ", Cnf.sub_tree("zone").list() + for I in Cnf.list("zone"): + SubCnf = Cnf.sub_tree(I) + if SubCnf.find("type") == "slave": print "Masters for %s: %s" % ( - SubCnf.MyTag(), SubCnf.ValueList("masters")) + SubCnf.my_tag(), SubCnf.value_list("masters")) else: print "Tree definitions:" - for I in Cnf.List("tree"): - SubCnf = Cnf.SubTree(I) + for I in Cnf.list("tree"): + SubCnf = Cnf.sub_tree(I) # This could use Find which would eliminate the possibility of # exceptions. print "Subtree %s with sections '%s' and architectures '%s'" % ( - SubCnf.MyTag(), SubCnf["Sections"], SubCnf["Architectures"]) + SubCnf.my_tag(), SubCnf["Sections"], SubCnf["Architectures"]) diff --git a/doc/examples/deb_inspect.py b/doc/examples/deb_inspect.py index 54c52b7b..3261c734 100755 --- a/doc/examples/deb_inspect.py +++ b/doc/examples/deb_inspect.py @@ -7,10 +7,10 @@ import sys import os.path -def Callback(What, Name, Link, Mode, UID, GID, Size, MTime, Major, Minor): +def Callback(member, data): """ callback for debExtract """ - print "%s '%s','%s',%u,%u,%u,%u,%u,%u,%u" \ - % (What, Name, Link, Mode, UID, GID, Size, MTime, Major, Minor) + print "'%s','%s',%u,%u,%u,%u,%u,%u,%u" \ + % (member.name, member.linkname, member.mode, member.uid, member.gid, member.size, member.mtime, member.major, member.minor) if __name__ == "__main__": @@ -21,10 +21,10 @@ if __name__ == "__main__": print "Working on: %s" % file print "Displaying data.tar.gz:" - apt_inst.debExtract(open(file), Callback, "data.tar.gz") + apt_inst.DebFile(open(file)).data.go(Callback) print "Now extracting the control file:" - control = apt_inst.debExtractControl(open(file)) + control = apt_inst.DebFile(open(file)).control.extractdata("control") sections = apt_pkg.TagSection(control) print "Maintainer is: " @@ -33,13 +33,13 @@ if __name__ == "__main__": print print "DependsOn: " depends = sections["Depends"] - print apt_pkg.ParseDepends(depends) + print apt_pkg.parse_depends(depends) print "extracting archive" dir = "/tmp/deb" os.mkdir(dir) - apt_inst.debExtractArchive(open(file), dir) + apt_inst.DebFile(open(file)).data.extractall(dir) def visit(arg, dirname, names): print "%s/" % dirname -- cgit v1.2.3 From 8a67219266605b39a522aee08bf7cd3b0b6c3a8c Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Mon, 21 Oct 2013 20:20:22 +0200 Subject: aptsources: Correctly parse multiple options (LP: #1103200) It's still not optimal and we do not support the arch+ and arch- options, but it's a beginning. --- aptsources/sourceslist.py | 23 ++++++++++++++++++----- debian/changelog | 1 + tests/data/aptsources/sources.list | 1 + tests/test_aptsources.py | 21 +++++++++++++++++++-- 4 files changed, 39 insertions(+), 7 deletions(-) diff --git a/aptsources/sourceslist.py b/aptsources/sourceslist.py index 43729246..69e7e107 100644 --- a/aptsources/sourceslist.py +++ b/aptsources/sourceslist.py @@ -91,6 +91,7 @@ class SourceEntry(object): self.disabled = False # is it disabled ('#' in front) self.type = "" # what type (deb, deb-src) self.architectures = [] # architectures + self.trusted = None # Trusted self.uri = "" # base-uri self.dist = "" # distribution (dapper, edgy, etc) self.comps = [] # list of available componetns @@ -123,9 +124,15 @@ class SourceEntry(object): p_found = False space_found = False for i in range(len(line)): - if line[i] == "[" and not space_found: - p_found=True - tmp += line[i] + if line[i] == "[": + if space_found: + space_found = False + p_found = True + pieces.append(tmp) + tmp = line[i] + else: + p_found=True + tmp += line[i] elif line[i] == "]": p_found=False tmp += line[i] @@ -181,7 +188,7 @@ class SourceEntry(object): return if pieces[1].strip()[0] == "[": - options = pieces.pop(1).strip("[]").split(";") + options = pieces.pop(1).strip("[]").split() for option in options: try: key, value = option.split("=", 1) @@ -190,6 +197,8 @@ class SourceEntry(object): else: if key == "arch": self.architectures = value.split(",") + elif key == "trusted": + self.trusted = apt_pkg.string_to_bool(value) else: self.invalid = True @@ -231,7 +240,11 @@ class SourceEntry(object): line += self.type - if self.architectures: + if self.architectures and self.trusted is not None: + line += " [arch=%s trusted=%s]" % (",".join(self.architectures), "yes" if self.trusted else "no") + elif self.trusted is not None: + line += " [trusted=%s]" % ("yes" if self.trusted else "no") + elif self.architectures: line += " [arch=%s]" % ",".join(self.architectures) line += " %s %s" % (self.uri, self.dist) if len(self.comps) > 0: diff --git a/debian/changelog b/debian/changelog index f1e40039..51f2b8b7 100644 --- a/debian/changelog +++ b/debian/changelog @@ -11,6 +11,7 @@ python-apt (0.9.0) UNRELEASED; urgency=low * Accept bytes object for file names (Closes: #680971) * aptsources/sourceslist.py - Document correct use of uniq and hide it using __all__ (Closes: #723815) + - Correctly parse multiple options (LP: #1103200) * python/apt_pkgmodule.cc: - Fix documentation of version_compare (Closes: #680891) * python/cache.cc: diff --git a/tests/data/aptsources/sources.list b/tests/data/aptsources/sources.list index 376d6961..8ca68075 100644 --- a/tests/data/aptsources/sources.list +++ b/tests/data/aptsources/sources.list @@ -7,3 +7,4 @@ deb http://de.archive.ubuntu.com/ubuntu/ edgy universe # multi-arch deb [arch=amd64,i386] http://de.archive.ubuntu.com/ubuntu/ natty main +deb [arch=amd64,i386 trusted=yes] http://de.archive.ubuntu.com/ubuntu/ natty main diff --git a/tests/test_aptsources.py b/tests/test_aptsources.py index 75dd91c1..5a174f3b 100644 --- a/tests/test_aptsources.py +++ b/tests/test_aptsources.py @@ -40,11 +40,11 @@ class TestAptSources(unittest.TestCase): apt_pkg.config.set("Dir::Etc::sourcelist", "data/aptsources/" "sources.list") sources = aptsources.sourceslist.SourcesList(True, self.templates) - self.assertEqual(len(sources.list), 9) + self.assertEqual(len(sources.list), 10) # test load sources.list = [] sources.load("data/aptsources/sources.list") - self.assertEqual(len(sources.list), 9) + self.assertEqual(len(sources.list), 10) def testSourcesListAdding(self): """aptsources: Test additions to sources.list""" @@ -159,6 +159,23 @@ class TestAptSources(unittest.TestCase): assert sources.list[8].dist == "natty" assert sources.list[8].comps == ["main"] assert sources.list[8].line.strip() == str(sources.list[8]) + assert sources.list[8].trusted is None + + def testMultipleOptions(self): + """aptsources: Test multi-arch parsing""" + + apt_pkg.config.set("Dir::Etc::sourcelist", "data/aptsources/" + "sources.list") + sources = aptsources.sourceslist.SourcesList(True, self.templates) + + assert sources.list[9].invalid == False + assert sources.list[9].type == "deb" + assert sources.list[9].architectures == ["amd64", "i386"] + self.assertEqual( sources.list[9].uri, "http://de.archive.ubuntu.com/ubuntu/") + assert sources.list[9].dist == "natty" + assert sources.list[9].comps == ["main"] + assert sources.list[9].trusted + assert sources.list[9].line.strip() == str(sources.list[9]) def test_enable_component(self): from subprocess import Popen, PIPE -- cgit v1.2.3 From 9b2e18e4d1b95ef505f87561ac06aba50ada3609 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Mon, 21 Oct 2013 20:39:09 +0200 Subject: doc/examples/*.py: Update examples to the new API Closes: #639022 --- debian/changelog | 2 + doc/examples/acquire.py | 6 +- doc/examples/build-deps-old.py | 4 +- doc/examples/build-deps.py | 4 +- doc/examples/config.py | 4 +- doc/examples/configisc.py | 2 +- doc/examples/depcache.py | 122 ++++++++++++++++++++--------------------- doc/examples/dependant-pkgs.py | 12 ++-- doc/examples/desc.py | 12 ++-- doc/examples/gui-inst.py | 6 +- doc/examples/indexfile.py | 18 +++--- doc/examples/inst.py | 6 +- doc/examples/metaindex.py | 10 ++-- doc/examples/print_uris.py | 12 ++-- doc/examples/progress.py | 69 ++++++++++------------- doc/examples/recommends.py | 12 ++-- doc/examples/sources.py | 12 ++-- doc/examples/tagfile.py | 6 +- doc/examples/update.py | 4 +- doc/examples/versiontest.py | 18 +++--- 20 files changed, 167 insertions(+), 174 deletions(-) diff --git a/debian/changelog b/debian/changelog index 51f2b8b7..f9233c3a 100644 --- a/debian/changelog +++ b/debian/changelog @@ -28,6 +28,8 @@ python-apt (0.9.0) UNRELEASED; urgency=low Closes: #717859. Closes: #717861. * doc/source/examples/dpkg-info.py: - Use apt_inst.DebFile (Closes: #671784) + * doc/examples/*.py: + - Update examples to the new API (Closes: #639022) [ Jeremy Bicha ] * data/templates/Ubuntu.info.in: add 'devel' series (Closes: #722961) diff --git a/doc/examples/acquire.py b/doc/examples/acquire.py index ec6f6576..c2db8327 100644 --- a/doc/examples/acquire.py +++ b/doc/examples/acquire.py @@ -16,9 +16,9 @@ def get_file(fetcher, uri, destfile): apt_pkg.init() -#apt_pkg.Config.Set("Debug::pkgDPkgPM","1"); -#apt_pkg.Config.Set("Debug::pkgPackageManager","1"); -#apt_pkg.Config.Set("Debug::pkgDPkgProgressReporting","1"); +#apt_pkg.config.set("Debug::pkgDPkgPM","1"); +#apt_pkg.config.set("Debug::pkgPackageManager","1"); +#apt_pkg.config.set("Debug::pkgDPkgProgressReporting","1"); cache = apt_pkg.Cache() depcache = apt_pkg.DepCache(cache) diff --git a/doc/examples/build-deps-old.py b/doc/examples/build-deps-old.py index 924c6191..cc41aa64 100755 --- a/doc/examples/build-deps-old.py +++ b/doc/examples/build-deps-old.py @@ -62,8 +62,8 @@ for dep in depends["Depends"]: # FIXME: do we need to consider PreDepends? continue srcrec = srcrecords.lookup(srcpkg_name) if srcrec: - #print srcrecords.Package - #print srcrecords.Binaries + #print srcrecords.package + #print srcrecords.binaries bd = srcrecords.build_depends #print "%s: %s " % (srcpkg_name, bd) for b in bd: diff --git a/doc/examples/build-deps.py b/doc/examples/build-deps.py index a189cdfa..e618e414 100755 --- a/doc/examples/build-deps.py +++ b/doc/examples/build-deps.py @@ -45,8 +45,8 @@ for or_dep in depends: continue srcrec = srcrecords.lookup(srcpkg_name) if srcrec: - #print srcrecords.Package - #print srcrecords.Binaries + #print srcrecords.package + #print srcrecords.binaries bd = srcrecords.build_depends #print "%s: %s " % (srcpkg_name, bd) for b in bd: diff --git a/doc/examples/config.py b/doc/examples/config.py index c364fe16..c3330a5b 100755 --- a/doc/examples/config.py +++ b/doc/examples/config.py @@ -18,14 +18,14 @@ import sys import posixpath # Create a new empty Configuration object - there is also the system global -# configuration object apt_pkg.Config which is used interally by apt-pkg +# configuration object apt_pkg.config which is used interally by apt-pkg # routines to control unusual situations. I recommend using the sytem global # whenever possible.. Cnf = apt_pkg.Configuration() print "Command line is", sys.argv -# Load the default configuration file, InitConfig() does this better.. +# Load the default configuration file, init_config() does this better.. Cnf.set("config-file", "/etc/apt/apt.conf") # or Cnf["config-file"] = ".." if posixpath.exists(Cnf.find_file("config-file")): apt_pkg.read_config_file(Cnf, "/etc/apt/apt.conf") diff --git a/doc/examples/configisc.py b/doc/examples/configisc.py index fea5893e..d9355d49 100755 --- a/doc/examples/configisc.py +++ b/doc/examples/configisc.py @@ -11,7 +11,7 @@ import apt_pkg import sys -ConfigFile = apt_pkg.parse_commandLine(apt_pkg.config, [], sys.argv) +ConfigFile = apt_pkg.parse_commandline(apt_pkg.config, [], sys.argv) if len(ConfigFile) != 1: print "Must have exactly 1 file name" diff --git a/doc/examples/depcache.py b/doc/examples/depcache.py index 858e45a4..919de603 100644 --- a/doc/examples/depcache.py +++ b/doc/examples/depcache.py @@ -10,7 +10,7 @@ apt_pkg.init() progress = TextProgress() cache = apt_pkg.Cache(progress) -print "Available packages: %s " % cache.PackageCount +print "Available packages: %s " % cache.package_count iter = cache["base-config"] print "example package iter: %s" % iter @@ -18,90 +18,90 @@ print "example package iter: %s" % iter # get depcache print "\n\n depcache" depcache = apt_pkg.DepCache(cache) -depcache.ReadPinFile() +depcache.read_pinfile() # init is needed after the creation/pin file reading -depcache.Init(progress) +depcache.init(progress) print "got a depcache: %s " % depcache -print "Marked for install: %s " % depcache.InstCount +print "Marked for install: %s " % depcache.inst_count print "\n\n Reinit" -depcache.Init(progress) +depcache.init(progress) #sys.exit() # get a canidate version -ver= depcache.GetCandidateVer(iter) +ver= depcache.get_candidate_ver(iter) print "Candidate version: %s " % ver print "\n\nQuerry interface" -print "%s.IsUpgradable(): %s" % (iter.Name, depcache.IsUpgradable(iter)) +print "%s.is_upgradable(): %s" % (iter.name, depcache.is_upgradable(iter)) print "\nMarking interface" -print "Marking '%s' for install" % iter.Name -depcache.MarkInstall(iter) -print "Install count: %s " % depcache.InstCount -print "%s.MarkedInstall(): %s" % (iter.Name, depcache.MarkedInstall(iter)) -print "%s.MarkedUpgrade(): %s" % (iter.Name, depcache.MarkedUpgrade(iter)) -print "%s.MarkedDelete(): %s" % (iter.Name, depcache.MarkedDelete(iter)) +print "Marking '%s' for install" % iter.name +depcache.mark_install(iter) +print "Install count: %s " % depcache.inst_count +print "%s.marked_install(): %s" % (iter.name, depcache.marked_install(iter)) +print "%s.marked_upgrade(): %s" % (iter.name, depcache.marked_upgrade(iter)) +print "%s.marked_delete(): %s" % (iter.name, depcache.marked_delete(iter)) -print "Marking %s for delete" % iter.Name -depcache.MarkDelete(iter) -print "DelCount: %s " % depcache.DelCount -print "%s.MarkedDelete(): %s" % (iter.Name, depcache.MarkedDelete(iter)) +print "Marking %s for delete" % iter.name +depcache.mark_delete(iter) +print "del_count: %s " % depcache.del_count +print "%s.marked_delete(): %s" % (iter.name, depcache.marked_delete(iter)) iter = cache["3dchess"] -print "\nMarking '%s' for install" % iter.Name -depcache.MarkInstall(iter) -print "Install count: %s " % depcache.InstCount -print "%s.MarkedInstall(): %s" % (iter.Name, depcache.MarkedInstall(iter)) -print "%s.MarkedUpgrade(): %s" % (iter.Name, depcache.MarkedUpgrade(iter)) -print "%s.MarkedDelete(): %s" % (iter.Name, depcache.MarkedDelete(iter)) +print "\nMarking '%s' for install" % iter.name +depcache.mark_install(iter) +print "Install count: %s " % depcache.inst_count +print "%s.marked_install(): %s" % (iter.name, depcache.marked_install(iter)) +print "%s.marked_upgrade(): %s" % (iter.name, depcache.marked_upgrade(iter)) +print "%s.marked_delete(): %s" % (iter.name, depcache.marked_delete(iter)) -print "Marking %s for keep" % iter.Name -depcache.MarkKeep(iter) -print "Install: %s " % depcache.InstCount +print "Marking %s for keep" % iter.name +depcache.mark_keep(iter) +print "Install: %s " % depcache.inst_count iter = cache["synaptic"] -print "\nMarking '%s' for install" % iter.Name -depcache.MarkInstall(iter) -print "Install: %s " % depcache.InstCount -print "Broken count: %s" % depcache.BrokenCount -print "FixBroken() " -depcache.FixBroken() -print "Broken count: %s" % depcache.BrokenCount - -print "\nPerforming Upgrade" -depcache.Upgrade() -print "Keep: %s " % depcache.KeepCount -print "Install: %s " % depcache.InstCount -print "Delete: %s " % depcache.DelCount -print "UsrSize: %s " % apt_pkg.SizeToStr(depcache.UsrSize) -print "DebSize: %s " % apt_pkg.SizeToStr(depcache.DebSize) - -for pkg in cache.Packages: - if pkg.CurrentVer is not None and not depcache.MarkedInstall(pkg) \ - and depcache.IsUpgradable(pkg): - print "Upgrade didn't upgrade (kept): %s" % pkg.Name +print "\nMarking '%s' for install" % iter.name +depcache.mark_install(iter) +print "Install: %s " % depcache.inst_count +print "Broken count: %s" % depcache.broken_count +print "fix_broken() " +depcache.fix_broken() +print "Broken count: %s" % depcache.broken_count + +print "\nPerforming upgrade" +depcache.upgrade() +print "Keep: %s " % depcache.keep_count +print "Install: %s " % depcache.inst_count +print "Delete: %s " % depcache.del_count +print "usr_size: %s " % apt_pkg.size_to_str(depcache.usr_size) +print "deb_size: %s " % apt_pkg.size_to_str(depcache.deb_size) + +for pkg in cache.packages: + if pkg.current_ver is not None and not depcache.marked_install(pkg) \ + and depcache.is_upgradable(pkg): + print "upgrade didn't upgrade (kept): %s" % pkg.name print "\nPerforming DistUpgrade" -depcache.Upgrade(True) -print "Keep: %s " % depcache.KeepCount -print "Install: %s " % depcache.InstCount -print "Delete: %s " % depcache.DelCount -print "UsrSize: %s " % apt_pkg.SizeToStr(depcache.UsrSize) -print "DebSize: %s " % apt_pkg.SizeToStr(depcache.DebSize) +depcache.upgrade(True) +print "Keep: %s " % depcache.keep_count +print "Install: %s " % depcache.inst_count +print "Delete: %s " % depcache.del_count +print "usr_size: %s " % apt_pkg.size_to_str(depcache.usr_size) +print "deb_size: %s " % apt_pkg.size_to_str(depcache.deb_size) # overview about what would happen -for pkg in cache.Packages: - if depcache.MarkedInstall(pkg): - if pkg.CurrentVer is not None: - print "Marked upgrade: %s " % pkg.Name +for pkg in cache.packages: + if depcache.marked_install(pkg): + if pkg.current_ver is not None: + print "Marked upgrade: %s " % pkg.name else: - print "Marked install: %s" % pkg.Name - elif depcache.MarkedDelete(pkg): - print "Marked delete: %s" % pkg.Name - elif depcache.MarkedKeep(pkg): - print "Marked keep: %s" % pkg.Name + print "Marked install: %s" % pkg.name + elif depcache.marked_delete(pkg): + print "Marked delete: %s" % pkg.name + elif depcache.marked_keep(pkg): + print "Marked keep: %s" % pkg.name diff --git a/doc/examples/dependant-pkgs.py b/doc/examples/dependant-pkgs.py index 5fbbc76d..a02547ac 100755 --- a/doc/examples/dependant-pkgs.py +++ b/doc/examples/dependant-pkgs.py @@ -6,27 +6,27 @@ import sys pkgs = set() cache = apt.Cache() for pkg in cache: - candver = cache._depcache.GetCandidateVer(pkg._pkg) + candver = cache._depcache.get_candidate_ver(pkg._pkg) if candver is None: continue - dependslist = candver.DependsList + dependslist = candver.depends_list for dep in dependslist.keys(): # get the list of each dependency object for depVerList in dependslist[dep]: for z in depVerList: # get all TargetVersions of # the dependency object - for tpkg in z.AllTargets(): - if sys.argv[1] == tpkg.ParentPkg.Name: + for tpkg in z.all_targets(): + if sys.argv[1] == tpkg.parent_pkg.name: pkgs.add(pkg.name) main = set() universe = set() for pkg in pkgs: if "universe" in cache[pkg].section: - universe.add(cache[pkg].sourcePackageName) + universe.add(cache[pkg].source_name) else: - main.add(cache[pkg].sourcePackageName) + main.add(cache[pkg].source_name) print "main:" print "\n".join(main) diff --git a/doc/examples/desc.py b/doc/examples/desc.py index d50aa0ce..797459aa 100644 --- a/doc/examples/desc.py +++ b/doc/examples/desc.py @@ -4,22 +4,22 @@ import apt_pkg apt_pkg.init() -apt_pkg.Config.Set("APT::Acquire::Translation", "de") +apt_pkg.config.set("APT::Acquire::Translation", "de") cache = apt_pkg.Cache() depcache = apt_pkg.DepCache(cache) pkg = cache["gcc"] -cand = depcache.GetCandidateVer(pkg) +cand = depcache.get_candidate_ver(pkg) print cand desc = cand.TranslatedDescription print desc -print desc.FileList -(f, index) = desc.FileList.pop(0) +print desc.file_list +(f, index) = desc.file_list.pop(0) records = apt_pkg.PackageRecords(cache) -records.Lookup((f, index)) -desc = records.LongDesc +records.lookup((f, index)) +desc = records.long_desc print len(desc) print desc diff --git a/doc/examples/gui-inst.py b/doc/examples/gui-inst.py index 68f06fc0..654f3794 100755 --- a/doc/examples/gui-inst.py +++ b/doc/examples/gui-inst.py @@ -18,10 +18,10 @@ if __name__ == "__main__": win.show() cache = apt.cache.Cache(progress.open) - if cache["2vcard"].isInstalled: - cache["2vcard"].markDelete() + if cache["2vcard"].is_installed: + cache["2vcard"].mark_delete() else: - cache["2vcard"].markInstall() + cache["2vcard"].mark_install() progress.show_terminal(expanded=True) cache.commit(progress.fetch, progress.install) gtk.main() diff --git a/doc/examples/indexfile.py b/doc/examples/indexfile.py index cc5070aa..a9282bf5 100644 --- a/doc/examples/indexfile.py +++ b/doc/examples/indexfile.py @@ -5,18 +5,18 @@ import apt_pkg apt_pkg.init() sources = apt_pkg.SourceList() -sources.ReadMainList() +sources.read_main_list() cache = apt_pkg.Cache() depcache = apt_pkg.DepCache(cache) pkg = cache["libimlib2"] -cand = depcache.GetCandidateVer(pkg) -for (f, i) in cand.FileList: - index = sources.FindIndex(f) +cand = depcache.get_candidate_ver(pkg) +for (f, i) in cand.file_list: + index = sources.find_index(f) print index if index: - print index.Size - print index.IsTrusted - print index.Exists - print index.HasPackages - print index.ArchiveURI("some/path") + print index.size + print index.is_trusted + print index.exists + print index.Haspackages + print index.archive_uri("some/path") diff --git a/doc/examples/inst.py b/doc/examples/inst.py index 5a7fc993..dd39c25b 100644 --- a/doc/examples/inst.py +++ b/doc/examples/inst.py @@ -36,12 +36,12 @@ iprogress = TextInstallProgress() pkg = cache["3dchess"] # install or remove, the importend thing is to keep us busy :) -if pkg.isInstalled: +if pkg.is_installed: print "Going to delete %s" % pkg.name - pkg.markDelete() + pkg.mark_delete() else: print "Going to install %s" % pkg.name - pkg.markInstall() + pkg.mark_install() res = cache.commit(fprogress, iprogress) print res diff --git a/doc/examples/metaindex.py b/doc/examples/metaindex.py index bbb4ac47..a04a83dd 100644 --- a/doc/examples/metaindex.py +++ b/doc/examples/metaindex.py @@ -5,12 +5,12 @@ import apt_pkg apt_pkg.init() sources = apt_pkg.SourceList() -sources.ReadMainList() +sources.read_main_list() -for metaindex in sources.List: +for metaindex in sources.list: print metaindex - print "URI: ", metaindex.URI - print "Dist: ", metaindex.Dist - print "IndexFiles: ", "\n".join([str(i) for i in metaindex.IndexFiles]) + print "uri: ", metaindex.uri + print "dist: ", metaindex.dist + print "index_files: ", "\n".join([str(i) for i in metaindex.index_files]) print diff --git a/doc/examples/print_uris.py b/doc/examples/print_uris.py index c64a4b54..06043e4a 100755 --- a/doc/examples/print_uris.py +++ b/doc/examples/print_uris.py @@ -8,15 +8,15 @@ import apt_pkg cache = apt.Cache() -upgradable = filter(lambda p: p.isUpgradable, cache) +upgradable = filter(lambda p: p.is_upgradable, cache) for pkg in upgradable: pkg._lookupRecord(True) - path = apt_pkg.TagSection(pkg._records.Record)["Filename"] - cand = pkg._depcache.GetCandidateVer(pkg._pkg) - for (packagefile, i) in cand.FileList: - indexfile = cache._list.FindIndex(packagefile) + path = apt_pkg.TagSection(pkg._records.record)["Filename"] + cand = pkg._depcache.get_candidate_ver(pkg._pkg) + for (packagefile, i) in cand.file_list: + indexfile = cache._list.find_index(packagefile) if indexfile: - uri = indexfile.ArchiveURI(path) + uri = indexfile.archive_uri(path) print uri diff --git a/doc/examples/progress.py b/doc/examples/progress.py index c007681f..77985a51 100644 --- a/doc/examples/progress.py +++ b/doc/examples/progress.py @@ -3,10 +3,12 @@ import sys import time +import apt_pkg import apt +import apt.progress.base -class TextProgress(apt.OpProgress): +class TextProgress(apt.progress.base.OpProgress): def __init__(self): self.last=0.0 @@ -23,7 +25,7 @@ class TextProgress(apt.OpProgress): print "\rDone " -class TextFetchProgress(apt.FetchProgress): +class TextFetchProgress(apt.progress.base.AcquireProgress): def __init__(self): pass @@ -34,60 +36,49 @@ class TextFetchProgress(apt.FetchProgress): def stop(self): pass - def updateStatus(self, uri, descr, shortDescr, status): - print "UpdateStatus: '%s' '%s' '%s' '%i' " % ( - uri, descr, shortDescr, status) + def fail(self, item): + print 'fail', item - def update_status_full(self, uri, descr, shortDescr, status, fileSize, - partialSize): - print "update_status_full: '%s' '%s' '%s' '%i' '%d/%d'" % ( - uri, descr, shortDescr, status, partialSize, fileSize) + def fetch(self, item): + print 'fetch', item - def pulse(self): - print "Pulse: CPS: %s/s; Bytes: %s/%s; Item: %s/%s" % ( - apt.SizeToStr(self.currentCPS), apt.SizeToStr(self.currentBytes), - apt.SizeToStr(self.totalBytes), self.currentItems, self.totalItems) - return True + def ims_hit(self, item): + print 'ims_hit', item - def pulse_items(self, items): - print "Pulse: CPS: %s/s; Bytes: %s/%s; Item: %s/%s" % ( - apt.SizeToStr(self.currentCPS), apt.SizeToStr(self.currentBytes), - apt.SizeToStr(self.totalBytes), self.currentItems, self.totalItems) - print "Pulse-Items: " - for itm in items: - uri, descr, shortDescr, fileSize, partialSize = itm - print " - '%s' '%s' '%s' '%d/%d'" % ( - uri, descr, shortDescr, partialSize, fileSize) + def pulse(self, owner): + print "pulse: CPS: %s/s; Bytes: %s/%s; Item: %s/%s" % ( + apt_pkg.size_to_str(self.current_cps), apt_pkg.size_to_str(self.current_bytes), + apt_pkg.size_to_str(self.total_bytes), self.current_items, self.total_items) return True - def mediaChange(self, medium, drive): + def media_change(self, medium, drive): print "Please insert medium %s in drive %s" % (medium, drive) sys.stdin.readline() #return False -class TextInstallProgress(apt.InstallProgress): +class TextInstallProgress(apt.progress.base.InstallProgress): def __init__(self): - apt.InstallProgress.__init__(self) + apt.progress.base.InstallProgress.__init__(self) pass - def startUpdate(self): - print "StartUpdate" + def start_update(self): + print "start_update" - def finishUpdate(self): - print "FinishUpdate" + def finish_update(self): + print "finish_update" - def statusChange(self, pkg, percent, status): + def status_change(self, pkg, percent, status): print "[%s] %s: %s" % (percent, pkg, status) - def updateInterface(self): - apt.InstallProgress.updateInterface(self) + def update_interface(self): + apt.progress.base.InstallProgress.update_interface(self) # usefull to e.g. redraw a GUI time.sleep(0.1) -class TextCdromProgress(apt.CdromProgress): +class TextCdromProgress(apt.progress.base.CdromProgress): def __init__(self): pass @@ -99,12 +90,12 @@ class TextCdromProgress(apt.CdromProgress): if text != "": print "Update: %s %s" % (text.strip(), step) - def askCdromName(self): + def ask_cdrom_name(self): print "Please enter cd-name: ", cd_name = sys.stdin.readline() return (True, cd_name.strip()) - def changeCdrom(self): + def change_cdrom(self): print "Please insert cdrom and press " answer = sys.stdin.readline() return True @@ -113,10 +104,10 @@ class TextCdromProgress(apt.CdromProgress): if __name__ == "__main__": c = apt.Cache() pkg = c["3dchess"] - if pkg.isInstalled: - pkg.markDelete() + if pkg.is_installed: + pkg.mark_delete() else: - pkg.markInstall() + pkg.mark_install() res = c.commit(TextFetchProgress(), TextInstallProgress()) diff --git a/doc/examples/recommends.py b/doc/examples/recommends.py index 0ecd5882..01727820 100755 --- a/doc/examples/recommends.py +++ b/doc/examples/recommends.py @@ -16,21 +16,21 @@ class Wanted: wanted = {} -for package in cache.Packages: - current = package.CurrentVer +for package in cache.packages: + current = package.current_ver if not current: continue - depends = current.DependsList + depends = current.depends_list for (key, attr) in (('Suggests', 'suggested'), ('Recommends', 'recommended')): list = depends.get(key, []) for dependency in list: - name = dependency[0].TargetPkg.Name + name = dependency[0].target_pkg.name dep = cache[name] - if dep.CurrentVer: + if dep.current_ver: continue getattr(wanted.setdefault(name, Wanted(name)), - attr).append(package.Name) + attr).append(package.name) ks = wanted.keys() ks.sort() diff --git a/doc/examples/sources.py b/doc/examples/sources.py index bc08ad69..238ca48c 100644 --- a/doc/examples/sources.py +++ b/doc/examples/sources.py @@ -8,9 +8,9 @@ apt_pkg.init() #sources = apt_pkg.SourceRecords(cache) sources = apt_pkg.SourceRecords() -sources.Restart() -while sources.Lookup('hello'): - print sources.Package, sources.Version, sources.Maintainer, \ - sources.Section, `sources.Binaries` - print sources.Files - print sources.Index.ArchiveURI(sources.Files[0][2]) +sources.restart() +while sources.lookup('hello'): + print sources.package, sources.version, sources.maintainer, \ + sources.section, `sources.binaries` + print sources.files + print sources.index.archive_uri(sources.files[0][2]) diff --git a/doc/examples/tagfile.py b/doc/examples/tagfile.py index 770e40de..d8984cad 100755 --- a/doc/examples/tagfile.py +++ b/doc/examples/tagfile.py @@ -3,6 +3,6 @@ import apt_pkg Parse = apt_pkg.TagFile(open("/var/lib/dpkg/status", "r")) -while Parse.Step() == 1: - print Parse.Section.get("Package") - print apt_pkg.ParseDepends(Parse.Section.get("Depends", "")) +while Parse.step() == 1: + print Parse.section.get("Package") + print apt_pkg.parse_depends(Parse.section.get("Depends", "")) diff --git a/doc/examples/update.py b/doc/examples/update.py index 5929c9f8..3ff80fde 100755 --- a/doc/examples/update.py +++ b/doc/examples/update.py @@ -4,9 +4,9 @@ import apt_pkg import os.path if __name__ == "__main__": - apt_pkg.Config.Set("APT::Update::Pre-Invoke::", + apt_pkg.config.set("APT::Update::Pre-Invoke::", "touch /tmp/update-about-to-run") - apt_pkg.Config.Set("APT::Update::Post-Invoke::", + apt_pkg.config.set("APT::Update::Post-Invoke::", "touch /tmp/update-was-run") c = apt.Cache() res = c.update(apt.progress.TextFetchProgress()) diff --git a/doc/examples/versiontest.py b/doc/examples/versiontest.py index fa13cc1c..2f736161 100755 --- a/doc/examples/versiontest.py +++ b/doc/examples/versiontest.py @@ -5,19 +5,19 @@ import apt_pkg import sys import re -apt_pkg.InitConfig() -apt_pkg.InitSystem() +apt_pkg.init_config() +apt_pkg.init_system() -TestFile = apt_pkg.ParseCommandLine(apt_pkg.Config, [], sys.argv) +TestFile = apt_pkg.parse_commandline(apt_pkg.config, [], sys.argv) if len(TestFile) != 1: print "Must have exactly 1 file name" sys.exit(0) # Go over the file.. -List = open(TestFile[0], "r") +list = open(TestFile[0], "r") CurLine = 0 while(1): - Line = List.readline() + Line = list.readline() CurLine = CurLine + 1 if Line == "": break @@ -28,12 +28,12 @@ while(1): Split = re.split("[ \n]", Line) # Check forward - if apt_pkg.VersionCompare(Split[0], Split[1]) != int(Split[2]): + if apt_pkg.version_compare(Split[0], Split[1]) != int(Split[2]): print "Comparision failed on line %u. '%s' ? '%s' %i != %i" % (CurLine, - Split[0], Split[1], apt_pkg.VersionCompare(Split[0], Split[1]), + Split[0], Split[1], apt_pkg.version_compare(Split[0], Split[1]), int(Split[2])) # Check reverse - if apt_pkg.VersionCompare(Split[1], Split[0]) != -1 * int(Split[2]): + if apt_pkg.version_compare(Split[1], Split[0]) != -1 * int(Split[2]): print "Comparision failed on line %u. '%s' ? '%s' %i != %i" % (CurLine, - Split[1], Split[0], apt_pkg.VersionCompare(Split[1], Split[0]), + Split[1], Split[0], apt_pkg.version_compare(Split[1], Split[0]), -1 * int(Split[2])) -- cgit v1.2.3 From 247bdb9c62efb2f7d68c71a18e84addda3aec7bc Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Mon, 21 Oct 2013 20:43:18 +0200 Subject: tests/old/*.py: Update to new API as well --- debian/changelog | 2 ++ tests/old/apt-test.py | 18 ++++++------- tests/old/cache.py | 32 +++++++++++------------ tests/old/depcache.py | 46 ++++++++++++++++---------------- tests/old/lock.py | 12 ++++----- tests/old/memleak.py | 8 +++--- tests/old/pkgproblemresolver.py | 58 ++++++++++++++++++++--------------------- tests/old/pkgrecords.py | 22 ++++++++-------- tests/old/pkgsrcrecords.py | 10 +++---- tests/old/refcount.py | 6 ++--- tests/old/test_debextract.py | 4 +-- tests/old/test_enhances.py | 4 +-- 12 files changed, 112 insertions(+), 110 deletions(-) diff --git a/debian/changelog b/debian/changelog index f9233c3a..5bbaa6e8 100644 --- a/debian/changelog +++ b/debian/changelog @@ -30,6 +30,8 @@ python-apt (0.9.0) UNRELEASED; urgency=low - Use apt_inst.DebFile (Closes: #671784) * doc/examples/*.py: - Update examples to the new API (Closes: #639022) + * tests/old/*.py: + - Update to new API as well [ Jeremy Bicha ] * data/templates/Ubuntu.info.in: add 'devel' series (Closes: #722961) diff --git a/tests/old/apt-test.py b/tests/old/apt-test.py index fac2ff43..423fb03a 100644 --- a/tests/old/apt-test.py +++ b/tests/old/apt-test.py @@ -8,19 +8,19 @@ if __name__ == "__main__": cache = apt.Cache(progress) print cache for pkg in cache: - if pkg.isUpgradable: - pkg.markInstall() - for pkg in cache.getChanges(): - #print pkg.Name() + if pkg.is_upgradable: + pkg.mark_install() + for pkg in cache.get_changes(): + #print pkg.name() pass - print "Broken: %s " % cache._depcache.BrokenCount - print "InstCount: %s " % cache._depcache.InstCount + print "Broken: %s " % cache._depcache.broken_count + print "inst_count: %s " % cache._depcache.inst_count # get a new cache cache = apt.Cache(progress) for name in cache.keys(): import random if random.randint(0, 1) == 1: - cache[name].markDelete() - print "Broken: %s " % cache._depcache.BrokenCount - print "DelCount: %s " % cache._depcache.DelCount + cache[name].mark_delete() + print "Broken: %s " % cache._depcache.broken_count + print "del_count: %s " % cache._depcache.del_count diff --git a/tests/old/cache.py b/tests/old/cache.py index f0bf6761..11156c00 100644 --- a/tests/old/cache.py +++ b/tests/old/cache.py @@ -11,22 +11,22 @@ def main(): apt_pkg.init() cache = apt_pkg.Cache() depcache = apt_pkg.DepCache(cache) - depcache.Init() + depcache.init() i=0 - all=cache.PackageCount + all=cache.package_count print "Running Cache test on all packages:" # first, get all pkgs - for pkg in cache.Packages: + for pkg in cache.packages: i += 1 - x = pkg.Name + x = pkg.name # then get each version - for ver in pkg.VersionList: + for ver in pkg.version_list: # get some version information - a = ver.FileList - b = ver.VerStr - c = ver.Arch - d = ver.DependsListStr - dl = ver.DependsList + a = ver.file_list + b = ver.ver_str + c = ver.arch + d = ver.depends_listStr + dl = ver.depends_list # get all dependencies (a dict of string->list, # e.g. "depends:" -> [ver1,ver2,..] for dep in dl.keys(): @@ -35,12 +35,12 @@ def main(): for z in depVerList: # get all TargetVersions of # the dependency object - for j in z.AllTargets(): - f = j.FileList - g = ver.VerStr - h = ver.Arch - k = ver.DependsListStr - j = ver.DependsList + for j in z.all_targets(): + f = j.file_list + g = ver.ver_str + h = ver.arch + k = ver.depends_listStr + j = ver.depends_list pass print "\r%i/%i=%.3f%% " % (i, all, (float(i) / float(all) * 100)), diff --git a/tests/old/depcache.py b/tests/old/depcache.py index 0d59648e..cc030ed0 100644 --- a/tests/old/depcache.py +++ b/tests/old/depcache.py @@ -11,42 +11,42 @@ def main(): apt_pkg.init() cache = apt_pkg.Cache() depcache = apt_pkg.DepCache(cache) - depcache.Init() + depcache.init() i=0 - all=cache.PackageCount + all=cache.package_count print "Running DepCache test on all packages" print "(trying to install each and then mark it keep again):" # first, get all pkgs - for pkg in cache.Packages: + for pkg in cache.packages: i += 1 - x = pkg.Name + x = pkg.name # then get each version - ver =depcache.GetCandidateVer(pkg) + ver =depcache.get_candidate_ver(pkg) if ver is not None: - depcache.MarkInstall(pkg) - if depcache.InstCount == 0: - if depcache.IsUpgradable(pkg): + depcache.mark_install(pkg) + if depcache.inst_count == 0: + if depcache.is_upgradable(pkg): print "Error marking %s for install" % x - for p in cache.Packages: - if depcache.MarkedInstall(p): - depcache.MarkKeep(p) - if depcache.InstCount != 0: - print "Error undoing the selection for %s (InstCount: %s)" % ( - x, depcache.InstCount) + for p in cache.packages: + if depcache.marked_install(p): + depcache.mark_keep(p) + if depcache.inst_count != 0: + print "Error undoing the selection for %s (inst_count: %s)" % ( + x, depcache.inst_count) print "\r%i/%i=%.3f%% " % (i, all, (float(i) / float(all) * 100)), print - print "Trying Upgrade:" - depcache.Upgrade() - print "To install: %s " % depcache.InstCount - print "To remove: %s " % depcache.DelCount - print "Kept back: %s " % depcache.KeepCount + print "Trying upgrade:" + depcache.upgrade() + print "To install: %s " % depcache.inst_count + print "To remove: %s " % depcache.del_count + print "Kept back: %s " % depcache.keep_count print "Trying DistUpgrade:" - depcache.Upgrade(True) - print "To install: %s " % depcache.InstCount - print "To remove: %s " % depcache.DelCount - print "Kept back: %s " % depcache.KeepCount + depcache.upgrade(True) + print "To install: %s " % depcache.inst_count + print "To remove: %s " % depcache.del_count + print "Kept back: %s " % depcache.keep_count if __name__ == "__main__": diff --git a/tests/old/lock.py b/tests/old/lock.py index f19d3e43..71812918 100644 --- a/tests/old/lock.py +++ b/tests/old/lock.py @@ -14,27 +14,27 @@ if __name__ == "__main__": apt_pkg.init() # system-lock - apt_pkg.PkgSystemLock() + apt_pkg.pkgsystem_lock() pid = os.fork() if pid == 0: try: - apt_pkg.PkgSystemLock() + apt_pkg.pkgsystem_lock() except SystemError as s: print "Can't get lock: (error text:\n%s)" % s sys.exit(0) - apt_pkg.PkgSystemUnLock() + apt_pkg.pkgsystem_unlock() # low-level lock - fd = apt_pkg.GetLock(lock, True) + fd = apt_pkg.get_lock(lock, True) print "Lockfile fd: %s" % fd # try to get lock without error flag pid = os.fork() if pid == 0: # child - fd = apt_pkg.GetLock(lock, False) + fd = apt_pkg.get_lock(lock, False) print "Lockfile fd (child): %s" % fd sys.exit(0) @@ -42,6 +42,6 @@ if __name__ == "__main__": pid = os.fork() if pid == 0: # child - fd = apt_pkg.GetLock(lock, True) + fd = apt_pkg.get_lock(lock, True) print "Lockfile fd (child): %s" % fd sys.exit(0) diff --git a/tests/old/memleak.py b/tests/old/memleak.py index 5299f35f..1b7ec5d8 100644 --- a/tests/old/memleak.py +++ b/tests/old/memleak.py @@ -33,11 +33,11 @@ for i in range(100): depcache = apt_pkg.DepCache(cache) records = apt_pkg.PackageRecords(cache) list = apt_pkg.SourceList() - list.ReadMainList() + list.read_main_list() dict = {} - for pkg in cache.Packages: - if len(pkg.VersionList) > 0: - dict[pkg.Name] = apt.Package(cache, depcache, + for pkg in cache.packages: + if len(pkg.version_list) > 0: + dict[pkg.name] = apt.package(cache, depcache, records, list, None, pkg) print cache["apt"] diff --git a/tests/old/pkgproblemresolver.py b/tests/old/pkgproblemresolver.py index 0d6d0611..7714c882 100644 --- a/tests/old/pkgproblemresolver.py +++ b/tests/old/pkgproblemresolver.py @@ -11,58 +11,58 @@ def main(): apt_pkg.init() cache = apt_pkg.Cache() depcache = apt_pkg.DepCache(cache) - depcache.Init() + depcache.init() i=0 - all=cache.PackageCount + all=cache.package_count print "Running DepCache test on all packages" print "(trying to install each and then mark it keep again):" # first, get all pkgs - for pkg in cache.Packages: + for pkg in cache.packages: i += 1 - x = pkg.Name + x = pkg.name # then get each version - ver =depcache.GetCandidateVer(pkg) + ver =depcache.get_candidate_ver(pkg) if ver is not None: - depcache.MarkInstall(pkg) - if depcache.BrokenCount > 0: + depcache.mark_install(pkg) + if depcache.broken_count > 0: fixer = apt_pkg.ProblemResolver(depcache) - fixer.Clear(pkg) - fixer.Protect(pkg) + fixer.clear(pkg) + fixer.protect(pkg) # we first try to resolve the problem # with the package that should be installed # protected try: - fixer.Resolve(True) + fixer.resolve(True) except SystemError: # the pkg seems to be broken, the # returns a exception - fixer.Clear(pkg) - fixer.Resolve(True) - if not depcache.MarkedInstall(pkg): - print "broken in archive: %s " % pkg.Name + fixer.clear(pkg) + fixer.resolve(True) + if not depcache.marked_install(pkg): + print "broken in archive: %s " % pkg.name fixer = None - if depcache.InstCount == 0: - if depcache.IsUpgradable(pkg): + if depcache.inst_count == 0: + if depcache.is_upgradable(pkg): print "Error marking %s for install" % x - for p in cache.Packages: - if depcache.MarkedInstall(p) or depcache.MarkedUpgrade(p): - depcache.MarkKeep(p) - if depcache.InstCount != 0: + for p in cache.packages: + if depcache.marked_install(p) or depcache.marked_upgrade(p): + depcache.mark_keep(p) + if depcache.inst_count != 0: print "Error undoing the selection for %s" % x print "\r%i/%i=%.3f%% " % (i, all, (float(i) / float(all) * 100)), print - print "Trying Upgrade:" - depcache.Upgrade() - print "To install: %s " % depcache.InstCount - print "To remove: %s " % depcache.DelCount - print "Kept back: %s " % depcache.KeepCount + print "Trying upgrade:" + depcache.upgrade() + print "To install: %s " % depcache.inst_count + print "To remove: %s " % depcache.del_count + print "Kept back: %s " % depcache.keep_count print "Trying DistUpgrade:" - depcache.Upgrade(True) - print "To install: %s " % depcache.InstCount - print "To remove: %s " % depcache.DelCount - print "Kept back: %s " % depcache.KeepCount + depcache.upgrade(True) + print "To install: %s " % depcache.inst_count + print "To remove: %s " % depcache.del_count + print "Kept back: %s " % depcache.keep_count if __name__ == "__main__": diff --git a/tests/old/pkgrecords.py b/tests/old/pkgrecords.py index 2fe6ad20..9e06d44c 100644 --- a/tests/old/pkgrecords.py +++ b/tests/old/pkgrecords.py @@ -12,27 +12,27 @@ def main(): apt_pkg.init() cache = apt_pkg.Cache() depcache = apt_pkg.DepCache(cache) - depcache.Init() + depcache.init() i=0 print "Running PkgRecords test on all packages:" - for pkg in cache.Packages: + for pkg in cache.packages: i += 1 records = apt_pkg.PackageRecords(cache) - if len(pkg.VersionList) == 0: + if len(pkg.version_list) == 0: #print "no available version, cruft" continue - version = depcache.GetCandidateVer(pkg) + version = depcache.get_candidate_ver(pkg) if not version: continue - file, index = version.FileList.pop(0) - if records.Lookup((file, index)): - #print records.FileName - x = records.FileName - y = records.LongDesc + file, index = version.file_list.pop(0) + if records.lookup((file, index)): + #print records.filename + x = records.filename + y = records.long_desc pass print "\r%i/%i=%.3f%% " % ( - i, cache.PackageCount, - (float(i) / float(cache.PackageCount) * 100)), + i, cache.package_count, + (float(i) / float(cache.package_count) * 100)), if __name__ == "__main__": diff --git a/tests/old/pkgsrcrecords.py b/tests/old/pkgsrcrecords.py index 2ea9dd3a..36790eff 100644 --- a/tests/old/pkgsrcrecords.py +++ b/tests/old/pkgsrcrecords.py @@ -13,15 +13,15 @@ def main(): cache = apt_pkg.Cache() i=0 print "Running PkgSrcRecords test on all packages:" - for x in cache.Packages: + for x in cache.packages: i += 1 src = apt_pkg.SourceRecords() - if src.Lookup(x.Name): - #print src.Package + if src.lookup(x.name): + #print src.package pass print "\r%i/%i=%.3f%% " % ( - i, cache.PackageCount, - (float(i) / float(cache.PackageCount) * 100)), + i, cache.package_count, + (float(i) / float(cache.package_count) * 100)), if __name__ == "__main__": diff --git a/tests/old/refcount.py b/tests/old/refcount.py index a29744ae..a80595c9 100755 --- a/tests/old/refcount.py +++ b/tests/old/refcount.py @@ -41,13 +41,13 @@ print "refcount after second cache.update(): ", sys.gettotalrefcount() # test install() c.open(apt.progress.OpProgress()) gc.collect() -print "refcount before cache['hello'].markInstall(): ", sys.gettotalrefcount() -c["hello"].markInstall() +print "refcount before cache['hello'].mark_install(): ", sys.gettotalrefcount() +c["hello"].mark_install() c.commit(apt.progress.FetchProgress(), apt.progress.InstallProgress()) gc.collect() print "refcount after: ", sys.gettotalrefcount() c.open(apt.progress.OpProgress()) -c["hello"].markDelete() +c["hello"].mark_delete() c.commit(apt.progress.FetchProgress(), apt.progress.InstallProgress()) gc.collect() print "refcount after: ", sys.gettotalrefcount() diff --git a/tests/old/test_debextract.py b/tests/old/test_debextract.py index 4ba498ae..b80d4b1e 100755 --- a/tests/old/test_debextract.py +++ b/tests/old/test_debextract.py @@ -4,9 +4,9 @@ import sys import apt_inst -def Callback(What, Name, Link, Mode, UID, GID, Size, MTime, Major, Minor): +def Callback(What, name, Link, Mode, UID, GID, size, MTime, Major, Minor): print "%s '%s','%s',%u,%u,%u,%u,%u,%u,%u" % ( - What, Name, Link, Mode, UID, GID, Size, MTime, Major, Minor) + What, name, Link, Mode, UID, GID, size, MTime, Major, Minor) def main(): diff --git a/tests/old/test_enhances.py b/tests/old/test_enhances.py index 3eced9f9..74614674 100644 --- a/tests/old/test_enhances.py +++ b/tests/old/test_enhances.py @@ -10,8 +10,8 @@ for pkg in cache: for or_list in pkg.installed.enhances: for enhances in or_list.or_dependencies: s += " %s" % enhances.name - if (cache.has_key(enhances.name) and - not cache[enhances.name].isInstalled): + if (enhances.name in cache and + not cache[enhances.name].is_installed): s += "(*missing*) " s += "," print s[:-1] -- cgit v1.2.3 From 736a440e8a1292dff825abd4843ee7a29e7f192a Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Mon, 21 Oct 2013 20:46:42 +0200 Subject: data/templates/Ubuntu.info.in: Add "Trusty Thar" A copy from saucy, with name and numbers adjusted --- data/templates/Ubuntu.info.in | 119 ++++++++++++++++++++++++++++++++++++++++++ debian/changelog | 2 + 2 files changed, 121 insertions(+) diff --git a/data/templates/Ubuntu.info.in b/data/templates/Ubuntu.info.in index 314ba053..a6e94eb0 100644 --- a/data/templates/Ubuntu.info.in +++ b/data/templates/Ubuntu.info.in @@ -107,6 +107,125 @@ MatchURI: archive.ubuntu.com/ubuntu|ports.ubuntu.com/ubuntu-ports _Description: Unsupported updates +Suite: trusty +RepositoryType: deb +BaseURI: http://ports.ubuntu.com/ubuntu-ports/ +MatchURI: ports.ubuntu.com/ubuntu-ports +BaseURI-amd64: http://archive.ubuntu.com/ubuntu +MatchURI-amd64: archive.ubuntu.com/ubuntu +BaseURI-i386: http://archive.ubuntu.com/ubuntu +MatchURI-i386: archive.ubuntu.com/ubuntu +MirrorsFile-amd64: Ubuntu.mirrors +MirrorsFile-i386: Ubuntu.mirrors +_Description: Ubuntu 14.04 'Trusty Thar' +Component: main +_CompDescription: Officially supported +_CompDescriptionLong: Canonical-supported free and open-source software +Component: universe +_CompDescription: Community-maintained +_CompDescriptionLong: Community-maintained free and open-source software +Component: restricted +_CompDescription: Non-free drivers +_CompDescriptionLong: Proprietary drivers for devices +Component: multiverse +ParentComponent: universe +_CompDescription: Restricted software +_CompDescriptionLong: Software restricted by copyright or legal issues + +Suite: trusty +ParentSuite: trusty +RepositoryType: deb-src +BaseURI: http://archive.ubuntu.com/ubuntu/ +MatchURI: archive.ubuntu.com/ubuntu|ports.ubuntu.com/ubuntu-ports +_Description: Ubuntu 14.04 'Trusty Thar' + +Suite: trusty +RepositoryType: deb +MatchName: .* +BaseURI: cdrom:\[Ubuntu.*14.04 +MatchURI: cdrom:\[Ubuntu.*14.04 +_Description: Cdrom with Ubuntu 14.04 'Trusty Thar' +Available: False +Component: main +_CompDescription: Officially supported +Component: restricted +_CompDescription: Restricted copyright + +Suite: trusty +Official: false +RepositoryType: deb +BaseURI: http://archive.canonical.com +MatchURI: archive.canonical.com +_Description: Canonical Partners +Component: partner +_CompDescription: Software packaged by Canonical for their partners +_CompDescriptionLong: This software is not part of Ubuntu. + +Suite: trusty +Official: false +RepositoryType: deb +BaseURI: http://extras.ubuntu.com +MatchURI: extras.ubuntu.com +_Description: Independent +Component: main +_CompDescription: Provided by third-party software developers +_CompDescriptionLong: Software offered by third party developers. + +Suite: trusty-security +ParentSuite: trusty +RepositoryType: deb +BaseURI: http://ports.ubuntu.com/ubuntu-ports/ +MatchURI: ports.ubuntu.com/ubuntu-ports +BaseURI-amd64: http://security.ubuntu.com/ubuntu/ +MatchURI-amd64: archive.ubuntu.com/ubuntu|security.ubuntu.com +BaseURI-i386: http://security.ubuntu.com/ubuntu/ +MatchURI-i386: archive.ubuntu.com/ubuntu|security.ubuntu.com +_Description: Important security updates + +Suite: trusty-security +ParentSuite: trusty +RepositoryType: deb-src +BaseURI: http://archive.ubuntu.com/ubuntu/ +MatchURI: archive.ubuntu.com/ubuntu|ports.ubuntu.com/ubuntu-ports|security.ubuntu.com +_Description: Important security updates + +Suite: trusty-updates +ParentSuite: trusty +RepositoryType: deb +_Description: Recommended updates + +Suite: trusty-updates +ParentSuite: trusty +RepositoryType: deb-src +BaseURI: http://archive.ubuntu.com/ubuntu/ +MatchURI: archive.ubuntu.com/ubuntu|ports.ubuntu.com/ubuntu-ports +_Description: Recommended updates + +Suite: trusty-proposed +ParentSuite: trusty +RepositoryType: deb +_Description: Pre-released updates + +Suite: trusty-proposed +ParentSuite: trusty +RepositoryType: deb-src +BaseURI: http://archive.ubuntu.com/ubuntu/ +MatchURI: archive.ubuntu.com/ubuntu|ports.ubuntu.com/ubuntu-ports +_Description: Pre-released updates + +Suite: trusty-backports +ParentSuite: trusty +RepositoryType: deb +_Description: Unsupported updates + +Suite: trusty-backports +ParentSuite: trusty +RepositoryType: deb-src +BaseURI: http://archive.ubuntu.com/ubuntu/ +MatchURI: archive.ubuntu.com/ubuntu|ports.ubuntu.com/ubuntu-ports +_Description: Unsupported updates + + Suite: saucy RepositoryType: deb BaseURI: http://ports.ubuntu.com/ubuntu-ports/ diff --git a/debian/changelog b/debian/changelog index 5bbaa6e8..2bf4852d 100644 --- a/debian/changelog +++ b/debian/changelog @@ -32,6 +32,8 @@ python-apt (0.9.0) UNRELEASED; urgency=low - Update examples to the new API (Closes: #639022) * tests/old/*.py: - Update to new API as well + * data/templates/Ubuntu.info.in: + - Add "Trusty Thar" [ Jeremy Bicha ] * data/templates/Ubuntu.info.in: add 'devel' series (Closes: #722961) -- cgit v1.2.3 From 4d535a8144544f63d8f9888cb92347ce7ac35c76 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Mon, 21 Oct 2013 20:48:23 +0200 Subject: po: Update template --- po/python-apt.pot | 211 ++++++++++++++++++++++++++++++------------------------ 1 file changed, 118 insertions(+), 93 deletions(-) diff --git a/po/python-apt.pot b/po/python-apt.pot index d9cc96c9..f35e7f1b 100644 --- a/po/python-apt.pot +++ b/po/python-apt.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2013-08-05 22:44+0200\n" +"POT-Creation-Date: 2013-10-21 20:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -25,346 +25,371 @@ msgstr "" #. Description #: ../data/templates/Ubuntu.info.in:33 +msgid "Ubuntu development series" +msgstr "" + +#. Description +#: ../data/templates/Ubuntu.info.in:140 +msgid "Ubuntu 14.04 'Trusty Thar'" +msgstr "" + +#. Description +#: ../data/templates/Ubuntu.info.in:147 +msgid "Cdrom with Ubuntu 14.04 'Trusty Thar'" +msgstr "" + +#. Description +#: ../data/templates/Ubuntu.info.in:259 +msgid "Ubuntu 13.10 'Saucy Salamander'" +msgstr "" + +#. Description +#: ../data/templates/Ubuntu.info.in:266 +msgid "Cdrom with Ubuntu 13.10 'Saucy Salamander'" +msgstr "" + +#. Description +#: ../data/templates/Ubuntu.info.in:378 msgid "Ubuntu 13.04 'Raring Ringtail'" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:40 +#: ../data/templates/Ubuntu.info.in:385 msgid "Cdrom with Ubuntu 13.04 'Raring Ringtail'" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:152 +#: ../data/templates/Ubuntu.info.in:497 msgid "Ubuntu 12.10 'Quantal Quetzal'" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:159 +#: ../data/templates/Ubuntu.info.in:504 msgid "Cdrom with Ubuntu 12.10 'Quantal Quetzal'" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:270 +#: ../data/templates/Ubuntu.info.in:615 msgid "Ubuntu 12.04 'Precise Pangolin'" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:277 +#: ../data/templates/Ubuntu.info.in:622 msgid "Cdrom with Ubuntu 12.04 'Precise Pangolin'" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:388 +#: ../data/templates/Ubuntu.info.in:733 msgid "Ubuntu 11.10 'Oneiric Ocelot'" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:395 +#: ../data/templates/Ubuntu.info.in:740 msgid "Cdrom with Ubuntu 11.10 'Oneiric Ocelot'" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:507 +#: ../data/templates/Ubuntu.info.in:852 msgid "Ubuntu 11.04 'Natty Narwhal'" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:514 +#: ../data/templates/Ubuntu.info.in:859 msgid "Cdrom with Ubuntu 11.04 'Natty Narwhal'" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:605 +#: ../data/templates/Ubuntu.info.in:950 msgid "Ubuntu 10.10 'Maverick Meerkat'" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:625 +#: ../data/templates/Ubuntu.info.in:970 msgid "Cdrom with Ubuntu 10.10 'Maverick Meerkat'" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:637 +#: ../data/templates/Ubuntu.info.in:982 msgid "Canonical Partners" msgstr "" #. CompDescription -#: ../data/templates/Ubuntu.info.in:639 +#: ../data/templates/Ubuntu.info.in:984 msgid "Software packaged by Canonical for their partners" msgstr "" #. CompDescriptionLong -#: ../data/templates/Ubuntu.info.in:640 +#: ../data/templates/Ubuntu.info.in:985 msgid "This software is not part of Ubuntu." msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:647 +#: ../data/templates/Ubuntu.info.in:992 msgid "Independent" msgstr "" #. CompDescription -#: ../data/templates/Ubuntu.info.in:649 +#: ../data/templates/Ubuntu.info.in:994 msgid "Provided by third-party software developers" msgstr "" #. CompDescriptionLong -#: ../data/templates/Ubuntu.info.in:650 +#: ../data/templates/Ubuntu.info.in:995 msgid "Software offered by third party developers." msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:688 +#: ../data/templates/Ubuntu.info.in:1033 msgid "Ubuntu 10.04 'Lucid Lynx'" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:708 +#: ../data/templates/Ubuntu.info.in:1053 msgid "Cdrom with Ubuntu 10.04 'Lucid Lynx'" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:751 +#: ../data/templates/Ubuntu.info.in:1096 msgid "Ubuntu 9.10 'Karmic Koala'" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:771 +#: ../data/templates/Ubuntu.info.in:1116 msgid "Cdrom with Ubuntu 9.10 'Karmic Koala'" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:814 +#: ../data/templates/Ubuntu.info.in:1159 msgid "Ubuntu 9.04 'Jaunty Jackalope'" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:833 +#: ../data/templates/Ubuntu.info.in:1178 msgid "Cdrom with Ubuntu 9.04 'Jaunty Jackalope'" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:876 +#: ../data/templates/Ubuntu.info.in:1221 msgid "Ubuntu 8.10 'Intrepid Ibex'" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:896 +#: ../data/templates/Ubuntu.info.in:1241 msgid "Cdrom with Ubuntu 8.10 'Intrepid Ibex'" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:940 +#: ../data/templates/Ubuntu.info.in:1285 msgid "Ubuntu 8.04 'Hardy Heron'" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:960 +#: ../data/templates/Ubuntu.info.in:1305 msgid "Cdrom with Ubuntu 8.04 'Hardy Heron'" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:1005 +#: ../data/templates/Ubuntu.info.in:1350 msgid "Ubuntu 7.10 'Gutsy Gibbon'" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:1024 +#: ../data/templates/Ubuntu.info.in:1369 msgid "Cdrom with Ubuntu 7.10 'Gutsy Gibbon'" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:1069 +#: ../data/templates/Ubuntu.info.in:1414 msgid "Ubuntu 7.04 'Feisty Fawn'" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:1088 +#: ../data/templates/Ubuntu.info.in:1433 msgid "Cdrom with Ubuntu 7.04 'Feisty Fawn'" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:1130 +#: ../data/templates/Ubuntu.info.in:1475 msgid "Ubuntu 6.10 'Edgy Eft'" msgstr "" #. CompDescription -#: ../data/templates/Ubuntu.info.in:1135 +#: ../data/templates/Ubuntu.info.in:1480 msgid "Community-maintained" msgstr "" #. CompDescription -#: ../data/templates/Ubuntu.info.in:1141 +#: ../data/templates/Ubuntu.info.in:1486 msgid "Restricted software" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:1149 +#: ../data/templates/Ubuntu.info.in:1494 msgid "Cdrom with Ubuntu 6.10 'Edgy Eft'" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:1191 +#: ../data/templates/Ubuntu.info.in:1536 msgid "Ubuntu 6.06 LTS 'Dapper Drake'" msgstr "" #. CompDescriptionLong -#: ../data/templates/Ubuntu.info.in:1194 +#: ../data/templates/Ubuntu.info.in:1539 msgid "Canonical-supported free and open-source software" msgstr "" #. CompDescription -#: ../data/templates/Ubuntu.info.in:1196 +#: ../data/templates/Ubuntu.info.in:1541 msgid "Community-maintained (universe)" msgstr "" #. CompDescriptionLong -#: ../data/templates/Ubuntu.info.in:1197 +#: ../data/templates/Ubuntu.info.in:1542 msgid "Community-maintained free and open-source software" msgstr "" #. CompDescription -#: ../data/templates/Ubuntu.info.in:1199 +#: ../data/templates/Ubuntu.info.in:1544 msgid "Non-free drivers" msgstr "" #. CompDescriptionLong -#: ../data/templates/Ubuntu.info.in:1200 +#: ../data/templates/Ubuntu.info.in:1545 msgid "Proprietary drivers for devices" msgstr "" #. CompDescription -#: ../data/templates/Ubuntu.info.in:1202 +#: ../data/templates/Ubuntu.info.in:1547 msgid "Restricted software (Multiverse)" msgstr "" #. CompDescriptionLong -#: ../data/templates/Ubuntu.info.in:1203 +#: ../data/templates/Ubuntu.info.in:1548 msgid "Software restricted by copyright or legal issues" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:1210 +#: ../data/templates/Ubuntu.info.in:1555 msgid "Cdrom with Ubuntu 6.06 LTS 'Dapper Drake'" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:1226 +#: ../data/templates/Ubuntu.info.in:1571 msgid "Important security updates" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:1231 ../data/templates/Debian.info.in:26 +#: ../data/templates/Ubuntu.info.in:1576 ../data/templates/Debian.info.in:26 msgid "Recommended updates" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:1236 +#: ../data/templates/Ubuntu.info.in:1581 msgid "Pre-released updates" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:1241 +#: ../data/templates/Ubuntu.info.in:1586 msgid "Unsupported updates" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:1252 +#: ../data/templates/Ubuntu.info.in:1597 msgid "Ubuntu 5.10 'Breezy Badger'" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:1267 +#: ../data/templates/Ubuntu.info.in:1612 msgid "Cdrom with Ubuntu 5.10 'Breezy Badger'" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:1283 +#: ../data/templates/Ubuntu.info.in:1628 msgid "Ubuntu 5.10 Security Updates" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:1288 +#: ../data/templates/Ubuntu.info.in:1633 msgid "Ubuntu 5.10 Updates" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:1293 +#: ../data/templates/Ubuntu.info.in:1638 msgid "Ubuntu 5.10 Backports" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:1304 +#: ../data/templates/Ubuntu.info.in:1649 msgid "Ubuntu 5.04 'Hoary Hedgehog'" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:1319 +#: ../data/templates/Ubuntu.info.in:1664 msgid "Cdrom with Ubuntu 5.04 'Hoary Hedgehog'" msgstr "" #. CompDescription -#: ../data/templates/Ubuntu.info.in:1322 ../data/templates/Debian.info.in:179 +#: ../data/templates/Ubuntu.info.in:1667 ../data/templates/Debian.info.in:179 msgid "Officially supported" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:1335 +#: ../data/templates/Ubuntu.info.in:1680 msgid "Ubuntu 5.04 Security Updates" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:1340 +#: ../data/templates/Ubuntu.info.in:1685 msgid "Ubuntu 5.04 Updates" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:1345 +#: ../data/templates/Ubuntu.info.in:1690 msgid "Ubuntu 5.04 Backports" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:1351 +#: ../data/templates/Ubuntu.info.in:1696 msgid "Ubuntu 4.10 'Warty Warthog'" msgstr "" #. CompDescription -#: ../data/templates/Ubuntu.info.in:1357 +#: ../data/templates/Ubuntu.info.in:1702 msgid "Community-maintained (Universe)" msgstr "" #. CompDescription -#: ../data/templates/Ubuntu.info.in:1359 +#: ../data/templates/Ubuntu.info.in:1704 msgid "Non-free (Multiverse)" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:1366 +#: ../data/templates/Ubuntu.info.in:1711 msgid "Cdrom with Ubuntu 4.10 'Warty Warthog'" msgstr "" #. CompDescription -#: ../data/templates/Ubuntu.info.in:1369 +#: ../data/templates/Ubuntu.info.in:1714 msgid "No longer officially supported" msgstr "" #. CompDescription -#: ../data/templates/Ubuntu.info.in:1371 +#: ../data/templates/Ubuntu.info.in:1716 msgid "Restricted copyright" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:1378 +#: ../data/templates/Ubuntu.info.in:1723 msgid "Ubuntu 4.10 Security Updates" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:1383 +#: ../data/templates/Ubuntu.info.in:1728 msgid "Ubuntu 4.10 Updates" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:1388 +#: ../data/templates/Ubuntu.info.in:1733 msgid "Ubuntu 4.10 Backports" msgstr "" @@ -452,39 +477,39 @@ msgstr "" msgid "Custom servers" msgstr "" -#: ../apt/progress/gtk2.py:258 ../apt/progress/gtk2.py:314 +#: ../apt/progress/gtk2.py:243 #, python-format msgid "Downloading file %(current)li of %(total)li with %(speed)s/s" msgstr "" -#: ../apt/progress/gtk2.py:264 ../apt/progress/gtk2.py:320 +#: ../apt/progress/gtk2.py:249 #, python-format msgid "Downloading file %(current)li of %(total)li" msgstr "" #. Setup some child widgets -#: ../apt/progress/gtk2.py:340 +#: ../apt/progress/gtk2.py:272 msgid "Details" msgstr "" -#: ../apt/progress/gtk2.py:428 +#: ../apt/progress/gtk2.py:345 msgid "Starting..." msgstr "" -#: ../apt/progress/gtk2.py:434 +#: ../apt/progress/gtk2.py:351 msgid "Complete" msgstr "" -#: ../apt/package.py:361 +#: ../apt/package.py:337 #, python-format msgid "Invalid unicode in description for '%s' (%s). Please report." msgstr "" -#: ../apt/package.py:1093 ../apt/package.py:1199 +#: ../apt/package.py:910 ../apt/package.py:1016 msgid "The list of changes is not available" msgstr "" -#: ../apt/package.py:1205 +#: ../apt/package.py:1022 #, python-format msgid "" "The list of changes is not available yet.\n" @@ -493,7 +518,7 @@ msgid "" "until the changes become available or try again later." msgstr "" -#: ../apt/package.py:1212 +#: ../apt/package.py:1029 msgid "" "Failed to download the list of changes. \n" "Please check your Internet connection." @@ -509,18 +534,18 @@ msgstr "" msgid "List of control files for '%s' could not be read" msgstr "" -#: ../apt/debfile.py:215 +#: ../apt/debfile.py:217 #, python-format msgid "Dependency is not satisfiable: %s\n" msgstr "" -#: ../apt/debfile.py:236 +#: ../apt/debfile.py:238 #, python-format msgid "Conflicts with the installed package '%s'" msgstr "" #. TRANSLATORS: the first '%s' is the package that breaks, the second the dependency that makes it break, the third the relation (e.g. >=) and the latest the version for the releation -#: ../apt/debfile.py:377 +#: ../apt/debfile.py:379 #, python-format msgid "" "Breaks existing package '%(pkgname)s' dependency %(depname)s " @@ -528,59 +553,59 @@ msgid "" msgstr "" #. TRANSLATORS: the first '%s' is the package that conflicts, the second the packagename that it conflicts with (so the name of the deb the user tries to install), the third is the relation (e.g. >=) and the last is the version for the relation -#: ../apt/debfile.py:393 +#: ../apt/debfile.py:395 #, python-format msgid "" "Breaks existing package '%(pkgname)s' conflict: %(targetpkg)s (%(comptype)s " "%(targetver)s)" msgstr "" -#: ../apt/debfile.py:403 +#: ../apt/debfile.py:405 #, python-format msgid "" "Breaks existing package '%(pkgname)s' that conflict: '%(targetpkg)s'. But " "the '%(debfile)s' provides it via: '%(provides)s'" msgstr "" -#: ../apt/debfile.py:451 +#: ../apt/debfile.py:453 msgid "No Architecture field in the package" msgstr "" -#: ../apt/debfile.py:461 +#: ../apt/debfile.py:463 #, python-format msgid "Wrong architecture '%s'" msgstr "" #. the deb is older than the installed -#: ../apt/debfile.py:468 +#: ../apt/debfile.py:470 msgid "A later version is already installed" msgstr "" -#: ../apt/debfile.py:493 +#: ../apt/debfile.py:495 msgid "Failed to satisfy all dependencies (broken cache)" msgstr "" -#: ../apt/debfile.py:523 +#: ../apt/debfile.py:525 #, python-format msgid "Cannot install '%s'" msgstr "" -#: ../apt/debfile.py:597 +#: ../apt/debfile.py:599 msgid "" "Automatically decompressed:\n" "\n" msgstr "" -#: ../apt/debfile.py:603 +#: ../apt/debfile.py:605 msgid "Automatically converted to printable ascii:\n" msgstr "" -#: ../apt/debfile.py:693 +#: ../apt/debfile.py:695 #, python-format msgid "Install Build-Dependencies for source package '%s' that builds %s\n" msgstr "" -#: ../apt/debfile.py:704 +#: ../apt/debfile.py:706 msgid "An essential package would be removed" msgstr "" @@ -631,6 +656,6 @@ msgstr "" msgid "Please insert a Disc in the drive and press enter" msgstr "" -#: ../apt/cache.py:162 +#: ../apt/cache.py:160 msgid "Building data structures" msgstr "" -- cgit v1.2.3 From 577e8cf1c62f86b0f157fce010f78007f63a83ce Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Mon, 21 Oct 2013 20:50:43 +0200 Subject: debian/control: Set Standards-Version to 3.9.4 --- debian/changelog | 2 ++ debian/control | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index 2bf4852d..650ed6da 100644 --- a/debian/changelog +++ b/debian/changelog @@ -34,6 +34,8 @@ python-apt (0.9.0) UNRELEASED; urgency=low - Update to new API as well * data/templates/Ubuntu.info.in: - Add "Trusty Thar" + * debian/control: + - Set Standards-Version to 3.9.4 [ Jeremy Bicha ] * data/templates/Ubuntu.info.in: add 'devel' series (Closes: #722961) diff --git a/debian/control b/debian/control index ea80e940..55837ac5 100644 --- a/debian/control +++ b/debian/control @@ -3,7 +3,7 @@ Section: python Priority: standard Maintainer: APT Development Team Uploaders: Michael Vogt , Julian Andres Klode -Standards-Version: 3.9.3 +Standards-Version: 3.9.4 XS-Python-Version: >= 2.6 X-Python3-Version: >= 3.1 Build-Depends: apt (>= 0.9.6), -- cgit v1.2.3 From 80a7a42c3a516af46a10080d0844a09d23b312b2 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Mon, 21 Oct 2013 20:53:20 +0200 Subject: Release 0.9.0 to unstable --- debian/changelog | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/debian/changelog b/debian/changelog index 650ed6da..84f38c0e 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,4 @@ -python-apt (0.9.0) UNRELEASED; urgency=low +python-apt (0.9.0) unstable; urgency=low [ Michael Vogt ] * some fixes from the "coverity" scan @@ -47,7 +47,7 @@ python-apt (0.9.0) UNRELEASED; urgency=low * apt/package.py: - mark_upgrade misuses FromUser to set auto-installed (Closes: #686726) - -- Michael Vogt Mon, 05 Aug 2013 22:55:02 +0200 + -- Julian Andres Klode Mon, 21 Oct 2013 20:53:17 +0200 python-apt (0.8.9.1) unstable; urgency=low -- cgit v1.2.3 From e363423387f71fd6d6ea68b9b432019b0e91c3a3 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Mon, 21 Oct 2013 23:50:03 +0200 Subject: data/templates/Ubuntu.info.in: It's 'Tahr', not 'Thar' Stupid typo. Did I write this myself, or did I copy it from somewhere? --- data/templates/Ubuntu.info.in | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/data/templates/Ubuntu.info.in b/data/templates/Ubuntu.info.in index a6e94eb0..6a125d51 100644 --- a/data/templates/Ubuntu.info.in +++ b/data/templates/Ubuntu.info.in @@ -117,7 +117,7 @@ BaseURI-i386: http://archive.ubuntu.com/ubuntu MatchURI-i386: archive.ubuntu.com/ubuntu MirrorsFile-amd64: Ubuntu.mirrors MirrorsFile-i386: Ubuntu.mirrors -_Description: Ubuntu 14.04 'Trusty Thar' +_Description: Ubuntu 14.04 'Trusty Tahr' Component: main _CompDescription: Officially supported _CompDescriptionLong: Canonical-supported free and open-source software @@ -137,14 +137,14 @@ ParentSuite: trusty RepositoryType: deb-src BaseURI: http://archive.ubuntu.com/ubuntu/ MatchURI: archive.ubuntu.com/ubuntu|ports.ubuntu.com/ubuntu-ports -_Description: Ubuntu 14.04 'Trusty Thar' +_Description: Ubuntu 14.04 'Trusty Tahr' Suite: trusty RepositoryType: deb MatchName: .* BaseURI: cdrom:\[Ubuntu.*14.04 MatchURI: cdrom:\[Ubuntu.*14.04 -_Description: Cdrom with Ubuntu 14.04 'Trusty Thar' +_Description: Cdrom with Ubuntu 14.04 'Trusty Tahr' Available: False Component: main _CompDescription: Officially supported -- cgit v1.2.3 From 56c2b62ef3a90aa01d7a25950bf796d11f0d50fe Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Wed, 23 Oct 2013 19:00:42 +0200 Subject: data/templates/Debian.info.in: Add jessie We already have the new Ubuntu development version, but not our own testing. --- data/templates/Debian.info.in | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/data/templates/Debian.info.in b/data/templates/Debian.info.in index 3ffe174d..59cb885c 100644 --- a/data/templates/Debian.info.in +++ b/data/templates/Debian.info.in @@ -1,5 +1,35 @@ _ChangelogURI: http://packages.debian.org/changelogs/pool/%s/%s/%s/%s_%s/changelog +Suite: jessie +RepositoryType: deb +BaseURI: http://http.us.debian.org/debian/ +MatchURI: ftp[0-9]*\.([a-z]*\.){0,1}debian\.org +MirrorsFile: Debian.mirrors +_Description: Debian 8 'jessie' +Component: main +_CompDescription: Officially supported +Component: contrib +_CompDescription: DFSG-compatible Software with Non-Free Dependencies +Component: non-free +_CompDescription: Non-DFSG-compatible Software + +Suite: jessie/updates +RepositoryType: deb +BaseURI: http://security.debian.org/ +MatchURI: security\.debian\.org +ParentSuite: jessie +_Description: Security updates + +Suite: jessie-updates +RepositoryType: deb +ParentSuite: jessie +_Description: Recommended updates + +Suite: jessie-proposed-updates +RepositoryType: deb +ParentSuite: jessie +_Description: Proposed updates + Suite: wheezy RepositoryType: deb BaseURI: http://http.us.debian.org/debian/ -- cgit v1.2.3 From 0033e9b728a553bff0caa81d4c500532d5ba9ca1 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Wed, 23 Oct 2013 19:05:12 +0200 Subject: data/templates/Debian.info.in: Change wheezy version from 7.0 to 7 The wheezy release now uses 7.1, 7.2 for point releases, so this is more accurate. The translations were adjusted using sed. --- data/templates/Debian.info.in | 2 +- po/ar.po | 2 +- po/be.po | 4 ++-- po/bg.po | 2 +- po/bn.po | 2 +- po/ca.po | 2 +- po/cs.po | 2 +- po/csb.po | 2 +- po/da.po | 4 ++-- po/de.po | 4 ++-- po/el.po | 4 ++-- po/en_AU.po | 2 +- po/en_CA.po | 2 +- po/eo.po | 4 ++-- po/es.po | 4 ++-- po/fi.po | 4 ++-- po/fr.po | 4 ++-- po/gl.po | 2 +- po/he.po | 2 +- po/hr.po | 2 +- po/hu.po | 4 ++-- po/id.po | 4 ++-- po/it.po | 2 +- po/ja.po | 4 ++-- po/ka.po | 2 +- po/ko.po | 2 +- po/ku.po | 2 +- po/lt.po | 2 +- po/lv.po | 2 +- po/mk.po | 2 +- po/nb.po | 2 +- po/ne.po | 2 +- po/nl.po | 4 ++-- po/oc.po | 2 +- po/pl.po | 4 ++-- po/pt.po | 2 +- po/pt_BR.po | 4 ++-- po/python-apt.pot | 2 +- po/ro.po | 2 +- po/ru.po | 4 ++-- po/sk.po | 4 ++-- po/sl.po | 4 ++-- po/sq.po | 2 +- po/sr.po | 4 ++-- po/sv.po | 2 +- po/th.po | 2 +- po/tl.po | 4 ++-- po/tr.po | 2 +- po/uk.po | 2 +- po/vi.po | 2 +- po/zh_CN.po | 2 +- po/zh_HK.po | 2 +- po/zh_TW.po | 2 +- 53 files changed, 72 insertions(+), 72 deletions(-) diff --git a/data/templates/Debian.info.in b/data/templates/Debian.info.in index 59cb885c..9c3f2fa6 100644 --- a/data/templates/Debian.info.in +++ b/data/templates/Debian.info.in @@ -35,7 +35,7 @@ RepositoryType: deb BaseURI: http://http.us.debian.org/debian/ MatchURI: ftp[0-9]*\.([a-z]*\.){0,1}debian\.org MirrorsFile: Debian.mirrors -_Description: Debian 7.0 'Wheezy' +_Description: Debian 7 'Wheezy' Component: main _CompDescription: Officially supported Component: contrib diff --git a/po/ar.po b/po/ar.po index cf476639..73c76541 100644 --- a/po/ar.po +++ b/po/ar.po @@ -359,7 +359,7 @@ msgstr "" #. Description #: ../data/templates/Debian.info.in:8 -msgid "Debian 7.0 'Wheezy' " +msgid "Debian 7 'Wheezy' " msgstr "" #. Description diff --git a/po/be.po b/po/be.po index 22cfda03..53470c39 100644 --- a/po/be.po +++ b/po/be.po @@ -359,8 +359,8 @@ msgstr "http://packages.debian.org/changelogs/pool/%s/%s/%s/%s_%s/changelog" #. Description #: ../data/templates/Debian.info.in:8 -msgid "Debian 7.0 'Wheezy' " -msgstr "Debian 7.0 'Wheezy' " +msgid "Debian 7 'Wheezy' " +msgstr "Debian 7 'Wheezy' " #. Description #: ../data/templates/Debian.info.in:33 diff --git a/po/bg.po b/po/bg.po index be5b379e..2c9942d7 100644 --- a/po/bg.po +++ b/po/bg.po @@ -405,7 +405,7 @@ msgstr "http://packages.debian.org/changelogs/pool/%s/%s/%s/%s_%s/changelog" #. Description #: ../data/templates/Debian.info.in:8 #, fuzzy -msgid "Debian 7.0 'Wheezy' " +msgid "Debian 7 'Wheezy' " msgstr "Debian 3.1 „Sarge“" #. Description diff --git a/po/bn.po b/po/bn.po index 71bb1585..a20804c6 100644 --- a/po/bn.po +++ b/po/bn.po @@ -399,7 +399,7 @@ msgstr "http://packages.debian.org/changelogs/pool/%s/%s/%s/%s_%s/changelog" #. Description #: ../data/templates/Debian.info.in:8 #, fuzzy -msgid "Debian 7.0 'Wheezy' " +msgid "Debian 7 'Wheezy' " msgstr "ডেবিয়ান ৩.১ \"সার্জ\"" #. Description diff --git a/po/ca.po b/po/ca.po index c40b1df1..524a4ce4 100644 --- a/po/ca.po +++ b/po/ca.po @@ -403,7 +403,7 @@ msgstr "http://packages.debian.org/changelogs/pool/%s/%s/%s/%s_%s/changelog" #. Description #: ../data/templates/Debian.info.in:8 #, fuzzy -msgid "Debian 7.0 'Wheezy' " +msgid "Debian 7 'Wheezy' " msgstr "Debian 3.1 \"Sarge\"" #. Description diff --git a/po/cs.po b/po/cs.po index 283da4ae..5e9fd73d 100644 --- a/po/cs.po +++ b/po/cs.po @@ -390,7 +390,7 @@ msgstr "http://packages.debian.org/changelogs/pool/%s/%s/%s/%s_%s/changelog" #. Description #: ../data/templates/Debian.info.in:8 #, fuzzy -msgid "Debian 7.0 'Wheezy' " +msgid "Debian 7 'Wheezy' " msgstr "Debian 3.1 \"Sarge\"" #. Description diff --git a/po/csb.po b/po/csb.po index 2f81e949..73359928 100644 --- a/po/csb.po +++ b/po/csb.po @@ -359,7 +359,7 @@ msgstr "" #. Description #: ../data/templates/Debian.info.in:8 -msgid "Debian 7.0 'Wheezy' " +msgid "Debian 7 'Wheezy' " msgstr "" #. Description diff --git a/po/da.po b/po/da.po index 23e40cf1..9deb9672 100644 --- a/po/da.po +++ b/po/da.po @@ -358,8 +358,8 @@ msgstr "http://packages.debian.org/changelogs/pool/%s/%s/%s/%s_%s/changelog" #. Description #: ../data/templates/Debian.info.in:8 -msgid "Debian 7.0 'Wheezy' " -msgstr "Debian 7.0 \"Wheezy\" " +msgid "Debian 7 'Wheezy' " +msgstr "Debian 7 \"Wheezy\" " #. Description #: ../data/templates/Debian.info.in:33 diff --git a/po/de.po b/po/de.po index 5f3fb0fa..c7ee73ee 100644 --- a/po/de.po +++ b/po/de.po @@ -360,8 +360,8 @@ msgstr "http://packages.debian.org/changelogs/pool/%s/%s/%s/%s_%s/changelog" #. Description #: ../data/templates/Debian.info.in:8 -msgid "Debian 7.0 'Wheezy' " -msgstr "Debian 7.0 »Wheezy«" +msgid "Debian 7 'Wheezy' " +msgstr "Debian 7 »Wheezy«" #. Description #: ../data/templates/Debian.info.in:33 diff --git a/po/el.po b/po/el.po index f5599eaf..a4a48cfd 100644 --- a/po/el.po +++ b/po/el.po @@ -357,8 +357,8 @@ msgstr "http://packages.debian.org/changelogs/pool/%s/%s/%s/%s_%s/changelog" #. Description #: ../data/templates/Debian.info.in:8 -msgid "Debian 7.0 'Wheezy' " -msgstr "Debian 7.0 'Wheezy' " +msgid "Debian 7 'Wheezy' " +msgstr "Debian 7 'Wheezy' " #. Description #: ../data/templates/Debian.info.in:33 diff --git a/po/en_AU.po b/po/en_AU.po index 05557e67..3dc30fba 100644 --- a/po/en_AU.po +++ b/po/en_AU.po @@ -389,7 +389,7 @@ msgstr "http://packages.debian.org/changelogs/pool/%s/%s/%s/%s_%s/changelog" #. Description #: ../data/templates/Debian.info.in:8 #, fuzzy -msgid "Debian 7.0 'Wheezy' " +msgid "Debian 7 'Wheezy' " msgstr "Debian 3.1 \"Sarge\"" #. Description diff --git a/po/en_CA.po b/po/en_CA.po index 17e4c85e..d272067b 100644 --- a/po/en_CA.po +++ b/po/en_CA.po @@ -409,7 +409,7 @@ msgstr "" #. Description #: ../data/templates/Debian.info.in:8 #, fuzzy -msgid "Debian 7.0 'Wheezy' " +msgid "Debian 7 'Wheezy' " msgstr "Debian Stable Security Updates" #. Description diff --git a/po/eo.po b/po/eo.po index 3eceb847..648006ad 100644 --- a/po/eo.po +++ b/po/eo.po @@ -362,8 +362,8 @@ msgstr "http://packages.debian.org/changelogs/pool/%s/%s/%s/%s_%s/changelog" #. Description #: ../data/templates/Debian.info.in:8 -msgid "Debian 7.0 'Wheezy' " -msgstr "Debiano 7.0 'Wheezy' " +msgid "Debian 7 'Wheezy' " +msgstr "Debiano 7 'Wheezy' " #. Description #: ../data/templates/Debian.info.in:33 diff --git a/po/es.po b/po/es.po index f33ae04f..16113198 100644 --- a/po/es.po +++ b/po/es.po @@ -382,8 +382,8 @@ msgstr "http://packages.debian.org/changelogs/pool/%s/%s/%s/%s_%s/changelog" #. Description #: ../data/templates/Debian.info.in:8 -msgid "Debian 7.0 'Wheezy' " -msgstr "Debian 7.0 «Wheezy» " +msgid "Debian 7 'Wheezy' " +msgstr "Debian 7 «Wheezy» " #. Description #: ../data/templates/Debian.info.in:33 diff --git a/po/fi.po b/po/fi.po index 3f018385..ba718ff2 100644 --- a/po/fi.po +++ b/po/fi.po @@ -356,8 +356,8 @@ msgstr "http://packages.debian.org/changelogs/pool/%s/%s/%s/%s_%s/changelog" #. Description #: ../data/templates/Debian.info.in:8 -msgid "Debian 7.0 'Wheezy' " -msgstr "Debian 7.0 \"Wheezy\" " +msgid "Debian 7 'Wheezy' " +msgstr "Debian 7 \"Wheezy\" " #. Description #: ../data/templates/Debian.info.in:33 diff --git a/po/fr.po b/po/fr.po index 116dff6f..6ba61f22 100644 --- a/po/fr.po +++ b/po/fr.po @@ -362,8 +362,8 @@ msgstr "http://packages.debian.org/changelogs/pool/%s/%s/%s/%s_%s/changelog" #. Description #: ../data/templates/Debian.info.in:8 -msgid "Debian 7.0 'Wheezy' " -msgstr "Debian 7.0 « Wheezy »" +msgid "Debian 7 'Wheezy' " +msgstr "Debian 7 « Wheezy »" #. Description #: ../data/templates/Debian.info.in:33 diff --git a/po/gl.po b/po/gl.po index 1fb36503..505ccc27 100644 --- a/po/gl.po +++ b/po/gl.po @@ -391,7 +391,7 @@ msgstr "http://packages.debian.org/changelogs/pool/%s/%s/%s/%s_%s/changelog" #. Description #: ../data/templates/Debian.info.in:8 #, fuzzy -msgid "Debian 7.0 'Wheezy' " +msgid "Debian 7 'Wheezy' " msgstr "Debian 3.1 \"Sarge\"" #. Description diff --git a/po/he.po b/po/he.po index f2d9a596..6942f568 100644 --- a/po/he.po +++ b/po/he.po @@ -395,7 +395,7 @@ msgstr "http://packages.debian.org/changelogs/pool/%s/%s/%s/%s_%s/changelog" #. Description #: ../data/templates/Debian.info.in:8 #, fuzzy -msgid "Debian 7.0 'Wheezy' " +msgid "Debian 7 'Wheezy' " msgstr "דביאן 3.1 \"סארג'\"" #. Description diff --git a/po/hr.po b/po/hr.po index a092208a..66c76e34 100644 --- a/po/hr.po +++ b/po/hr.po @@ -390,7 +390,7 @@ msgstr "http://packages.debian.org/changelogs/pool/%s/%s/%s/%s_%s/changelog" #. Description #: ../data/templates/Debian.info.in:8 #, fuzzy -msgid "Debian 7.0 'Wheezy' " +msgid "Debian 7 'Wheezy' " msgstr "Debian 3.1 \"Sarge\"" #. Description diff --git a/po/hu.po b/po/hu.po index f775801e..8045f25a 100644 --- a/po/hu.po +++ b/po/hu.po @@ -357,8 +357,8 @@ msgstr "http://packages.debian.org/changelogs/pool/%s/%s/%s/%s_%s/changelog" #. Description #: ../data/templates/Debian.info.in:8 -msgid "Debian 7.0 'Wheezy' " -msgstr "Debian 7.0 „Wheezy” " +msgid "Debian 7 'Wheezy' " +msgstr "Debian 7 „Wheezy” " #. Description #: ../data/templates/Debian.info.in:33 diff --git a/po/id.po b/po/id.po index 8eb83d70..56980963 100644 --- a/po/id.po +++ b/po/id.po @@ -359,8 +359,8 @@ msgstr "http://packages.debian.org/changelogs/pool/%s/%s/%s/%s_%s/changelog" #. Description #: ../data/templates/Debian.info.in:8 -msgid "Debian 7.0 'Wheezy' " -msgstr "Debian 7.0 'Wheezy' " +msgid "Debian 7 'Wheezy' " +msgstr "Debian 7 'Wheezy' " #. Description #: ../data/templates/Debian.info.in:33 diff --git a/po/it.po b/po/it.po index 3ce4df2f..2981eb3a 100644 --- a/po/it.po +++ b/po/it.po @@ -390,7 +390,7 @@ msgstr "http://packages.debian.org/changelogs/pool/%s/%s/%s/%s_%s/changelog" #. Description #: ../data/templates/Debian.info.in:8 #, fuzzy -msgid "Debian 7.0 'Wheezy' " +msgid "Debian 7 'Wheezy' " msgstr "Debian 3.1 \"Sarge\"" #. Description diff --git a/po/ja.po b/po/ja.po index 8171cc85..2a3b0333 100644 --- a/po/ja.po +++ b/po/ja.po @@ -360,8 +360,8 @@ msgstr "http://packages.debian.org/changelogs/pool/%s/%s/%s/%s_%s/changelog" #. Description #: ../data/templates/Debian.info.in:8 -msgid "Debian 7.0 'Wheezy' " -msgstr "Debian 7.0 'Wheezy' " +msgid "Debian 7 'Wheezy' " +msgstr "Debian 7 'Wheezy' " #. Description #: ../data/templates/Debian.info.in:33 diff --git a/po/ka.po b/po/ka.po index 904c50e0..d2844a68 100644 --- a/po/ka.po +++ b/po/ka.po @@ -391,7 +391,7 @@ msgstr "http://packages.debian.org/changelogs/pool/%s/%s/%s/%s_%s/changelog" #. Description #: ../data/templates/Debian.info.in:8 #, fuzzy -msgid "Debian 7.0 'Wheezy' " +msgid "Debian 7 'Wheezy' " msgstr "Debian 3.1 \"Sarge\"" #. Description diff --git a/po/ko.po b/po/ko.po index 2cd59397..46d26133 100644 --- a/po/ko.po +++ b/po/ko.po @@ -388,7 +388,7 @@ msgstr "http://packages.debian.org/changelogs/pool/%s/%s/%s/%s_%s/changelog" #. Description #: ../data/templates/Debian.info.in:8 #, fuzzy -msgid "Debian 7.0 'Wheezy' " +msgid "Debian 7 'Wheezy' " msgstr "데비안 3.1 \"Sarge\"" #. Description diff --git a/po/ku.po b/po/ku.po index 300f8dbc..9ba4a544 100644 --- a/po/ku.po +++ b/po/ku.po @@ -390,7 +390,7 @@ msgstr "http://packages.debian.org/changelogs/pool/%s/%s/%s/%s_%s/changelog" #. Description #: ../data/templates/Debian.info.in:8 #, fuzzy -msgid "Debian 7.0 'Wheezy' " +msgid "Debian 7 'Wheezy' " msgstr "Debian 3.1 \"Sarge\"" #. Description diff --git a/po/lt.po b/po/lt.po index 6a9e00b0..7fd8f1f6 100644 --- a/po/lt.po +++ b/po/lt.po @@ -394,7 +394,7 @@ msgstr "http://packages.debian.org/changelogs/pool/%s/%s/%s/%s_%s/changelog" #. Description #: ../data/templates/Debian.info.in:8 #, fuzzy -msgid "Debian 7.0 'Wheezy' " +msgid "Debian 7 'Wheezy' " msgstr "Debian 3.1 „Sarge“" #. Description diff --git a/po/lv.po b/po/lv.po index fd0a5966..272b8c93 100644 --- a/po/lv.po +++ b/po/lv.po @@ -366,7 +366,7 @@ msgstr "" #. Description #: ../data/templates/Debian.info.in:8 -msgid "Debian 7.0 'Wheezy' " +msgid "Debian 7 'Wheezy' " msgstr "" #. Description diff --git a/po/mk.po b/po/mk.po index 5fab2d56..bb6f0c94 100644 --- a/po/mk.po +++ b/po/mk.po @@ -405,7 +405,7 @@ msgstr "http://packages.debian.org/changelogs/pool/%s/%s/%s/%s_%s/changelog" #. Description #: ../data/templates/Debian.info.in:8 #, fuzzy -msgid "Debian 7.0 'Wheezy' " +msgid "Debian 7 'Wheezy' " msgstr "Debian 3.1 \"Sarge\"" #. Description diff --git a/po/nb.po b/po/nb.po index cb9cf12b..58e1b56a 100644 --- a/po/nb.po +++ b/po/nb.po @@ -406,7 +406,7 @@ msgstr "http://packages.debian.org/changelogs/pool/%s/%s/%s/%s_%s/changelog" #. Description #: ../data/templates/Debian.info.in:8 #, fuzzy -msgid "Debian 7.0 'Wheezy' " +msgid "Debian 7 'Wheezy' " msgstr "Debian 3.1 \"Sarge\"" #. Description diff --git a/po/ne.po b/po/ne.po index 13c876d6..e7de8d81 100644 --- a/po/ne.po +++ b/po/ne.po @@ -410,7 +410,7 @@ msgstr "" #. Description #: ../data/templates/Debian.info.in:8 #, fuzzy -msgid "Debian 7.0 'Wheezy' " +msgid "Debian 7 'Wheezy' " msgstr "डेबियन अचल सुरक्षा अद्यावधिकहरु" #. Description diff --git a/po/nl.po b/po/nl.po index c9995edf..24f3e26a 100644 --- a/po/nl.po +++ b/po/nl.po @@ -357,8 +357,8 @@ msgstr "http://packages.debian.org/changelogs/pool/%s/%s/%s/%s_%s/changelog" #. Description #: ../data/templates/Debian.info.in:8 -msgid "Debian 7.0 'Wheezy' " -msgstr "Debian 7.0 'Wheezy' " +msgid "Debian 7 'Wheezy' " +msgstr "Debian 7 'Wheezy' " #. Description #: ../data/templates/Debian.info.in:33 diff --git a/po/oc.po b/po/oc.po index 8155fcd1..4b4647ce 100644 --- a/po/oc.po +++ b/po/oc.po @@ -393,7 +393,7 @@ msgstr "http://packages.debian.org/changelogs/pool/%s/%s/%s/%s_%s/changelog" #. Description #: ../data/templates/Debian.info.in:8 #, fuzzy -msgid "Debian 7.0 'Wheezy' " +msgid "Debian 7 'Wheezy' " msgstr "Debian 3.1 \"Sarge\"" #. Description diff --git a/po/pl.po b/po/pl.po index ed27d066..d6c4c480 100644 --- a/po/pl.po +++ b/po/pl.po @@ -362,8 +362,8 @@ msgstr "http://packages.debian.org/changelogs/pool/%s/%s/%s/%s_%s/changelog" #. Description #: ../data/templates/Debian.info.in:8 -msgid "Debian 7.0 'Wheezy' " -msgstr "Debian 7.0 \"Wheezy\" " +msgid "Debian 7 'Wheezy' " +msgstr "Debian 7 \"Wheezy\" " #. Description #: ../data/templates/Debian.info.in:33 diff --git a/po/pt.po b/po/pt.po index 5496a46c..aca824ff 100644 --- a/po/pt.po +++ b/po/pt.po @@ -387,7 +387,7 @@ msgstr "http://packages.debian.org/changelogs/pool/%s/%s/%s/%s_%s/changelog" #. Description #: ../data/templates/Debian.info.in:8 #, fuzzy -msgid "Debian 7.0 'Wheezy' " +msgid "Debian 7 'Wheezy' " msgstr "Debian 3.1 \"Sarge\"" #. Description diff --git a/po/pt_BR.po b/po/pt_BR.po index a19c5c2c..fe0d5ce1 100644 --- a/po/pt_BR.po +++ b/po/pt_BR.po @@ -357,8 +357,8 @@ msgstr "http://packages.debian.org/changelogs/pool/%s/%s/%s/%s_%s/changelog" #. Description #: ../data/templates/Debian.info.in:8 -msgid "Debian 7.0 'Wheezy' " -msgstr "Debian 7.0 'Wheezy' " +msgid "Debian 7 'Wheezy' " +msgstr "Debian 7 'Wheezy' " #. Description #: ../data/templates/Debian.info.in:33 diff --git a/po/python-apt.pot b/po/python-apt.pot index f35e7f1b..a2219138 100644 --- a/po/python-apt.pot +++ b/po/python-apt.pot @@ -401,7 +401,7 @@ msgstr "" #. Description #: ../data/templates/Debian.info.in:8 -msgid "Debian 7.0 'Wheezy' " +msgid "Debian 7 'Wheezy' " msgstr "" #. Description diff --git a/po/ro.po b/po/ro.po index 46c79e7e..05885f0c 100644 --- a/po/ro.po +++ b/po/ro.po @@ -392,7 +392,7 @@ msgstr "http://packages.debian.org/changelogs/pool/%s/%s/%s/%s_%s/changelog" #. Description #: ../data/templates/Debian.info.in:8 #, fuzzy -msgid "Debian 7.0 'Wheezy' " +msgid "Debian 7 'Wheezy' " msgstr "Debian 3.1 \"Sarge\"" #. Description diff --git a/po/ru.po b/po/ru.po index aa8be8e4..4a457f02 100644 --- a/po/ru.po +++ b/po/ru.po @@ -387,8 +387,8 @@ msgstr "http://packages.debian.org/changelogs/pool/%s/%s/%s/%s_%s/changelog" #. Description #: ../data/templates/Debian.info.in:8 -msgid "Debian 7.0 'Wheezy' " -msgstr "Debian 7.0 'Wheezy' " +msgid "Debian 7 'Wheezy' " +msgstr "Debian 7 'Wheezy' " #. Description #: ../data/templates/Debian.info.in:33 diff --git a/po/sk.po b/po/sk.po index d01acebb..a34b84b3 100644 --- a/po/sk.po +++ b/po/sk.po @@ -357,8 +357,8 @@ msgstr "http://packages.debian.org/changelogs/pool/%s/%s/%s/%s_%s/changelog" #. Description #: ../data/templates/Debian.info.in:8 -msgid "Debian 7.0 'Wheezy' " -msgstr "Debian 7.0 „Wheezy“ " +msgid "Debian 7 'Wheezy' " +msgstr "Debian 7 „Wheezy“ " #. Description #: ../data/templates/Debian.info.in:33 diff --git a/po/sl.po b/po/sl.po index ce5d7081..3c67f3ef 100644 --- a/po/sl.po +++ b/po/sl.po @@ -365,8 +365,8 @@ msgstr "http://packages.debian.org/changelogs/pool/%s/%s/%s/%s_%s/changelog" #. Description #: ../data/templates/Debian.info.in:8 -msgid "Debian 7.0 'Wheezy' " -msgstr "Debian 7.0 'Wheezy' " +msgid "Debian 7 'Wheezy' " +msgstr "Debian 7 'Wheezy' " #. Description #: ../data/templates/Debian.info.in:33 diff --git a/po/sq.po b/po/sq.po index 9f813577..5bf5e5d9 100644 --- a/po/sq.po +++ b/po/sq.po @@ -358,7 +358,7 @@ msgstr "" #. Description #: ../data/templates/Debian.info.in:8 -msgid "Debian 7.0 'Wheezy' " +msgid "Debian 7 'Wheezy' " msgstr "" #. Description diff --git a/po/sr.po b/po/sr.po index 0726da4c..7e2fbcad 100644 --- a/po/sr.po +++ b/po/sr.po @@ -370,8 +370,8 @@ msgstr "http://packages.debian.org/changelogs/pool/%s/%s/%s/%s_%s/changelog" #. Description #: ../data/templates/Debian.info.in:8 -msgid "Debian 7.0 'Wheezy' " -msgstr "Debian 7.0 'Wheezy' " +msgid "Debian 7 'Wheezy' " +msgstr "Debian 7 'Wheezy' " #. Description #: ../data/templates/Debian.info.in:33 diff --git a/po/sv.po b/po/sv.po index 4bd106ca..08e858b4 100644 --- a/po/sv.po +++ b/po/sv.po @@ -390,7 +390,7 @@ msgstr "http://packages.debian.org/changelogs/pool/%s/%s/%s/%s_%s/changelog" #. Description #: ../data/templates/Debian.info.in:8 #, fuzzy -msgid "Debian 7.0 'Wheezy' " +msgid "Debian 7 'Wheezy' " msgstr "Debian 3.1 \"Sarge\"" #. Description diff --git a/po/th.po b/po/th.po index 424324e6..bfc7ca6c 100644 --- a/po/th.po +++ b/po/th.po @@ -388,7 +388,7 @@ msgstr "http://packages.debian.org/changelogs/pool/%s/%s/%s/%s_%s/changelog" #. Description #: ../data/templates/Debian.info.in:8 #, fuzzy -msgid "Debian 7.0 'Wheezy' " +msgid "Debian 7 'Wheezy' " msgstr "เดเบียน 3.1 \"Sarge\"" #. Description diff --git a/po/tl.po b/po/tl.po index 24260ca9..3273376e 100644 --- a/po/tl.po +++ b/po/tl.po @@ -357,8 +357,8 @@ msgstr "http://packages.debian.org/changelogs/pool/%s/%s/%s/%s_%s/changelog" #. Description #: ../data/templates/Debian.info.in:8 -msgid "Debian 7.0 'Wheezy' " -msgstr "Debian 7.0 'Wheezy' " +msgid "Debian 7 'Wheezy' " +msgstr "Debian 7 'Wheezy' " #. Description #: ../data/templates/Debian.info.in:33 diff --git a/po/tr.po b/po/tr.po index 3dfe2d4d..aea46617 100644 --- a/po/tr.po +++ b/po/tr.po @@ -389,7 +389,7 @@ msgstr "http://packages.debian.org/changelogs/pool/%s/%s/%s/%s_%s/changelog" #. Description #: ../data/templates/Debian.info.in:8 #, fuzzy -msgid "Debian 7.0 'Wheezy' " +msgid "Debian 7 'Wheezy' " msgstr "Debian 3.1 \"Sarge\"" #. Description diff --git a/po/uk.po b/po/uk.po index 29b6c79c..9ed1185a 100644 --- a/po/uk.po +++ b/po/uk.po @@ -365,7 +365,7 @@ msgstr "" #. Description #: ../data/templates/Debian.info.in:8 #, fuzzy -msgid "Debian 7.0 'Wheezy' " +msgid "Debian 7 'Wheezy' " msgstr "Debian 3.1 \"Sarge\"" #. Description diff --git a/po/vi.po b/po/vi.po index 8d2eb836..31ac60cb 100644 --- a/po/vi.po +++ b/po/vi.po @@ -407,7 +407,7 @@ msgstr "" #. Description #: ../data/templates/Debian.info.in:8 #, fuzzy -msgid "Debian 7.0 'Wheezy' " +msgid "Debian 7 'Wheezy' " msgstr "Debian 3.1 « Sarge »" #. Description diff --git a/po/zh_CN.po b/po/zh_CN.po index 979beb23..004245ce 100644 --- a/po/zh_CN.po +++ b/po/zh_CN.po @@ -391,7 +391,7 @@ msgstr "http://packages.debian.org/changelogs/pool/%s/%s/%s/%s_%s/changelog" #. Description #: ../data/templates/Debian.info.in:8 #, fuzzy -msgid "Debian 7.0 'Wheezy' " +msgid "Debian 7 'Wheezy' " msgstr "Debian 3.1 \"Sarge\"" #. Description diff --git a/po/zh_HK.po b/po/zh_HK.po index 08083738..08190a3d 100644 --- a/po/zh_HK.po +++ b/po/zh_HK.po @@ -363,7 +363,7 @@ msgstr "http://packages.debian.org/changelogs/pool/%s/%s/%s/%s_%s/changelog" #. Description #: ../data/templates/Debian.info.in:8 #, fuzzy -msgid "Debian 7.0 'Wheezy' " +msgid "Debian 7 'Wheezy' " msgstr "Debian 3.1「Sarge」" #. Description diff --git a/po/zh_TW.po b/po/zh_TW.po index da3fe57a..8fb1060d 100644 --- a/po/zh_TW.po +++ b/po/zh_TW.po @@ -383,7 +383,7 @@ msgstr "http://packages.debian.org/changelogs/pool/%s/%s/%s/%s_%s/changelog" #. Description #: ../data/templates/Debian.info.in:8 #, fuzzy -msgid "Debian 7.0 'Wheezy' " +msgid "Debian 7 'Wheezy' " msgstr "Debian 3.1 “Sarge”" #. Description -- cgit v1.2.3 From 0d616ec4ef49064412b27275dbbb1cb04b546fb5 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Wed, 23 Oct 2013 19:27:10 +0200 Subject: python/*.cc: Get rid of the easy-to-replace deprecated APT functions We cannot get rid of the InstallProtect and StrToTime calls for backwards compatibility, but let's drop the others. --- python/apt_pkgmodule.cc | 2 +- python/cache.cc | 6 +++--- python/depcache.cc | 4 +++- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/python/apt_pkgmodule.cc b/python/apt_pkgmodule.cc index a3916021..644827c3 100644 --- a/python/apt_pkgmodule.cc +++ b/python/apt_pkgmodule.cc @@ -21,7 +21,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/python/cache.cc b/python/cache.cc index 40782838..2fa556e1 100644 --- a/python/cache.cc +++ b/python/cache.cc @@ -329,7 +329,7 @@ static PyObject *PkgCacheNew(PyTypeObject *type,PyObject *Args,PyObject *kwds) if (pyCallbackInst == Py_None) { OpProgress Prog; - if (Cache->Open(Prog,false) == false) + if (Cache->Open(&Prog,false) == false) return HandleErrors(); } else if(pyCallbackInst != 0) { // sanity check for the progress object, see #497049 @@ -345,12 +345,12 @@ static PyObject *PkgCacheNew(PyTypeObject *type,PyObject *Args,PyObject *kwds) } PyOpProgress progress; progress.setCallbackInst(pyCallbackInst); - if (Cache->Open(progress,false) == false) + if (Cache->Open(&progress,false) == false) return HandleErrors(); } else { OpTextProgress Prog; - if (Cache->Open(Prog,false) == false) + if (Cache->Open(&Prog,false) == false) return HandleErrors(); } diff --git a/python/depcache.cc b/python/depcache.cc index acd41a85..9f4b91b4 100644 --- a/python/depcache.cc +++ b/python/depcache.cc @@ -89,9 +89,11 @@ static PyObject *PkgDepCacheCommit(PyObject *Self,PyObject *Args) PyFetchProgress progress; progress.setCallbackInst(pyFetchProgressInst); - pkgAcquire Fetcher(&progress); + pkgAcquire Fetcher; pkgPackageManager *PM; PM = _system->CreatePM(depcache); + + Fetcher.Setup(&progress); if(PM->GetArchives(&Fetcher, &List, &Recs) == false || _error->PendingError() == true) { std::cerr << "Error in GetArchives" << std::endl; -- cgit v1.2.3 From ea815d93dda86504518bdf69488b1f336f2439a3 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Wed, 23 Oct 2013 19:38:48 +0200 Subject: python/{depcache.cc,string.cc}: Ignore deprecation warnings for some calls Those functions are deprecated in APT, but we still need to provide them for backwards compatibility. --- python/depcache.cc | 2 ++ python/generic.h | 5 +++++ python/string.cc | 2 ++ 3 files changed, 9 insertions(+) diff --git a/python/depcache.cc b/python/depcache.cc index 9f4b91b4..b257e2c9 100644 --- a/python/depcache.cc +++ b/python/depcache.cc @@ -895,7 +895,9 @@ static PyObject *PkgProblemResolverInstallProtect(PyObject *Self,PyObject *Args) pkgProblemResolver *fixer = GetCpp(Self); if (PyArg_ParseTuple(Args,"") == 0) return 0; + PY_APT_BEGIN_DEPRECATED; fixer->InstallProtect(); + PY_APT_END_DEPRECATED; Py_INCREF(Py_None); return HandleErrors(Py_None); } diff --git a/python/generic.h b/python/generic.h index c9db916c..26736f1a 100644 --- a/python/generic.h +++ b/python/generic.h @@ -75,6 +75,11 @@ typedef int Py_ssize_t; #define PyErr_WarnEx(cat,msg,stacklevel) PyErr_Warn(cat,msg) #endif +#define PY_APT_BEGIN_DEPRECATED { \ + _Pragma("GCC diagnostic push"); \ + _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\""); } +#define PY_APT_END_DEPRECATED _Pragma("GCC diagnostic pop") + static inline const char *PyUnicode_AsString(PyObject *op) { // Convert to bytes object, using the default encoding. diff --git a/python/string.cc b/python/string.cc index 62aa34e7..9b02c933 100644 --- a/python/string.cc +++ b/python/string.cc @@ -113,8 +113,10 @@ PyObject *StrStrToTime(PyObject *Self,PyObject *Args) return 0; time_t Result; + PY_APT_BEGIN_DEPRECATED; if (StrToTime(Str,Result) == false) { + PY_APT_END_DEPRECATED; Py_INCREF(Py_None); return Py_None; } -- cgit v1.2.3 From a2b3528a6b96c11a8c3f0600a5cde778a7911b4e Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Wed, 23 Oct 2013 19:40:07 +0200 Subject: python/depcache.cc: Add more error handling to PkgDepCacheCommit It returned false, but should have returned NULL after handling errors. --- python/depcache.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/depcache.cc b/python/depcache.cc index b257e2c9..c9dc79f3 100644 --- a/python/depcache.cc +++ b/python/depcache.cc @@ -111,7 +111,7 @@ static PyObject *PkgDepCacheCommit(PyObject *Self,PyObject *Args) bool Transient = false; if (Fetcher.Run() == pkgAcquire::Failed) - return false; + return HandleErrors(); // Print out errors bool Failed = false; -- cgit v1.2.3 From 64639a3e1df8ed220250c4c1e56aa93d76c652a6 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Wed, 23 Oct 2013 19:43:03 +0200 Subject: python/cache.cc: Remove a check for an unsigned long value < 0 This is impossible. --- python/cache.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/cache.cc b/python/cache.cc index 2fa556e1..983b56ec 100644 --- a/python/cache.cc +++ b/python/cache.cc @@ -49,7 +49,7 @@ template struct IterListStruct IterListStruct() : LastIndex(0) {}; bool move(unsigned long Index) { - if (Index < 0 || (unsigned)Index >= Count()) + if ((unsigned)Index >= Count()) { PyErr_SetNone(PyExc_IndexError); return false; -- cgit v1.2.3 From 3328ee63967cbcb858f9ba081efe5de0459ed27a Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Wed, 23 Oct 2013 19:46:31 +0200 Subject: python/arfile.cc: (C++11) Explicitly cast unsigned long to time_t in {} According to gcc, the expression would be ill-formed in C++11 otherwise. --- python/arfile.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/python/arfile.cc b/python/arfile.cc index 50cd1246..8f45e658 100644 --- a/python/arfile.cc +++ b/python/arfile.cc @@ -232,7 +232,8 @@ static PyObject *_extract(FileFd &Fd, const ARArchive::Member *member, return PyErr_SetFromErrnoWithFilename(PyExc_OSError, outfile); size -= read; } - utimbuf time = {member->MTime, member->MTime}; + utimbuf time = {static_cast(member->MTime), + static_cast(member->MTime)}; if (utime(outfile,&time) == -1) return PyErr_SetFromErrnoWithFilename(PyExc_OSError, outfile); Py_RETURN_TRUE; -- cgit v1.2.3 From bfe80fd22080fb33781b67157f34ea5114d3a4b2 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Wed, 23 Oct 2013 19:50:28 +0200 Subject: python/apt_instmodule.cc: Make RETURN(x) be return on Python 2 This fixes a small compiler notice. --- python/apt_instmodule.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/apt_instmodule.cc b/python/apt_instmodule.cc index 0f0a187a..8094550a 100644 --- a/python/apt_instmodule.cc +++ b/python/apt_instmodule.cc @@ -52,7 +52,7 @@ static struct PyModuleDef moduledef = { extern "C" PyObject * PyInit_apt_inst() #else extern "C" void initapt_inst() -#define RETURN(x) +#define RETURN(x) return #endif { #if PY_MAJOR_VERSION >= 3 -- cgit v1.2.3 From 9678770074e48ba947e69d9a9f2ef9688688c07f Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Wed, 23 Oct 2013 19:58:27 +0200 Subject: python/policy.cc: (scan-build): Fix a dead assignment We need to use else if, otherwise the first cases are not handled at all. --- python/policy.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/python/policy.cc b/python/policy.cc index ac9a1ace..0ace3e67 100644 --- a/python/policy.cc +++ b/python/policy.cc @@ -134,9 +134,9 @@ static PyObject *policy_create_pin(PyObject *self, PyObject *args) { pkgPolicy *policy = GetCpp(self); if (strcmp(type,"Version") == 0 || strcmp(type, "version") == 0) match_type = pkgVersionMatch::Version; - if (strcmp(type,"Release") == 0 || strcmp(type, "release") == 0) + else if (strcmp(type,"Release") == 0 || strcmp(type, "release") == 0) match_type = pkgVersionMatch::Release; - if (strcmp(type,"Origin") == 0 || strcmp(type, "origin") == 0) + else if (strcmp(type,"Origin") == 0 || strcmp(type, "origin") == 0) match_type = pkgVersionMatch::Origin; else match_type = pkgVersionMatch::None; -- cgit v1.2.3 From 617f32fabedbb91d8b4db7dfb5b36c07e5f64d73 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Wed, 23 Oct 2013 20:01:59 +0200 Subject: python/progress.cc: (scan-build): Fix some uninitialized values We need to set those pointers to NULL, as the functions that may write to them do not always write to them and we would read garbage in such a case. --- python/progress.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/python/progress.cc b/python/progress.cc index aedd7581..a7cf1afa 100644 --- a/python/progress.cc +++ b/python/progress.cc @@ -126,7 +126,7 @@ bool PyFetchProgress::MediaChange(std::string Media, std::string Drive) PyCbObj_END_ALLOW_THREADS //std::cout << "MediaChange" << std::endl; PyObject *arglist = Py_BuildValue("(ss)", Media.c_str(), Drive.c_str()); - PyObject *result; + PyObject *result = NULL; if(PyObject_HasAttrString(callbackInst, "mediaChange")) RunSimpleCallback("mediaChange", arglist, &result); @@ -440,7 +440,7 @@ void PyCdromProgress::Update(std::string text, int current) bool PyCdromProgress::ChangeCdrom() { PyObject *arglist = Py_BuildValue("()"); - PyObject *result; + PyObject *result = NULL; if (PyObject_HasAttrString(callbackInst, "changeCdrom")) RunSimpleCallback("changeCdrom", arglist, &result); else @@ -459,7 +459,7 @@ bool PyCdromProgress::AskCdromName(std::string &Name) PyObject *arglist = Py_BuildValue("()"); const char *new_name; bool res; - PyObject *result; + PyObject *result = NULL; // Old style: (True, name) on success, (False, name) on failure. if (PyObject_HasAttrString(callbackInst, "askAdromName")) { -- cgit v1.2.3 From a80bbc568413466f9f24f28e85825e1ddc27751d Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Wed, 23 Oct 2013 20:19:14 +0200 Subject: debian: Upgrade to debhelper 9 (and dpkg-buildflags) This gives us some more hardening, amongst other things. --- debian/compat | 2 +- debian/control | 2 +- debian/rules | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/debian/compat b/debian/compat index 7f8f011e..ec635144 100644 --- a/debian/compat +++ b/debian/compat @@ -1 +1 @@ -7 +9 diff --git a/debian/control b/debian/control index 55837ac5..e79b58ce 100644 --- a/debian/control +++ b/debian/control @@ -8,7 +8,7 @@ XS-Python-Version: >= 2.6 X-Python3-Version: >= 3.1 Build-Depends: apt (>= 0.9.6), apt-utils, - debhelper (>= 7.3.5), + debhelper (>= 9), fakeroot, libapt-pkg-dev (>= 0.8.11), python-all-dev (>= 2.6.6-3~), diff --git a/debian/rules b/debian/rules index b2da3003..4a33c533 100755 --- a/debian/rules +++ b/debian/rules @@ -1,12 +1,12 @@ #!/usr/bin/make -f # Should be include-links, but that somehow fails. export DEBVER=$(shell dpkg-parsechangelog | sed -n -e 's/^Version: //p') -export CFLAGS=-Wno-write-strings +export DEB_CFLAGS_MAINT_APPEND=-Wno-write-strings export PATH := $(CURDIR)/utils:$(PATH) export pyversions := $(CURDIR)/utils/pyversions %: - dh --with python2,python3 $@ + dh $@ --with python2,python3 override_dh_auto_build: dh_auto_build -- cgit v1.2.3 From 42a8df12f5be44b26830561d98e6bebb8c2ec069 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Wed, 23 Oct 2013 20:23:55 +0200 Subject: debian/python-apt-doc.links: Replace bundled underscore.js by symlink And add a dependency in debian/control. --- debian/control | 2 +- debian/python-apt-doc.links | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/debian/control b/debian/control index e79b58ce..8c2f2ce7 100644 --- a/debian/control +++ b/debian/control @@ -76,7 +76,7 @@ Package: python-apt-doc Priority: optional Architecture: all Section: doc -Depends: libjs-jquery, ${misc:Depends} +Depends: libjs-jquery, libjs-underscore, ${misc:Depends} Enhances: python-apt Replaces: python-apt (<< 0.7.94) Description: Python interface to libapt-pkg (API documentation) diff --git a/debian/python-apt-doc.links b/debian/python-apt-doc.links index 40f834f2..d43d0018 100644 --- a/debian/python-apt-doc.links +++ b/debian/python-apt-doc.links @@ -1 +1,2 @@ usr/share/javascript/jquery/jquery.js usr/share/doc/python-apt-doc/html/_static/jquery.js +usr/share/javascript/underscore/underscore.js usr/share/doc/python-apt-doc/html/_static/underscore.js -- cgit v1.2.3 From 372cffb0b31d4ba681e83db00dc1607a141c5e41 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Wed, 23 Oct 2013 20:31:07 +0200 Subject: po: Update the template --- po/python-apt.pot | 37 +++++++++++++++++++++---------------- 1 file changed, 21 insertions(+), 16 deletions(-) diff --git a/po/python-apt.pot b/po/python-apt.pot index a2219138..15f78b42 100644 --- a/po/python-apt.pot +++ b/po/python-apt.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2013-10-21 20:48+0200\n" +"POT-Creation-Date: 2013-10-23 20:26+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -30,12 +30,12 @@ msgstr "" #. Description #: ../data/templates/Ubuntu.info.in:140 -msgid "Ubuntu 14.04 'Trusty Thar'" +msgid "Ubuntu 14.04 'Trusty Tahr'" msgstr "" #. Description #: ../data/templates/Ubuntu.info.in:147 -msgid "Cdrom with Ubuntu 14.04 'Trusty Thar'" +msgid "Cdrom with Ubuntu 14.04 'Trusty Tahr'" msgstr "" #. Description @@ -279,7 +279,7 @@ msgid "Important security updates" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:1576 ../data/templates/Debian.info.in:26 +#: ../data/templates/Ubuntu.info.in:1576 ../data/templates/Debian.info.in:56 msgid "Recommended updates" msgstr "" @@ -329,7 +329,7 @@ msgid "Cdrom with Ubuntu 5.04 'Hoary Hedgehog'" msgstr "" #. CompDescription -#: ../data/templates/Ubuntu.info.in:1667 ../data/templates/Debian.info.in:179 +#: ../data/templates/Ubuntu.info.in:1667 ../data/templates/Debian.info.in:209 msgid "Officially supported" msgstr "" @@ -401,61 +401,66 @@ msgstr "" #. Description #: ../data/templates/Debian.info.in:8 -msgid "Debian 7 'Wheezy' " +msgid "Debian 8 'jessie'" msgstr "" #. Description #: ../data/templates/Debian.info.in:38 +msgid "Debian 7 'Wheezy' " +msgstr "" + +#. Description +#: ../data/templates/Debian.info.in:68 msgid "Debian 6.0 'Squeeze' " msgstr "" #. Description -#: ../data/templates/Debian.info.in:63 +#: ../data/templates/Debian.info.in:93 msgid "Debian 5.0 'Lenny' " msgstr "" #. Description -#: ../data/templates/Debian.info.in:88 +#: ../data/templates/Debian.info.in:118 msgid "Debian 4.0 'Etch'" msgstr "" #. Description -#: ../data/templates/Debian.info.in:113 +#: ../data/templates/Debian.info.in:143 msgid "Debian 3.1 'Sarge'" msgstr "" #. Description -#: ../data/templates/Debian.info.in:124 +#: ../data/templates/Debian.info.in:154 msgid "Proposed updates" msgstr "" #. Description -#: ../data/templates/Debian.info.in:131 +#: ../data/templates/Debian.info.in:161 msgid "Security updates" msgstr "" #. Description -#: ../data/templates/Debian.info.in:138 +#: ../data/templates/Debian.info.in:168 msgid "Debian current stable release" msgstr "" #. Description -#: ../data/templates/Debian.info.in:151 +#: ../data/templates/Debian.info.in:181 msgid "Debian testing" msgstr "" #. Description -#: ../data/templates/Debian.info.in:177 +#: ../data/templates/Debian.info.in:207 msgid "Debian 'Sid' (unstable)" msgstr "" #. CompDescription -#: ../data/templates/Debian.info.in:181 +#: ../data/templates/Debian.info.in:211 msgid "DFSG-compatible Software with Non-Free Dependencies" msgstr "" #. CompDescription -#: ../data/templates/Debian.info.in:183 +#: ../data/templates/Debian.info.in:213 msgid "Non-DFSG-compatible Software" msgstr "" -- cgit v1.2.3 From e88b9997d141c71d5af260e119d551a0ad92d90a Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Wed, 23 Oct 2013 20:32:44 +0200 Subject: Release 0.9.1 to unstable --- debian/changelog | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/debian/changelog b/debian/changelog index 84f38c0e..06c6946c 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,22 @@ +python-apt (0.9.1) unstable; urgency=low + + * data/templates/Ubuntu.info.in: It's 'Tahr', not 'Thar' + * data/templates/Debian.info.in: Add jessie + * data/templates/Debian.info.in: Change wheezy version from 7.0 to 7 + * python/*.cc: Get rid of the easy-to-replace deprecated APT functions + * python/{depcache.cc,string.cc}: Ignore deprecation warnings for some calls + * python/depcache.cc: Add more error handling to PkgDepCacheCommit + * python/cache.cc: Remove a check for an unsigned long value < 0 + * python/arfile.cc: (C++11) Explicitly cast unsigned long to time_t in {} + * python/apt_instmodule.cc: Make RETURN(x) be return on Python 2 + * python/policy.cc: (scan-build): Fix a dead assignment + * python/progress.cc: (scan-build): Fix some uninitialized values + * debian: Upgrade to debhelper 9 (and dpkg-buildflags) + * debian/python-apt-doc.links: Replace bundled underscore.js by symlink + * po: Update the template + + -- Julian Andres Klode Wed, 23 Oct 2013 20:32:40 +0200 + python-apt (0.9.0) unstable; urgency=low [ Michael Vogt ] -- cgit v1.2.3 From 56ed099558a9f6e7137a8c113ca9efb2b2c1a1d2 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Thu, 24 Oct 2013 13:04:53 +0200 Subject: apt/cache.py: Call os.path.abspath() on a supplied rootdir (LP: #792295) When the rootdir option is set to a relative path, that path appears multiple times in the dir::state::status path, as we also prepend it there. --- apt/cache.py | 1 + 1 file changed, 1 insertion(+) diff --git a/apt/cache.py b/apt/cache.py index 928a6207..2f0eda59 100644 --- a/apt/cache.py +++ b/apt/cache.py @@ -81,6 +81,7 @@ class Cache(object): # force apt to build its caches in memory apt_pkg.config.set("Dir::Cache::pkgcache", "") if rootdir: + rootdir = os.path.abspath(rootdir) if os.path.exists(rootdir+"/etc/apt/apt.conf"): apt_pkg.read_config_file(apt_pkg.config, rootdir + "/etc/apt/apt.conf") -- cgit v1.2.3 From 5e76e9fccee519c63602562dc4065deb3f97748b Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Sat, 23 Nov 2013 08:51:44 +0100 Subject: * apt/cache.py: - when using apt.Cache(rootdir=/some/dir) only read the APT configuration from this rootdir instead of /etc (closes: #728274) --- apt/cache.py | 5 ++++- debian/changelog | 8 ++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/apt/cache.py b/apt/cache.py index 2f0eda59..43fb55d7 100644 --- a/apt/cache.py +++ b/apt/cache.py @@ -82,13 +82,16 @@ class Cache(object): apt_pkg.config.set("Dir::Cache::pkgcache", "") if rootdir: rootdir = os.path.abspath(rootdir) + # clear old config first (Bug#728274) + apt_pkg.config.clear("APT") + apt_pkg.config.set("Dir", rootdir) + apt_pkg.init_config() if os.path.exists(rootdir+"/etc/apt/apt.conf"): apt_pkg.read_config_file(apt_pkg.config, rootdir + "/etc/apt/apt.conf") if os.path.isdir(rootdir+"/etc/apt/apt.conf.d"): apt_pkg.read_config_dir(apt_pkg.config, rootdir + "/etc/apt/apt.conf.d") - apt_pkg.config.set("Dir", rootdir) apt_pkg.config.set("Dir::State::status", rootdir + "/var/lib/dpkg/status") # also set dpkg to the rootdir path so that its called for the diff --git a/debian/changelog b/debian/changelog index 06c6946c..52a1000e 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,11 @@ +python-apt (0.9.2) UNRELEASED; urgency=low + + * apt/cache.py: + - when using apt.Cache(rootdir=/some/dir) only read the APT + configuration from this rootdir instead of /etc (closes: #728274) + + -- Michael Vogt Sat, 23 Nov 2013 08:49:51 +0100 + python-apt (0.9.1) unstable; urgency=low * data/templates/Ubuntu.info.in: It's 'Tahr', not 'Thar' -- cgit v1.2.3 From 1336dd7de3ce9f48a88cedb2dbe90e54f5c85143 Mon Sep 17 00:00:00 2001 From: Michael Schaller Date: Wed, 1 Jan 2014 12:08:21 +0100 Subject: apt/cache.py, apt/package.py: Fixed PEP8 and pyflakes issues This commit removed the unused local variable 'transient' in 'apt/cache.py' and the unused import 'warnings' in 'apt/package.py'. --- apt/cache.py | 53 +++++++++++++++++++++++++---------------------------- apt/package.py | 40 +++++++++++++++++++--------------------- debian/changelog | 9 +++++++++ 3 files changed, 53 insertions(+), 49 deletions(-) diff --git a/apt/cache.py b/apt/cache.py index 43fb55d7..6b1e2bda 100644 --- a/apt/cache.py +++ b/apt/cache.py @@ -40,6 +40,7 @@ class FetchFailedException(IOError): class LockFailedException(IOError): """Exception that is thrown when locking fails.""" + class CacheClosedException(Exception): """Exception that is thrown when the cache is used after close().""" @@ -53,7 +54,7 @@ class Cache(object): list of available packages. The cache can be used like a mapping from package names to Package - objects (although only getting items is supported). + objects (although only getting items is supported). Keyword arguments: progress -- a OpProgress object @@ -74,7 +75,7 @@ class Cache(object): self._fullnameset = set() self._changes_count = -1 self._sorted_set = None - + self.connect("cache_post_open", self._inc_changes_count) self.connect("cache_post_change", self._inc_changes_count) if memonly: @@ -86,17 +87,17 @@ class Cache(object): apt_pkg.config.clear("APT") apt_pkg.config.set("Dir", rootdir) apt_pkg.init_config() - if os.path.exists(rootdir+"/etc/apt/apt.conf"): + if os.path.exists(rootdir + "/etc/apt/apt.conf"): apt_pkg.read_config_file(apt_pkg.config, - rootdir + "/etc/apt/apt.conf") - if os.path.isdir(rootdir+"/etc/apt/apt.conf.d"): + rootdir + "/etc/apt/apt.conf") + if os.path.isdir(rootdir + "/etc/apt/apt.conf.d"): apt_pkg.read_config_dir(apt_pkg.config, - rootdir + "/etc/apt/apt.conf.d") + rootdir + "/etc/apt/apt.conf.d") apt_pkg.config.set("Dir::State::status", rootdir + "/var/lib/dpkg/status") # also set dpkg to the rootdir path so that its called for the # --print-foreign-architectures call - apt_pkg.config.set("Dir::bin::dpkg", + apt_pkg.config.set("Dir::bin::dpkg", os.path.join(rootdir, "usr", "bin", "dpkg")) # create required dirs/files when run with special rootdir # automatically @@ -105,7 +106,6 @@ class Cache(object): # recognized (LP: #320665) apt_pkg.init_system() self.open(progress) - def _inc_changes_count(self): """Increase the number of changes""" @@ -118,12 +118,12 @@ class Cache(object): """ files = ["/var/lib/dpkg/status", "/etc/apt/sources.list", - ] + ] dirs = ["/var/lib/dpkg", "/etc/apt/", "/var/cache/apt/archives/partial", "/var/lib/apt/lists/partial", - ] + ] for d in dirs: if not os.path.exists(rootdir + d): #print "creating: ", rootdir + d @@ -165,8 +165,8 @@ class Cache(object): i = last = 0 size = len(self._cache.packages) for pkg in self._cache.packages: - if progress is not None and last+100 < i: - progress.update(i/float(size)*100) + if progress is not None and last + 100 < i: + progress.update(i / float(size) * 100) last = i # drop stuff with no versions (cruft) if pkg.has_versions: @@ -259,7 +259,8 @@ class Cache(object): def required_download(self): """Get the size of the packages that are required to download.""" if self._records is None: - raise CacheClosedException("Cache object used after close() called") + raise CacheClosedException( + "Cache object used after close() called") pm = apt_pkg.PackageManager(self._depcache) fetcher = apt_pkg.Acquire() pm.get_archives(fetcher, self._list, self._records) @@ -289,16 +290,14 @@ class Cache(object): # now check the result (this is the code from apt-get.cc) failed = False - transient = False err_msg = "" for item in fetcher.items: if item.status == item.STAT_DONE: continue if item.STAT_IDLE: - transient = True continue err_msg += "Failed to fetch %s %s\n" % (item.desc_uri, - item.error_text) + item.error_text) failed = True # we raise a exception if the download failed or it was cancelt @@ -311,7 +310,8 @@ class Cache(object): def _fetch_archives(self, fetcher, pm): """ fetch the needed archives """ if self._records is None: - raise CacheClosedException("Cache object used after close() called") + raise CacheClosedException( + "Cache object used after close() called") # get lock lockfile = apt_pkg.config.find_dir("Dir::Cache::Archives") + "lock" @@ -349,7 +349,6 @@ class Cache(object): if fetcher is None: fetcher = apt_pkg.Acquire(progress) - return self._fetch_archives(fetcher, apt_pkg.PackageManager(self._depcache)) @@ -362,12 +361,12 @@ class Cache(object): else: return bool(pkg.has_provides and not pkg.has_versions) - def get_providing_packages(self, pkgname, candidate_only=True, + def get_providing_packages(self, pkgname, candidate_only=True, include_nonvirtual=False): """Return a list of all packages providing a package. - + Return a list of packages which provide the virtual package of the - specified name. + specified name. If 'candidate_only' is False, return all packages with at least one version providing the virtual package. Otherwise, @@ -378,7 +377,7 @@ class Cache(object): packages providing pkgname, even if pkgname is not itself a virtual pkg. """ - + providers = set() get_candidate_ver = self._depcache.get_candidate_ver try: @@ -423,7 +422,8 @@ class Cache(object): old_sources_list = apt_pkg.config.find("Dir::Etc::sourcelist") old_sources_list_d = apt_pkg.config.find("Dir::Etc::sourceparts") old_cleanup = apt_pkg.config.find("APT::List-Cleanup") - apt_pkg.config.set("Dir::Etc::sourcelist", os.path.abspath(sources_list)) + apt_pkg.config.set("Dir::Etc::sourcelist", + os.path.abspath(sources_list)) apt_pkg.config.set("Dir::Etc::sourceparts", "xxx") apt_pkg.config.set("APT::List-Cleanup", "0") slist = apt_pkg.SourceList() @@ -559,9 +559,9 @@ class Cache(object): @property def dpkg_journal_dirty(self): """Return True if the dpkg was interrupted - + All dpkg operations will fail until this is fixed, the action to - fix the system if dpkg got interrupted is to run + fix the system if dpkg got interrupted is to run 'dpkg --configure -a' as root. """ dpkg_status_dir = os.path.dirname( @@ -711,7 +711,6 @@ class FilteredCache(object): #print "filterCachePostChange()" self._reapply_filter() - # def connect(self, name, callback): # self.cache.connect(name, callback) @@ -750,8 +749,6 @@ def _test(): for pkg in changes: assert pkg.name - - # see if fetching works for dirname in ["/tmp/pytest", "/tmp/pytest/partial"]: if not os.path.exists(dirname): diff --git a/apt/package.py b/apt/package.py index 04d4dddd..79dac71d 100644 --- a/apt/package.py +++ b/apt/package.py @@ -26,7 +26,6 @@ import re import socket import subprocess import urllib2 -import warnings try: from collections import Mapping, Sequence except ImportError: @@ -335,7 +334,7 @@ class Version(object): dsc = unicode(dsc, "utf-8") except UnicodeDecodeError as err: return _("Invalid unicode in description for '%s' (%s). " - "Please report.") % (self.package.name, err) + "Please report.") % (self.package.name, err) lines = iter(dsc.split("\n")) # Skip the first line, since its a duplication of the summary @@ -416,8 +415,8 @@ class Version(object): base_deps = [] for dep_or in dep_ver_list: base_deps.append(BaseDependency(dep_or.target_pkg.name, - dep_or.comp_type, dep_or.target_ver, - (type_ == "PreDepends"), + dep_or.comp_type, dep_or.target_ver, + (type_ == "PreDepends"), rawtype=type_)) depends_list.append(Dependency(base_deps)) except KeyError: @@ -428,7 +427,7 @@ class Version(object): def provides(self): """ Return a list of names that this version provides.""" return [p[0] for p in self._cand.provides_list] - + @property def enhances(self): """Return the list of enhances for the package version.""" @@ -601,7 +600,7 @@ class Version(object): for item in acq.items: if item.status != item.STAT_DONE: raise FetchError("The item %r could not be fetched: %s" % - (item.destfile, item.error_text)) + (item.destfile, item.error_text)) if unpack: outdir = src.package + '-' + apt_pkg.upstream_version(src.version) @@ -633,8 +632,8 @@ class VersionList(Sequence): """ def __init__(self, package, slice_=None): - self._package = package # apt.package.Package() - self._versions = package._pkg.version_list # [apt_pkg.Version(), ...] + self._package = package # apt.package.Package() + self._versions = package._pkg.version_list # [apt_pkg.Version(), ...] if slice_: self._versions = self._versions[slice_] @@ -659,7 +658,7 @@ class VersionList(Sequence): return (Version(self._package, ver) for ver in self._versions) def __contains__(self, item): - if isinstance(item, Version): # Sequence interface + if isinstance(item, Version): # Sequence interface item = item.version # Dictionary interface. for ver in self._versions: @@ -702,8 +701,8 @@ class Package(object): self._changelog = "" # Cached changelog def __repr__(self): - return '' % (self._pkg.name, - self._pkg.architecture, self._pkg.id) + return '' % ( + self._pkg.name, self._pkg.architecture, self._pkg.id) def __lt__(self, other): return self.name < other.name @@ -917,10 +916,10 @@ class Package(object): src_section = "main" # use the section of the candidate as a starting point section = self.candidate.section - + # get the source version src_ver = self.candidate.source_version - + try: # try to get the source version of the pkg, this differs # for some (e.g. libnspr4 on ubuntu) @@ -1006,7 +1005,7 @@ class Package(object): changelog_ver = changelog_ver.split(":", 1)[1] if (installed and apt_pkg.version_compare( - changelog_ver, installed) <= 0): + changelog_ver, installed) <= 0): break # EOF (shouldn't really happen) changelog += line @@ -1020,14 +1019,14 @@ class Package(object): except urllib2.HTTPError: res = _("The list of changes is not available yet.\n\n" - "Please use http://launchpad.net/ubuntu/+source/%s/" - "%s/+changelog\n" - "until the changes become available or try again " - "later.") % (src_pkg, src_ver) + "Please use http://launchpad.net/ubuntu/+source/%s/" + "%s/+changelog\n" + "until the changes become available or try again " + "later.") % (src_pkg, src_ver) return res if isinstance(res, unicode) else res.decode("utf-8") except (IOError, httplib.BadStatusLine): res = _("Failed to download the list of changes. \nPlease " - "check your Internet connection.") + "check your Internet connection.") return res if isinstance(res, unicode) else res.decode("utf-8") finally: socket.setdefaulttimeout(timeout) @@ -1168,12 +1167,11 @@ def _test(): print "Recommends: %s" % pkg.installed.recommends for dep in pkg.candidate.dependencies: print ",".join("%s (%s) (%s) (%s)" % (o.name, o.version, o.relation, - o.pre_depend) for o in dep.or_dependencies) + o.pre_depend) for o in dep.or_dependencies) print "arch: %s" % pkg.candidate.architecture print "homepage: %s" % pkg.candidate.homepage print "rec: ", pkg.candidate.record - print cache["2vcard"].get_changelog() for i in True, False: print "Running install on random upgradable pkgs with AutoFix: %s " % i diff --git a/debian/changelog b/debian/changelog index 52a1000e..319e721a 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,9 +1,18 @@ python-apt (0.9.2) UNRELEASED; urgency=low + [ Michael Vogt ] * apt/cache.py: - when using apt.Cache(rootdir=/some/dir) only read the APT configuration from this rootdir instead of /etc (closes: #728274) + [ Michael Schaller] + * apt/cache.py: + - Fixed PEP8 issues + - Fixed pyflakes issue: Removed unused local variable 'transient' + * apt/package.py: + - Fixed PEP8 issues + - Fixed pyflakes issue: Removed unused import 'warnings' + -- Michael Vogt Sat, 23 Nov 2013 08:49:51 +0100 python-apt (0.9.1) unstable; urgency=low -- cgit v1.2.3 From 29d9d4270c7a7a1f40faed5a46443b33feb8cf9b Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Tue, 31 Dec 2013 10:06:22 +0100 Subject: make pep8 test part of the unittests --- tests/test_pep8.py | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100755 tests/test_pep8.py diff --git a/tests/test_pep8.py b/tests/test_pep8.py new file mode 100755 index 00000000..e6a672cf --- /dev/null +++ b/tests/test_pep8.py @@ -0,0 +1,27 @@ +import os +import subprocess +import unittest + + +class PackagePep8TestCase(unittest.TestCase): + + def test_all_code(self): + res = 0 + py_dir = os.path.join(os.path.dirname(__file__), "..") + res += subprocess.call( + ["pep8", + # disable for now: + # E125 continuation line does not distinguish itself from + # next logical line + # E126 continuation line over-indented for hanging indent + # E127 continuation line over-indented for visual indent + # E128 continuation line under-indented for visual indent + "--ignore=E125,E126,E127,E128", + "--exclude", "build,tests/old", + "--repeat", py_dir]) + if res != 0: + self.fail("pep8 failed with: %s" % res) + + +if __name__ == "__main__": + unittest.main() -- cgit v1.2.3 From 830cced39fa293b17ab73d231fc5cc5e22e77c43 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Tue, 31 Dec 2013 21:36:26 +0100 Subject: add pyflakes test --- tests/test_pyflakes.py | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 tests/test_pyflakes.py diff --git a/tests/test_pyflakes.py b/tests/test_pyflakes.py new file mode 100644 index 00000000..9c17a405 --- /dev/null +++ b/tests/test_pyflakes.py @@ -0,0 +1,41 @@ +#!/usr/bin/python3 +# -*- Mode: Python; indent-tabs-mode: nil; tab-width: 4; coding: utf-8 -*- + +import os +import subprocess +import unittest + + +class TestPyflakesClean(unittest.TestCase): + + EXCLUDES = ["build", "tests/old"] + TOPLEVEL = os.path.normpath( + os.path.join(os.path.dirname(os.path.abspath(__file__)), "..")) + + def is_excluded_path(self, path): + for exclude in self.EXCLUDES: + if path.startswith(os.path.join(self.TOPLEVEL, exclude)): + return True + return False + + def get_py_files(self, toplevel): + files = [] + for path, dirnames, filenames in os.walk(self.TOPLEVEL): + if self.is_excluded_path(path): + continue + for filename in filenames: + if os.path.splitext(filename)[1] == ".py": + files.append(os.path.join(path, filename)) + return files + + def test_pyflakes_clean(self): + cmd = ["pyflakes"] + self.get_py_files(self.TOPLEVEL) + res = subprocess.call(cmd) + if res != 0: + self.fail("pyflakes failed with: %s" % res) + + +if __name__ == "__main__": + import logging + logging.basicConfig(level=logging.DEBUG) + unittest.main() -- cgit v1.2.3 From f861cb59ee7682ae65f5d0743d07b093143e1baa Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Tue, 31 Dec 2013 22:34:54 +0100 Subject: add new pep8,pyflakes dependencies --- debian/control | 4 +++- debian/tests/control | 2 +- po/python-apt.pot | 4 ++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/debian/control b/debian/control index 8c2f2ce7..f4f52119 100644 --- a/debian/control +++ b/debian/control @@ -18,7 +18,9 @@ Build-Depends: apt (>= 0.9.6), python-distutils-extra (>= 2.0), python-sphinx (>= 0.5), python-debian, - python-unittest2 + python-unittest2, + pep8, + pyflakes Vcs-Git: git://anonscm.debian.org/apt/python-apt.git Vcs-Browser: http://anonscm.debian.org/gitweb/?p=apt/python-apt.git XS-Testsuite: autopkgtest diff --git a/debian/tests/control b/debian/tests/control index 2ca0a401..bdca7d61 100644 --- a/debian/tests/control +++ b/debian/tests/control @@ -1,2 +1,2 @@ Tests: run-tests -Depends: @, apt-utils, python-debian, fakeroot, intltool +Depends: @, apt-utils, python-debian, fakeroot, intltool, pep8, pyflakes diff --git a/po/python-apt.pot b/po/python-apt.pot index 15f78b42..2d4f8250 100644 --- a/po/python-apt.pot +++ b/po/python-apt.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2013-10-23 20:26+0200\n" +"POT-Creation-Date: 2013-12-31 22:31+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -661,6 +661,6 @@ msgstr "" msgid "Please insert a Disc in the drive and press enter" msgstr "" -#: ../apt/cache.py:160 +#: ../apt/cache.py:164 msgid "Building data structures" msgstr "" -- cgit v1.2.3 From eac4d047d8774def55b03cb82d505d237d93ea55 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Tue, 31 Dec 2013 21:55:40 +0100 Subject: add .travis.yml & update python3 dependency to 3.3 This patch adds support for the travis-ci.org CI system. The "C" environment in .travis.yml is used to avoid having PPA python versions installed in the travis chroot. python3.3 is needed so that test_paths.py runs The tests_paths.py will only work with python3.3 as it uses the u"" prefix --- .travis.yml | 19 +++++++++++++++++++ debian/control | 6 +++--- po/python-apt.pot | 57 ++++++++++++++++++++++++++----------------------------- 3 files changed, 49 insertions(+), 33 deletions(-) create mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 00000000..832b69e2 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,19 @@ +# This provides integration into the travis-ci.org CI system. For a overview +# check http://about.travis-ci.org/docs/user/getting-started/ +# +# Some notes: +# - language is "C" because the travis chroot for python installs a non-repo +# python3.3 from a PPA +# - we need to add the current stable ubuntu (or even the current development +# ubuntu because we need a recent version of apt to build the python-apt +# - we use ubuntu instead of debian because the travis chroot is ubuntu based +# - ./debian/rules build-arch will build the package and run the tests +language: c +before_install: + - sudo apt-get update -q + - sudo apt-get install distro-info + - echo "deb http://archive.ubuntu.com/ubuntu $(distro-info --stable) main"|sudo tee -a /etc/apt/sources.list.d/added.list + - sudo apt-get update -q + - sudo apt-get install -q --no-install-recommends gdebi-core + - sudo apt-get install -q build-essential $(gdebi -q --apt-line ./debian/control) +script: ./debian/rules build-arch diff --git a/debian/control b/debian/control index f4f52119..8fdb3941 100644 --- a/debian/control +++ b/debian/control @@ -5,7 +5,7 @@ Maintainer: APT Development Team Uploaders: Michael Vogt , Julian Andres Klode Standards-Version: 3.9.4 XS-Python-Version: >= 2.6 -X-Python3-Version: >= 3.1 +X-Python3-Version: >= 3.3 Build-Depends: apt (>= 0.9.6), apt-utils, debhelper (>= 9), @@ -13,8 +13,8 @@ Build-Depends: apt (>= 0.9.6), libapt-pkg-dev (>= 0.8.11), python-all-dev (>= 2.6.6-3~), python-all-dbg, - python3-all-dev (>= 3.1.2-10~), - python3-all-dbg (>= 3.1.2-6~), + python3-all-dev (>= 3.3), + python3-all-dbg (>= 3.3), python-distutils-extra (>= 2.0), python-sphinx (>= 0.5), python-debian, diff --git a/po/python-apt.pot b/po/python-apt.pot index 2d4f8250..8d8b1261 100644 --- a/po/python-apt.pot +++ b/po/python-apt.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2013-12-31 22:31+0100\n" +"POT-Creation-Date: 2014-01-01 09:20+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -465,7 +465,7 @@ msgid "Non-DFSG-compatible Software" msgstr "" #. TRANSLATORS: %s is a country -#: ../aptsources/distro.py:211 ../aptsources/distro.py:441 +#: ../aptsources/distro.py:211 ../aptsources/distro.py:442 #, python-format msgid "Server for %s" msgstr "" @@ -505,16 +505,16 @@ msgstr "" msgid "Complete" msgstr "" -#: ../apt/package.py:337 +#: ../apt/package.py:328 #, python-format msgid "Invalid unicode in description for '%s' (%s). Please report." msgstr "" -#: ../apt/package.py:910 ../apt/package.py:1016 +#: ../apt/package.py:901 ../apt/package.py:1007 msgid "The list of changes is not available" msgstr "" -#: ../apt/package.py:1022 +#: ../apt/package.py:1013 #, python-format msgid "" "The list of changes is not available yet.\n" @@ -523,94 +523,91 @@ msgid "" "until the changes become available or try again later." msgstr "" -#: ../apt/package.py:1029 +#: ../apt/package.py:1020 msgid "" "Failed to download the list of changes. \n" "Please check your Internet connection." msgstr "" -#: ../apt/debfile.py:85 +#: ../apt/debfile.py:87 #, python-format msgid "List of files for '%s' could not be read" msgstr "" -#: ../apt/debfile.py:96 +#: ../apt/debfile.py:99 #, python-format msgid "List of control files for '%s' could not be read" msgstr "" -#: ../apt/debfile.py:217 +#: ../apt/debfile.py:224 #, python-format msgid "Dependency is not satisfiable: %s\n" msgstr "" -#: ../apt/debfile.py:238 +#: ../apt/debfile.py:247 #, python-format msgid "Conflicts with the installed package '%s'" msgstr "" -#. TRANSLATORS: the first '%s' is the package that breaks, the second the dependency that makes it break, the third the relation (e.g. >=) and the latest the version for the releation -#: ../apt/debfile.py:379 +#: ../apt/debfile.py:394 #, python-format msgid "" "Breaks existing package '%(pkgname)s' dependency %(depname)s " "(%(deprelation)s %(depversion)s)" msgstr "" -#. TRANSLATORS: the first '%s' is the package that conflicts, the second the packagename that it conflicts with (so the name of the deb the user tries to install), the third is the relation (e.g. >=) and the last is the version for the relation -#: ../apt/debfile.py:395 +#: ../apt/debfile.py:421 #, python-format msgid "" "Breaks existing package '%(pkgname)s' conflict: %(targetpkg)s (%(comptype)s " "%(targetver)s)" msgstr "" -#: ../apt/debfile.py:405 +#: ../apt/debfile.py:435 #, python-format msgid "" "Breaks existing package '%(pkgname)s' that conflict: '%(targetpkg)s'. But " "the '%(debfile)s' provides it via: '%(provides)s'" msgstr "" -#: ../apt/debfile.py:453 +#: ../apt/debfile.py:486 msgid "No Architecture field in the package" msgstr "" -#: ../apt/debfile.py:463 +#: ../apt/debfile.py:496 #, python-format msgid "Wrong architecture '%s'" msgstr "" -#. the deb is older than the installed -#: ../apt/debfile.py:470 +#: ../apt/debfile.py:504 msgid "A later version is already installed" msgstr "" -#: ../apt/debfile.py:495 +#: ../apt/debfile.py:529 msgid "Failed to satisfy all dependencies (broken cache)" msgstr "" -#: ../apt/debfile.py:525 +#: ../apt/debfile.py:558 #, python-format msgid "Cannot install '%s'" msgstr "" -#: ../apt/debfile.py:599 +#: ../apt/debfile.py:634 msgid "" "Automatically decompressed:\n" "\n" msgstr "" -#: ../apt/debfile.py:605 +#: ../apt/debfile.py:640 msgid "Automatically converted to printable ascii:\n" msgstr "" -#: ../apt/debfile.py:695 +#: ../apt/debfile.py:731 #, python-format msgid "Install Build-Dependencies for source package '%s' that builds %s\n" msgstr "" -#: ../apt/debfile.py:706 +#: ../apt/debfile.py:742 msgid "An essential package would be removed" msgstr "" @@ -635,11 +632,11 @@ msgstr "" msgid "Get:" msgstr "" -#: ../apt/progress/text.py:203 +#: ../apt/progress/text.py:204 msgid " [Working]" msgstr "" -#: ../apt/progress/text.py:214 +#: ../apt/progress/text.py:215 #, python-format msgid "" "Media change: please insert the disc labeled\n" @@ -648,16 +645,16 @@ msgid "" msgstr "" #. Trick for getting a translation from apt -#: ../apt/progress/text.py:223 +#: ../apt/progress/text.py:224 #, python-format msgid "Fetched %sB in %s (%sB/s)\n" msgstr "" -#: ../apt/progress/text.py:239 +#: ../apt/progress/text.py:240 msgid "Please provide a name for this Disc, such as 'Debian 2.1r1 Disk 1'" msgstr "" -#: ../apt/progress/text.py:255 +#: ../apt/progress/text.py:256 msgid "Please insert a Disc in the drive and press enter" msgstr "" -- cgit v1.2.3 From e3c26754af1891d2c50993730467fc9335ec5f09 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Tue, 31 Dec 2013 23:18:43 +0100 Subject: make pyflakes clean --- apt/__init__.py | 2 ++ apt/auth.py | 1 - apt/debfile.py | 1 + apt/progress/__init__.py | 1 - doc/examples/acquire.py | 3 ++- doc/examples/progress.py | 1 + doc/source/conf.py | 1 + tests/test_aptsources.py | 2 -- tests/test_aptsources_ports.py | 1 - tests/test_cache_invocation.py | 1 + tests/test_debfile.py | 11 ++--------- tests/test_debfile_multiarch.py | 2 -- tests/test_lp659438.py | 2 +- tests/test_paths.py | 1 - tests/test_progress.py | 2 +- tests/test_utils.py | 4 ---- utils/get_ubuntu_mirrors.py | 2 -- utils/get_ubuntu_mirrors_from_lp.py | 1 - 18 files changed, 12 insertions(+), 27 deletions(-) diff --git a/apt/__init__.py b/apt/__init__.py index 7b04befb..c4e78ba0 100644 --- a/apt/__init__.py +++ b/apt/__init__.py @@ -23,6 +23,8 @@ import apt_pkg # import some fancy classes from apt.package import Package from apt.cache import Cache, ProblemResolver +Cache # pyflakes +ProblemResolver # pyflakes from apt.cdrom import Cdrom # init the package system, but do not re-initialize config diff --git a/apt/auth.py b/apt/auth.py index c1b8da2a..d5a66b4a 100644 --- a/apt/auth.py +++ b/apt/auth.py @@ -24,7 +24,6 @@ # USA """Handle GnuPG keys used to trust signed repositories.""" -import atexit import os import os.path import shutil diff --git a/apt/debfile.py b/apt/debfile.py index 7f9cf9fc..c845b1f2 100644 --- a/apt/debfile.py +++ b/apt/debfile.py @@ -508,6 +508,7 @@ class DebPackage(object): # turn off MarkAndSweep via a action group (if available) try: _actiongroup = apt_pkg.ActionGroup(self._cache._depcache) + _actiongroup # pyflakes except AttributeError: pass # check depends diff --git a/apt/progress/__init__.py b/apt/progress/__init__.py index 00dc768f..776a7034 100644 --- a/apt/progress/__init__.py +++ b/apt/progress/__init__.py @@ -22,7 +22,6 @@ This package provides progress reporting for the python-apt package. The module 'base' provides classes with no output, the module 'gtk2' provides classes for GTK+ applications, and the module 'text' provides classes for terminals, etc. """ -import apt_pkg __all__ = [] diff --git a/doc/examples/acquire.py b/doc/examples/acquire.py index c2db8327..7381ad68 100644 --- a/doc/examples/acquire.py +++ b/doc/examples/acquire.py @@ -9,6 +9,7 @@ def get_file(fetcher, uri, destfile): # get the file af = apt_pkg.AcquireFile(fetcher, uri=uri, descr="sample descr", destfile=destfile) + print "desc_uri: %s -> %s" % (af.desc_uri, af.destfile) res = fetcher.run() if res != fetcher.RESULT_CONTINUE: return False @@ -45,7 +46,7 @@ except OSError: pass apt_pkg.config.set("Dir::Cache::archives", "/tmp/pyapt-test") -pkg = cache["3ddesktop"] +pkg = cache["2vcard"] depcache.mark_install(pkg) progress = apt.progress.text.AcquireProgress() diff --git a/doc/examples/progress.py b/doc/examples/progress.py index 77985a51..d7c4fad8 100644 --- a/doc/examples/progress.py +++ b/doc/examples/progress.py @@ -98,6 +98,7 @@ class TextCdromProgress(apt.progress.base.CdromProgress): def change_cdrom(self): print "Please insert cdrom and press " answer = sys.stdin.readline() + print answer return True diff --git a/doc/source/conf.py b/doc/source/conf.py index bdf0579b..163f5074 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -26,6 +26,7 @@ if os.path.exists("../../build"): sys.path.insert(0, os.path.abspath(os.path.dirname(apt_pkg_path))) try: import apt_pkg + apt_pkg # pyflakes except ImportError as exc: # Not the correct version sys.stderr.write('W: Ignoring error %s\n' % exc) diff --git a/tests/test_aptsources.py b/tests/test_aptsources.py index 5a174f3b..0b74cb79 100644 --- a/tests/test_aptsources.py +++ b/tests/test_aptsources.py @@ -140,7 +140,6 @@ class TestAptSources(unittest.TestCase): distro = aptsources.distro.get_distro(id="Ubuntu") distro.get_sources(sources) # test if all suits of the current distro were detected correctly - dist_templates = set() for s in sources: if not s.template: self.fail("source entry '%s' has no matcher" % s) @@ -178,7 +177,6 @@ class TestAptSources(unittest.TestCase): assert sources.list[9].line.strip() == str(sources.list[9]) def test_enable_component(self): - from subprocess import Popen, PIPE target = "./data/aptsources/sources.list.enable_comps" line = "deb http://archive.ubuntu.com/ubuntu lucid main\n" with open(target, "w") as target_file: diff --git a/tests/test_aptsources_ports.py b/tests/test_aptsources_ports.py index 67c21b9c..b625b8c4 100644 --- a/tests/test_aptsources_ports.py +++ b/tests/test_aptsources_ports.py @@ -31,7 +31,6 @@ class TestAptSourcesPorts(unittest.TestCase): "8.04") distro.get_sources(sources) # test if all suits of the current distro were detected correctly - dist_templates = set() for s in sources: if not s.line.strip() or s.line.startswith("#"): continue diff --git a/tests/test_cache_invocation.py b/tests/test_cache_invocation.py index a89ef557..4bba0813 100644 --- a/tests/test_cache_invocation.py +++ b/tests/test_cache_invocation.py @@ -25,6 +25,7 @@ class TestCache(unittest.TestCase): """cache_invocation: Test correct invocation.""" apt_cache = apt_pkg.Cache(progress=None) apt_depcache = apt_pkg.DepCache(apt_cache) + self.assertNotEqual(apt_depcache, None) if __name__ == "__main__": unittest.main() diff --git a/tests/test_debfile.py b/tests/test_debfile.py index 3e933944..9379884a 100644 --- a/tests/test_debfile.py +++ b/tests/test_debfile.py @@ -123,15 +123,8 @@ Description: testpackage for gdebi - contains usr/bin/binary for file reading deb.missing_deps def test_no_supported_data_tar(self): - # ensure that a unknown data.tar.xxx raises a exception - raised = False - try: - deb = apt.debfile.DebPackage("./data/test_debs/data-tar-broken.deb") - except SystemError: - raised = True - # with self.assertRaises(SystemError): is more elegant above, but - # we need to support python2.6 - self.assertTrue(raised) + with self.assertRaises(SystemError): + apt.debfile.DebPackage("./data/test_debs/data-tar-broken.deb") def test_contains(self): deb = apt.debfile.DebPackage("./data/test_debs/data-tar-xz.deb") diff --git a/tests/test_debfile_multiarch.py b/tests/test_debfile_multiarch.py index bbf62016..cf6479b1 100644 --- a/tests/test_debfile_multiarch.py +++ b/tests/test_debfile_multiarch.py @@ -7,8 +7,6 @@ # are permitted in any medium without royalty provided the copyright # notice and this notice are preserved. """Unit tests for verifying the correctness of DebPackage in apt.debfile.""" -import os -import logging import unittest from test_all import get_library_dir diff --git a/tests/test_lp659438.py b/tests/test_lp659438.py index b9a837b4..334f574d 100644 --- a/tests/test_lp659438.py +++ b/tests/test_lp659438.py @@ -63,7 +63,7 @@ Architecture: all""") def tearDown(self): # this resets the rootdir apt_pkg.config to ensure it does not # "pollute" the later tests - cache = apt.cache.Cache(rootdir="/") + apt.cache.Cache(rootdir="/") shutil.rmtree(self.chroot_path) def test_survive_reqreinst(self): diff --git a/tests/test_paths.py b/tests/test_paths.py index 17f562d2..48f86c52 100644 --- a/tests/test_paths.py +++ b/tests/test_paths.py @@ -3,7 +3,6 @@ # import os import shutil -import tempfile import unittest import apt_inst diff --git a/tests/test_progress.py b/tests/test_progress.py index e4a5fa3c..508da7d4 100644 --- a/tests/test_progress.py +++ b/tests/test_progress.py @@ -44,7 +44,7 @@ class TestProgress(unittest.TestCase): def test_acquire_progress(self): progress = TestAcquireProgress() cache = apt.Cache() - res = cache.update(progress) + cache.update(progress) self.assertTrue(progress.pulsed) if __name__ == "__main__": diff --git a/tests/test_utils.py b/tests/test_utils.py index 2676bb98..35c0a466 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -8,12 +8,8 @@ import datetime import os -import sys import unittest -import apt_pkg -import apt.utils - from apt.utils import ( get_maintenance_end_date, get_release_date_from_release_file, diff --git a/utils/get_ubuntu_mirrors.py b/utils/get_ubuntu_mirrors.py index ddd1e369..cf509088 100755 --- a/utils/get_ubuntu_mirrors.py +++ b/utils/get_ubuntu_mirrors.py @@ -26,8 +26,6 @@ import urllib2 import re -import os -import commands import sys # the list of official Ubuntu servers diff --git a/utils/get_ubuntu_mirrors_from_lp.py b/utils/get_ubuntu_mirrors_from_lp.py index 7c4d3831..6ff2d885 100755 --- a/utils/get_ubuntu_mirrors_from_lp.py +++ b/utils/get_ubuntu_mirrors_from_lp.py @@ -25,7 +25,6 @@ # USA import feedparser -import sys d = feedparser.parse("https://launchpad.net/ubuntu/+archivemirrors-rss") #d = feedparser.parse(open("+archivemirrors-rss")) -- cgit v1.2.3 From 3bf9c3fe4d19ed4d985dc8b7747a737699f46a7e Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Tue, 31 Dec 2013 23:25:13 +0100 Subject: make test_pep8.py pass --- apt/auth.py | 39 +++++---- apt/debfile.py | 148 ++++++++++++++++++++++------------- apt/package.py | 12 +-- apt/progress/gtk2.py | 8 +- apt/progress/text.py | 9 ++- apt/utils.py | 2 +- aptsources/distinfo.py | 11 ++- aptsources/distro.py | 45 +++++------ aptsources/sourceslist.py | 38 ++++----- doc/examples/acquire.py | 7 +- doc/examples/action.py | 2 +- doc/examples/architecture.py | 2 +- doc/examples/build-deps-old.py | 2 +- doc/examples/checkstate.py | 4 +- doc/examples/deb_inspect.py | 4 +- doc/examples/depcache.py | 2 +- doc/examples/inst.py | 2 +- doc/examples/progress.py | 9 ++- doc/examples/sources.py | 2 +- doc/source/conf.py | 9 +-- doc/source/examples/cache-pkgfile.py | 2 +- setup.py | 16 ++-- tests/old/__init__.py | 1 - tests/old/cache.py | 4 +- tests/old/depcache.py | 6 +- tests/old/pkgproblemresolver.py | 6 +- tests/old/pkgrecords.py | 2 +- tests/old/pkgsrcrecords.py | 2 +- tests/old/refcount.py | 5 +- tests/test_all.py | 9 ++- tests/test_apt_cache.py | 43 +++++----- tests/test_aptsources.py | 12 ++- tests/test_auth.py | 11 ++- tests/test_configuration.py | 5 +- tests/test_debfile.py | 30 ++++--- tests/test_debfile_multiarch.py | 7 +- tests/test_group.py | 1 - tests/test_hashes.py | 2 +- tests/test_lp659438.py | 2 +- tests/test_paths.py | 10 ++- tests/test_pep8.py | 2 +- tests/test_policy.py | 2 +- tests/test_progress.py | 5 +- tests/test_size_to_str.py | 136 ++++++++++++++++---------------- tests/test_tagfile.py | 1 + tests/test_utils.py | 22 ++++-- utils/doclint.py | 21 +++-- utils/get_ubuntu_mirrors.py | 2 +- 48 files changed, 399 insertions(+), 325 deletions(-) diff --git a/apt/auth.py b/apt/auth.py index d5a66b4a..acc612a9 100644 --- a/apt/auth.py +++ b/apt/auth.py @@ -67,7 +67,8 @@ def _call_apt_key_script(*args, **kwargs): # configuration from the chroot to the apt-key script by using # a temporary APT_CONFIG file. The apt-key script uses apt-config # shell internally - conf = tempfile.NamedTemporaryFile(prefix="apt-key", suffix=".conf") + conf = tempfile.NamedTemporaryFile( + prefix="apt-key", suffix=".conf") conf.write(apt_pkg.config.dump().encode("UTF-8")) conf.flush() env["APT_CONFIG"] = conf.name @@ -84,11 +85,12 @@ def _call_apt_key_script(*args, **kwargs): output, stderr = proc.communicate(content) if proc.returncode: - raise AptKeyError("The apt-key script failed with return code %s:\n" - "%s\n" - "stdout: %s\n" - "stderr: %s" % (proc.returncode, " ".join(cmd), - output,stderr)) + raise AptKeyError( + "The apt-key script failed with return code %s:\n" + "%s\n" + "stdout: %s\n" + "stderr: %s" % ( + proc.returncode, " ".join(cmd), output, stderr)) elif stderr: sys.stderr.write(stderr) # Forward stderr @@ -97,6 +99,7 @@ def _call_apt_key_script(*args, **kwargs): if conf is not None: conf.close() + def add_key_from_file(filename): """Import a GnuPG key file to trust repositores signed by it. @@ -109,6 +112,7 @@ def add_key_from_file(filename): raise AptKeyError("Key file cannot be accessed: %s" % filename) _call_apt_key_script("add", filename) + def add_key_from_keyserver(keyid, keyserver): """Import a GnuPG key file to trust repositores signed by it. @@ -125,8 +129,9 @@ def add_key_from_keyserver(keyid, keyserver): finally: shutil.rmtree(tmp_keyring_dir) + def _add_key_from_keyserver(keyid, keyserver, tmp_keyring_dir): - if len(keyid) < 160/8: + if len(keyid) < (160 / 8): raise AptKeyError("Only long keyids (v4, 160bit) are supported") # create a temp keyring dir tmp_secret_keyring = os.path.join(tmp_keyring_dir, "secring.gpg") @@ -136,14 +141,14 @@ def _add_key_from_keyserver(keyid, keyserver, tmp_keyring_dir): "gpg", "--no-default-keyring", "--no-options", "--homedir", tmp_keyring_dir, - ] + ] # download the key to a temp keyring first res = subprocess.call(gpg_default_options + [ "--secret-keyring", tmp_secret_keyring, "--keyring", tmp_keyring, "--keyserver", keyserver, "--recv", keyid, - ]) + ]) if res != 0: raise AptKeyError("recv from '%s' failed for '%s'" % ( keyserver, keyid)) @@ -154,7 +159,7 @@ def _add_key_from_keyserver(keyid, keyserver, tmp_keyring_dir): "--keyring", tmp_keyring, "--output", tmp_export_keyring, "--export", keyid, - ]) + ]) if res != 0: raise AptKeyError("export of '%s' failed", keyid) # now verify the fingerprint, this is probably redundant as we @@ -166,10 +171,10 @@ def _add_key_from_keyserver(keyid, keyserver, tmp_keyring_dir): "--fingerprint", "--batch", "--with-colons", - ], - stdout=subprocess.PIPE, - universal_newlines=True).communicate()[0] - got_fingerprint=None + ], + stdout=subprocess.PIPE, + universal_newlines=True).communicate()[0] + got_fingerprint = None for line in output.splitlines(): if line.startswith("fpr:"): got_fingerprint = line.split(":")[9] @@ -185,6 +190,7 @@ def _add_key_from_keyserver(keyid, keyserver, tmp_keyring_dir): # finally add it add_key_from_file(tmp_export_keyring) + def add_key(content): """Import a GnuPG key to trust repositores signed by it. @@ -194,6 +200,7 @@ def add_key(content): _call_apt_key_script("adv", "--quiet", "--batch", "--import", "-", stdin=content) + def remove_key(fingerprint): """Remove a GnuPG key to no longer trust repositores signed by it. @@ -202,6 +209,7 @@ def remove_key(fingerprint): """ _call_apt_key_script("rm", fingerprint) + def export_key(fingerprint): """Return the GnuPG key in text format. @@ -210,6 +218,7 @@ def export_key(fingerprint): """ return _call_apt_key_script("export", fingerprint) + def update(): """Update the local keyring with the archive keyring and remove from the local keyring the archive keys which are no longer valid. The @@ -218,6 +227,7 @@ def update(): """ return _call_apt_key_script("update") + def net_update(): """Work similar to the update command above, but get the archive keyring from an URI instead and validate it against a master key. @@ -228,6 +238,7 @@ def net_update(): """ return _call_apt_key_script("net-update") + def list_keys(): """Returns a list of TrustedKey instances for each key which is used to trust repositories. diff --git a/apt/debfile.py b/apt/debfile.py index c845b1f2..679c8468 100644 --- a/apt/debfile.py +++ b/apt/debfile.py @@ -27,17 +27,19 @@ import sys from apt_pkg import gettext as _ from StringIO import StringIO + class NoDebArchiveException(IOError): """Exception which is raised if a file is no Debian archive.""" + class DebPackage(object): """A Debian Package (.deb file).""" # Constants for comparing the local package file with the version # in the cache - (VERSION_NONE, - VERSION_OUTDATED, - VERSION_SAME, + (VERSION_NONE, + VERSION_OUTDATED, + VERSION_SAME, VERSION_NEWER) = range(4) debug = 0 @@ -68,7 +70,7 @@ class DebPackage(object): self._sections = apt_pkg.TagSection(control) self.pkgname = self._sections["Package"] self._check_was_run = False - + def __getitem__(self, key): return self._sections[key] @@ -91,15 +93,15 @@ class DebPackage(object): """ return the list of files in control.tar.gt """ control = [] try: - self._debfile.control.go(lambda item, data: control.append(item.name)) + self._debfile.control.go( + lambda item, data: control.append(item.name)) except SystemError: return [_("List of control files for '%s' could not be read") % self.filename] return sorted(control) - # helper that will return a pkgname with a multiarch suffix if needed - def _maybe_append_multiarch_suffix(self, pkgname, + def _maybe_append_multiarch_suffix(self, pkgname, in_conflict_checking=False): # trivial cases if ":" in pkgname: @@ -108,7 +110,7 @@ class DebPackage(object): return pkgname elif self._cache.is_virtual_package(pkgname): return pkgname - elif (pkgname in self._cache and + elif (pkgname in self._cache and self._cache[pkgname].candidate and self._cache[pkgname].candidate.architecture == "all"): return pkgname @@ -126,7 +128,7 @@ class DebPackage(object): return pkgname # for conflicts we need a special case here, any not multiarch enabled # package has a implicit conflict - if (in_conflict_checking and + if (in_conflict_checking and not (cand.multi_arch & cand.MULTI_ARCH_SAME)): return pkgname return multiarch_pkgname @@ -150,7 +152,9 @@ class DebPackage(object): # check for virtual pkgs if not depname in self._cache: if self._cache.is_virtual_package(depname): - self._dbg(3, "_is_or_group_satisfied(): %s is virtual dep" % depname) + self._dbg( + 3, "_is_or_group_satisfied(): %s is virtual dep" % + depname) for pkg in self._cache.get_providing_packages(depname): if pkg.is_installed: return True @@ -163,13 +167,15 @@ class DebPackage(object): # if no real dependency is installed, check if there is # a package installed that provides this dependency # (e.g. scrollkeeper dependecies are provided by rarian-compat) - # but only do that if there is no version required in the + # but only do that if there is no version required in the # dependency (we do not supprot versionized dependencies) if not oper: for ppkg in self._cache.get_providing_packages( depname, include_nonvirtual=True): if ppkg.is_installed: - self._dbg(3, "found installed '%s' that provides '%s'" % (ppkg.name, depname)) + self._dbg( + 3, "found installed '%s' that provides '%s'" % ( + ppkg.name, depname)) return True return False @@ -212,16 +218,19 @@ class DebPackage(object): or_str += dep[0] if ver and oper: or_str += " (%s %s)" % (dep[2], dep[1]) - if dep != or_group[len(or_group)-1]: + if dep != or_group[len(or_group) - 1]: or_str += "|" - self._failure_string += _("Dependency is not satisfiable: %s\n") % or_str + self._failure_string += _( + "Dependency is not satisfiable: %s\n") % or_str return False def _check_single_pkg_conflict(self, pkgname, ver, oper): """Return True if a pkg conflicts with a real installed/marked pkg.""" # FIXME: deal with conflicts against its own provides # (e.g. Provides: ftp-server, Conflicts: ftp-server) - self._dbg(3, "_check_single_pkg_conflict() pkg='%s' ver='%s' oper='%s'" % (pkgname, ver, oper)) + self._dbg( + 3, "_check_single_pkg_conflict() pkg='%s' ver='%s' oper='%s'" % ( + pkgname, ver, oper)) pkg = self._cache[pkgname] if pkg.is_installed: pkgver = pkg.installed.version @@ -265,8 +274,8 @@ class DebPackage(object): if self.pkgname == pkg.name: self._dbg(3, "conflict on self, ignoring") continue - if self._check_single_pkg_conflict(pkg.name, ver, - oper): + if self._check_single_pkg_conflict( + pkg.name, ver, oper): self._installed_conflicts.add(pkg.name) continue if self._check_single_pkg_conflict(depname, ver, oper): @@ -289,7 +298,8 @@ class DebPackage(object): # find depends for key in "Depends", "Pre-Depends": try: - depends.extend(apt_pkg.parse_depends(self._sections[key], False)) + depends.extend( + apt_pkg.parse_depends(self._sections[key], False)) except KeyError: pass return depends @@ -349,22 +359,22 @@ class DebPackage(object): return res def check_breaks_existing_packages(self): - """ - check if installing the package would break exsisting + """ + check if installing the package would break exsisting package on the system, e.g. system has: smc depends on smc-data (= 1.4) and user tries to installs smc-data 1.6 """ # show progress information as this step may take some time size = float(len(self._cache)) - steps = max(int(size/50), 1) + steps = max(int(size / 50), 1) debver = self._sections["Version"] debarch = self._sections["Architecture"] # store what we provide so that we can later check against that - provides = [ x[0][0] for x in self.provides] + provides = [x[0][0] for x in self.provides] for (i, pkg) in enumerate(self._cache): - if i%steps == 0: - self._cache.op_progress.update(float(i)/size*100.0) + if i % steps == 0: + self._cache.op_progress.update(float(i) / size * 100.0) if not pkg.is_installed: continue # check if the exising dependencies are still satisfied @@ -373,14 +383,21 @@ class DebPackage(object): for dep_or in pkg.installed.dependencies: for dep in dep_or.or_dependencies: if dep.name == self.pkgname: - if not apt_pkg.check_dep(debver, dep.relation, dep.version): + if not apt_pkg.check_dep( + debver, dep.relation, dep.version): self._dbg(2, "would break (depends) %s" % pkg.name) - # TRANSLATORS: the first '%s' is the package that breaks, the second the dependency that makes it break, the third the relation (e.g. >=) and the latest the version for the releation - self._failure_string += _("Breaks existing package '%(pkgname)s' dependency %(depname)s (%(deprelation)s %(depversion)s)") % { - 'pkgname' : pkg.name, - 'depname' : dep.name, - 'deprelation' : dep.relation, - 'depversion' : dep.version} + # TRANSLATORS: the first '%s' is the package that + # breaks, the second the dependency that makes it + # break, the third the relation (e.g. >=) and the + # latest the version for the releation + self._failure_string += _( + "Breaks existing package '%(pkgname)s' " + "dependency %(depname)s " + "(%(deprelation)s %(depversion)s)") % { + 'pkgname': pkg.name, + 'depname': dep.name, + 'deprelation': dep.relation, + 'depversion': dep.version} self._cache.op_progress.done() return False # now check if there are conflicts against this package on @@ -388,25 +405,41 @@ class DebPackage(object): if "Conflicts" in ver.depends_list: for conflicts_ver_list in ver.depends_list["Conflicts"]: for c_or in conflicts_ver_list: - if c_or.target_pkg.name == self.pkgname and c_or.target_pkg.architecture == debarch: - if apt_pkg.check_dep(debver, c_or.comp_type, c_or.target_ver): - self._dbg(2, "would break (conflicts) %s" % pkg.name) - # TRANSLATORS: the first '%s' is the package that conflicts, the second the packagename that it conflicts with (so the name of the deb the user tries to install), the third is the relation (e.g. >=) and the last is the version for the relation - self._failure_string += _("Breaks existing package '%(pkgname)s' conflict: %(targetpkg)s (%(comptype)s %(targetver)s)") % { - 'pkgname' : pkg.name, - 'targetpkg' : c_or.target_pkg.name, - 'comptype' : c_or.comp_type, - 'targetver' : c_or.target_ver } + if (c_or.target_pkg.name == self.pkgname and + c_or.target_pkg.architecture == debarch): + if apt_pkg.check_dep( + debver, c_or.comp_type, c_or.target_ver): + self._dbg( + 2, "would break (conflicts) %s" % pkg.name) + # TRANSLATORS: the first '%s' is the package + # that conflicts, the second the packagename + # that it conflicts with (so the name of the + # deb the user tries to install), the third is + # the relation (e.g. >=) and the last is the + # version for the relation + self._failure_string += _( + "Breaks existing package '%(pkgname)s' " + "conflict: %(targetpkg)s " + "(%(comptype)s %(targetver)s)") % { + 'pkgname': pkg.name, + 'targetpkg': c_or.target_pkg.name, + 'comptype': c_or.comp_type, + 'targetver': c_or.target_ver} self._cache.op_progress.done() return False if (c_or.target_pkg.name in provides and self.pkgname != pkg.name): - self._dbg(2, "would break (conflicts) %s" % provides) - self._failure_string += _("Breaks existing package '%(pkgname)s' that conflict: '%(targetpkg)s'. But the '%(debfile)s' provides it via: '%(provides)s'") % { - 'provides' : ",".join(provides), - 'debfile' : self.filename, - 'targetpkg' : c_or.target_pkg.name, - 'pkgname' : pkg.name } + self._dbg( + 2, "would break (conflicts) %s" % provides) + self._failure_string += _( + "Breaks existing package '%(pkgname)s' " + "that conflict: '%(targetpkg)s'. But the " + "'%(debfile)s' provides it via: " + "'%(provides)s'") % { + 'provides': ",".join(provides), + 'debfile': self.filename, + 'targetpkg': c_or.target_pkg.name, + 'pkgname': pkg.name} self._cache.op_progress.done() return False self._cache.op_progress.done() @@ -453,7 +486,7 @@ class DebPackage(object): self._failure_string = _("No Architecture field in the package") return False arch = self._sections["Architecture"] - if arch != "all" and arch != apt_pkg.config.find("APT::Architecture"): + if arch != "all" and arch != apt_pkg.config.find("APT::Architecture"): if arch in apt_pkg.get_architectures(): self._multiarch = arch self.pkgname = "%s:%s" % (self.pkgname, self._multiarch) @@ -467,7 +500,8 @@ class DebPackage(object): if self.compare_to_version_in_cache() == self.VERSION_OUTDATED: if self._cache[self.pkgname].installed: # the deb is older than the installed - self._failure_string = _("A later version is already installed") + self._failure_string = _( + "A later version is already installed") return False # FIXME: this sort of error handling sux @@ -477,7 +511,7 @@ class DebPackage(object): if not self.check_conflicts(): return False - # check if installing it would break anything on the + # check if installing it would break anything on the # current system if not self.check_breaks_existing_packages(): return False @@ -513,8 +547,6 @@ class DebPackage(object): pass # check depends for or_group in depends: - #print "or_group: %s" % or_group - #print "or_group satified: %s" % self._is_or_group_satisfied(or_group) if not self._is_or_group_satisfied(or_group): if not self._satisfy_or_group(or_group): return False @@ -533,7 +565,8 @@ class DebPackage(object): """Return missing dependencies.""" self._dbg(1, "Installing: %s" % self._need_pkgs) if not self._check_was_run: - raise AttributeError("property only available after check() was run") + raise AttributeError( + "property only available after check() was run") return self._need_pkgs @property @@ -546,7 +579,8 @@ class DebPackage(object): remove = [] unauthenticated = [] if not self._check_was_run: - raise AttributeError("property only available after check() was run") + raise AttributeError( + "property only available after check() was run") for pkg in self._cache: if pkg.marked_install or pkg.marked_upgrade: install.append(pkg.name) @@ -565,7 +599,7 @@ class DebPackage(object): def to_hex(in_data): hex = "" for (i, c) in enumerate(in_data): - if i%80 == 0: + if i % 80 == 0: hex += "\n" hex += "%2.2x " % ord(c) return hex @@ -588,7 +622,7 @@ class DebPackage(object): else: s += chr(b) return s - + def _get_content(self, part, name, auto_decompress=True, auto_hex=True): if name.startswith("./"): name = name[2:] @@ -643,6 +677,7 @@ class DebPackage(object): install_progress.finishUpdate() return res + class DscSrcPackage(DebPackage): """A locally available source package.""" @@ -698,7 +733,7 @@ class DscSrcPackage(DebPackage): " ".join(self.binaries)) self._sections["Description"] = s self._check_was_run = False - + def check(self): """Check if the package is installable..""" if not self.check_conflicts(): @@ -712,6 +747,7 @@ class DscSrcPackage(DebPackage): # after _satisfy_depends() should probably be done return self._satisfy_depends(self.depends) + def _test(): """Test function""" from apt.cache import Cache diff --git a/apt/package.py b/apt/package.py index 79dac71d..d4217195 100644 --- a/apt/package.py +++ b/apt/package.py @@ -26,16 +26,8 @@ import re import socket import subprocess import urllib2 -try: - from collections import Mapping, Sequence -except ImportError: - # (for Python < 2.6) pylint: disable-msg=C0103 - Sequence = Mapping = object - -try: - from collections import Sequence -except ImportError: - Sequence = object + +from collections import Mapping, Sequence import apt_pkg import apt.progress.text diff --git a/apt/progress/gtk2.py b/apt/progress/gtk2.py index 63e531fa..b978c34f 100644 --- a/apt/progress/gtk2.py +++ b/apt/progress/gtk2.py @@ -27,6 +27,7 @@ pygtk.require('2.0') import gtk try: import glib + glib # pyflakes except ImportError: import gobject as glib import gobject @@ -87,7 +88,6 @@ class GOpProgress(gobject.GObject, base.OpProgress): self.emit("status-finished") - class GInstallProgress(gobject.GObject, base.InstallProgress): """Installation progress with GObject signals. @@ -241,12 +241,12 @@ class GAcquireProgress(gobject.GObject, base.AcquireProgress): current_item = self.total_items if self.current_cps > 0: text = (_("Downloading file %(current)li of %(total)li with " - "%(speed)s/s") % \ + "%(speed)s/s") % {"current": current_item, "total": self.total_items, "speed": apt_pkg.size_to_str(self.current_cps)}) else: - text = (_("Downloading file %(current)li of %(total)li") % \ + text = (_("Downloading file %(current)li of %(total)li") % {"current": current_item, "total": self.total_items}) @@ -358,7 +358,7 @@ class GtkAptProgress(gtk.VBox): if percent is None or percent == -1: self._progressbar.pulse() else: - self._progressbar.set_fraction(percent/100.0) + self._progressbar.set_fraction(percent / 100.0) while gtk.events_pending(): gtk.main_iteration() diff --git a/apt/progress/text.py b/apt/progress/text.py index c5eec092..76a4309e 100644 --- a/apt/progress/text.py +++ b/apt/progress/text.py @@ -47,7 +47,7 @@ class TextProgress(object): # Fill remaining stuff with whitespace if self._width > len(msg): self._file.write((self._width - len(msg)) * ' ') - elif maximize: # Needed for OpProgress. + elif maximize: # Needed for OpProgress. self._width = max(self._width, len(msg)) if newline: self._file.write("\n") @@ -114,7 +114,7 @@ class AcquireProgress(base.AcquireProgress, TextProgress): import struct buf = fcntl.ioctl(self._file, termios.TIOCGWINSZ, 8 * ' ') dummy, col, dummy, dummy = struct.unpack('hhhh', buf) - self._width = col - 1 # 1 for the cursor + self._width = col - 1 # 1 for the cursor def ims_hit(self, item): """Called when an item is update (e.g. not modified on the server).""" @@ -188,8 +188,9 @@ class AcquireProgress(base.AcquireProgress, TextProgress): # Add the total size and percent if worker.total_size and not worker.current_item.owner.complete: - val += "/%sB %i%%" % (apt_pkg.size_to_str(worker.total_size), - worker.current_size*100.0/worker.total_size) + val += "/%sB %i%%" % ( + apt_pkg.size_to_str(worker.total_size), + worker.current_size * 100.0 / worker.total_size) val += ']' diff --git a/apt/utils.py b/apt/utils.py index 08140258..9451f4bc 100644 --- a/apt/utils.py +++ b/apt/utils.py @@ -32,7 +32,7 @@ def get_maintenance_end_date(release_date, m_months): years = m_months // 12 months = m_months % 12 support_end_year = (release_date.year + years + - (release_date.month + months)//12) + (release_date.month + months) // 12) support_end_month = (release_date.month + months) % 12 # special case: this happens when e.g. doing 2010-06 + 18 months if support_end_month == 0: diff --git a/aptsources/distinfo.py b/aptsources/distinfo.py index d80721e5..b03e68f8 100644 --- a/aptsources/distinfo.py +++ b/aptsources/distinfo.py @@ -33,6 +33,7 @@ import apt_pkg from apt_pkg import gettext as _ + class Template(object): def __init__(self): @@ -152,9 +153,7 @@ def split_url(url): class DistInfo(object): - def __init__(self, - dist = None, - base_dir = "/usr/share/python-apt/templates"): + def __init__(self, dist=None, base_dir="/usr/share/python-apt/templates"): self.metarelease_uri = '' self.templates = [] self.arch = apt_pkg.config.find("APT::Architecture") @@ -196,7 +195,7 @@ class DistInfo(object): self.metarelease_uri = value elif field == 'Suite': self.finish_template(template, component) - component=None + component = None template = Template() template.name = value template.distribution = dist @@ -265,8 +264,8 @@ class DistInfo(object): elif field == 'ParentComponent': component.set_parent_component(value) self.finish_template(template, component) - template=None - component=None + template = None + component = None def finish_template(self, template, component): " finish the current tempalte " diff --git a/aptsources/distro.py b/aptsources/distro.py index e9facbfb..a71d5af2 100644 --- a/aptsources/distro.py +++ b/aptsources/distro.py @@ -85,7 +85,7 @@ class Distribution(object): break if self.source_template is None: raise NoDistroTemplateException( - "Error: could not find a distribution template for %s/%s" % + "Error: could not find a distribution template for %s/%s" % (self.id, self.codename)) # find main and child sources @@ -95,40 +95,40 @@ class Distribution(object): enabled_comps = [] #source_code = [] for source in self.sourceslist.list: - if (source.invalid == False and + if (source.invalid is False and self.is_codename(source.dist) and source.template and - source.template.official == True and + source.template.official is True and self.is_codename(source.template.name)): #print "yeah! found a distro repo: %s" % source.line # cdroms need do be handled differently if (source.uri.startswith("cdrom:") and - source.disabled == False): + source.disabled is False): self.cdrom_sources.append(source) cdrom_comps.extend(source.comps) elif (source.uri.startswith("cdrom:") and - source.disabled == True): + source.disabled is True): self.cdrom_sources.append(source) elif (source.type == self.binary_type and - source.disabled == False): + source.disabled is False): self.main_sources.append(source) comps.extend(source.comps) media.append(source.uri) elif (source.type == self.binary_type and - source.disabled == True): + source.disabled is True): self.disabled_sources.append(source) elif (source.type == self.source_type - and source.disabled == False): + and source.disabled is False): self.source_code_sources.append(source) elif (source.type == self.source_type and - source.disabled == True): + source.disabled is True): self.disabled_sources.append(source) - if (source.invalid == False and + if (source.invalid is False and source.template in self.source_template.children): - if (source.disabled == False + if (source.disabled is False and source.type == self.binary_type): self.child_sources.append(source) - elif (source.disabled == False + elif (source.disabled is False and source.type == self.source_type): self.source_code_sources.append(source) else: @@ -189,7 +189,7 @@ class Distribution(object): z = locale.find(".") if z == -1: z = len(locale) - country_code = locale[a+1:z].lower() + country_code = locale[a + 1:z].lower() if mirror_template: self.nearest_server = mirror_template % country_code @@ -205,7 +205,7 @@ class Distribution(object): i = server.find("://") l = server.find(".archive.ubuntu.com") if i != -1 and l != -1: - country = server[i+len("://"):l] + country = server[i + len("://"):l] if country in self.countries: # TRANSLATORS: %s is a country return _("Server for %s") % self.countries[country] @@ -280,10 +280,11 @@ class Distribution(object): new_source = self.sourceslist.add(type, uri, dist, comps, comment) # if source code is enabled add a deb-src line after the new # source - if self.get_source_code == True and type == self.binary_type: - self.sourceslist.add(self.source_type, uri, dist, comps, comment, - file=new_source.file, - pos=self.sourceslist.list.index(new_source)+1) + if self.get_source_code is True and type == self.binary_type: + self.sourceslist.add( + self.source_type, uri, dist, comps, comment, + file=new_source.file, + pos=self.sourceslist.list.index(new_source) + 1) def enable_component(self, comp): """ @@ -344,7 +345,7 @@ class Distribution(object): # check if there is a main source at all if len(self.main_sources) < 1: # create a new main source - self.add_source(comps=["%s"%comp]) + self.add_source(comps=["%s" % comp]) else: # add the comp to all main, child and source code sources for source in sources: @@ -354,10 +355,10 @@ class Distribution(object): add_component_only_once(source, comps_per_sdist) # check if there is a main source code source at all - if self.get_source_code == True: + if self.get_source_code is True: if len(self.source_code_sources) < 1: # create a new main source - self.add_source(type=self.source_type, comps=["%s"%comp]) + self.add_source(type=self.source_type, comps=["%s" % comp]) else: # add the comp to all main, child and source code sources for source in self.source_code_sources: @@ -435,7 +436,7 @@ class DebianDistribution(Distribution): i = server.find("://ftp.") l = server.find(".debian.org") if i != -1 and l != -1: - country = server[i+len("://ftp."):l] + country = server[i + len("://ftp."):l] if country in self.countries: # TRANSLATORS: %s is a country return _("Server for %s") % gettext.dgettext( diff --git a/aptsources/sourceslist.py b/aptsources/sourceslist.py index 69e7e107..1b68d52e 100644 --- a/aptsources/sourceslist.py +++ b/aptsources/sourceslist.py @@ -62,12 +62,12 @@ def is_mirror(master_uri, compare_uri): compare_srv = compare_uri.split("//")[1] master_srv = master_uri.split("//")[1] #print "%s == %s " % (add_srv, orig_srv) - except IndexError: # ok, somethings wrong here + except IndexError: # ok, somethings wrong here #print "IndexError" return False # remove the leading "." (if any) and see if that helps if "." in compare_srv and \ - compare_srv[compare_srv.index(".")+1:] == master_srv: + compare_srv[compare_srv.index(".") + 1:] == master_srv: #print "Mirror" return True return False @@ -100,7 +100,7 @@ class SourceEntry(object): self.line = line # the original sources.list line if file is None: file = apt_pkg.config.find_dir( - "Dir::Etc")+apt_pkg.config.find("Dir::Etc::sourcelist") + "Dir::Etc") + apt_pkg.config.find("Dir::Etc::sourcelist") self.file = file # the file that the entry is located in self.parse(line) self.template = None # type DistInfo.Suite @@ -131,10 +131,10 @@ class SourceEntry(object): pieces.append(tmp) tmp = line[i] else: - p_found=True + p_found = True tmp += line[i] elif line[i] == "]": - p_found=False + p_found = False tmp += line[i] elif space_found and not line[i].isspace(): # we skip one or more space @@ -157,7 +157,7 @@ class SourceEntry(object): line = self.line.strip() #print line # check if the source is enabled/disabled - if line == "" or line == "#": # empty line + if line == "" or line == "#": # empty line self.invalid = True return if line[0] == "#": @@ -172,7 +172,7 @@ class SourceEntry(object): # check for another "#" in the line (this is treated as a comment) i = line.find("#") if i > 0: - self.comment = line[i+1:] + self.comment = line[i + 1:] line = line[:i] # source is ok, split it and see what we have pieces = self.mysplit(line) @@ -201,7 +201,7 @@ class SourceEntry(object): self.trusted = apt_pkg.string_to_bool(value) else: self.invalid = True - + # URI self.uri = pieces[1].strip() if len(self.uri) < 1: @@ -241,7 +241,8 @@ class SourceEntry(object): line += self.type if self.architectures and self.trusted is not None: - line += " [arch=%s trusted=%s]" % (",".join(self.architectures), "yes" if self.trusted else "no") + line += " [arch=%s trusted=%s]" % ( + ",".join(self.architectures), "yes" if self.trusted else "no") elif self.trusted is not None: line += " [trusted=%s]" % ("yes" if self.trusted else "no") elif self.architectures: @@ -250,7 +251,7 @@ class SourceEntry(object): if len(self.comps) > 0: line += " " + " ".join(self.comps) if self.comment != "": - line += " #"+self.comment + line += " #" + self.comment line += "\n" return line @@ -303,7 +304,8 @@ class SourcesList(object): all(predicate(source) for predicate in predicates)): yield source - def add(self, type, uri, dist, orig_comps, comment="", pos=-1, file=None, architectures=[]): + def add(self, type, uri, dist, orig_comps, comment="", pos=-1, file=None, + architectures=[]): """ Add a new source to the sources.list. The method will search for existing matching repos and will try to @@ -315,8 +317,8 @@ class SourcesList(object): # we can modify it later comps = orig_comps[:] sources = self.__find(lambda s: set(s.architectures) == architectures, - disabled=False, invalid=False, type=type, uri=uri, - dist=dist) + disabled=False, invalid=False, type=type, + uri=uri, dist=dist) # check if we have this source already in the sources.list for source in sources: for new_comp in comps: @@ -329,7 +331,6 @@ class SourcesList(object): sources = self.__find(lambda s: set(s.architectures) == architectures, invalid=False, type=type, uri=uri, dist=dist) - for source in sources: # if there is a repo with the same (type, uri, dist) just add the # components @@ -363,14 +364,13 @@ class SourcesList(object): def restore_backup(self, backup_ext): " restore sources.list files based on the backup extension " file = apt_pkg.config.find_file("Dir::Etc::sourcelist") - if os.path.exists(file+backup_ext) and \ - os.path.exists(file): - shutil.copy(file+backup_ext, file) + if os.path.exists(file + backup_ext) and os.path.exists(file): + shutil.copy(file + backup_ext, file) # now sources.list.d partsdir = apt_pkg.config.find_dir("Dir::Etc::sourceparts") for file in glob.glob("%s/*.list" % partsdir): - if os.path.exists(file+backup_ext): - shutil.copy(file+backup_ext, file) + if os.path.exists(file + backup_ext): + shutil.copy(file + backup_ext, file) def backup(self, backup_ext=None): """ make a backup of the current source files, if no backup extension diff --git a/doc/examples/acquire.py b/doc/examples/acquire.py index 7381ad68..1971ba2f 100644 --- a/doc/examples/acquire.py +++ b/doc/examples/acquire.py @@ -34,7 +34,8 @@ progress = apt.progress.text.AcquireProgress() fetcher = apt_pkg.Acquire(progress) pm = apt_pkg.PackageManager(depcache) pm.get_archives(fetcher, list, recs) -print "%s (%s)" % (apt_pkg.size_to_str(fetcher.fetch_needed), fetcher.fetch_needed) +print "%s (%s)" % ( + apt_pkg.size_to_str(fetcher.fetch_needed), fetcher.fetch_needed) actiongroup = apt_pkg.ActionGroup(depcache) for pkg in cache.packages: depcache.mark_keep(pkg) @@ -65,7 +66,7 @@ for item in fetcher.items: print item if item.status == item.STAT_ERROR: print "Some error ocured: '%s'" % item.error_text - if item.complete == False: + if item.complete is False: print "No error, still nothing downloaded (%s)" % item.error_text print @@ -75,4 +76,4 @@ print "fetcher.Run() returned: %s" % res print "now runing pm.DoInstall()" res = pm.do_install(1) -print "pm.DoInstall() returned: %s"% res +print "pm.DoInstall() returned: %s" % res diff --git a/doc/examples/action.py b/doc/examples/action.py index 0399bddc..41b55144 100644 --- a/doc/examples/action.py +++ b/doc/examples/action.py @@ -36,7 +36,7 @@ depcache.init(progress) #sys.exit() # get a canidate version -ver= depcache.get_candidate_ver(iter) +ver = depcache.get_candidate_ver(iter) print "Candidate version: %s " % ver print "\n\nQuerry interface" diff --git a/doc/examples/architecture.py b/doc/examples/architecture.py index 75afb2d1..421c79a7 100644 --- a/doc/examples/architecture.py +++ b/doc/examples/architecture.py @@ -6,7 +6,7 @@ def main(): print "Native architecture:", apt_pkg.config["APT::Architecture"] print "All architectures:", apt_pkg.config.value_list("APT::Architectures") - + if __name__ == '__main__': main() diff --git a/doc/examples/build-deps-old.py b/doc/examples/build-deps-old.py index cc41aa64..4e7e4350 100755 --- a/doc/examples/build-deps-old.py +++ b/doc/examples/build-deps-old.py @@ -54,7 +54,7 @@ if srcrec: # calculate the build depends for all dependencies depends = depcache.get_candidate_ver(base).depends_list -for dep in depends["Depends"]: # FIXME: do we need to consider PreDepends? +for dep in depends["Depends"]: # FIXME: do we need to consider PreDepends? pkg = dep[0].target_pkg srcpkg_name = get_source_pkg(pkg, records, depcache) if not srcpkg_name: diff --git a/doc/examples/checkstate.py b/doc/examples/checkstate.py index 7f046c5d..084fdb87 100755 --- a/doc/examples/checkstate.py +++ b/doc/examples/checkstate.py @@ -19,11 +19,11 @@ for package in packages: continue version = versions[0] for other_version in versions: - if apt_pkg.version_compare(version.ver_str, other_version.ver_str)<0: + if apt_pkg.version_compare(version.ver_str, other_version.ver_str) < 0: version = other_version if package.current_ver: current = package.current_ver - if apt_pkg.version_compare(current.ver_str, version.ver_str)<0: + if apt_pkg.version_compare(current.ver_str, version.ver_str) < 0: upgradable[package.name] = version break else: diff --git a/doc/examples/deb_inspect.py b/doc/examples/deb_inspect.py index 3261c734..f6e090a1 100755 --- a/doc/examples/deb_inspect.py +++ b/doc/examples/deb_inspect.py @@ -10,7 +10,8 @@ import os.path def Callback(member, data): """ callback for debExtract """ print "'%s','%s',%u,%u,%u,%u,%u,%u,%u" \ - % (member.name, member.linkname, member.mode, member.uid, member.gid, member.size, member.mtime, member.major, member.minor) + % (member.name, member.linkname, member.mode, member.uid, + member.gid, member.size, member.mtime, member.major, member.minor) if __name__ == "__main__": @@ -35,7 +36,6 @@ if __name__ == "__main__": depends = sections["Depends"] print apt_pkg.parse_depends(depends) - print "extracting archive" dir = "/tmp/deb" os.mkdir(dir) diff --git a/doc/examples/depcache.py b/doc/examples/depcache.py index 919de603..8e33e98b 100644 --- a/doc/examples/depcache.py +++ b/doc/examples/depcache.py @@ -31,7 +31,7 @@ depcache.init(progress) # get a canidate version -ver= depcache.get_candidate_ver(iter) +ver = depcache.get_candidate_ver(iter) print "Candidate version: %s " % ver print "\n\nQuerry interface" diff --git a/doc/examples/inst.py b/doc/examples/inst.py index dd39c25b..25658435 100644 --- a/doc/examples/inst.py +++ b/doc/examples/inst.py @@ -17,7 +17,7 @@ class TextInstallProgress(InstallProgress): InstallProgress.updateInterface(self) if self.last >= self.percent: return - sys.stdout.write("\r[%s] %s\n" %(self.percent, self.status)) + sys.stdout.write("\r[%s] %s\n" % (self.percent, self.status)) sys.stdout.flush() self.last = self.percent diff --git a/doc/examples/progress.py b/doc/examples/progress.py index d7c4fad8..32dac330 100644 --- a/doc/examples/progress.py +++ b/doc/examples/progress.py @@ -11,7 +11,7 @@ import apt.progress.base class TextProgress(apt.progress.base.OpProgress): def __init__(self): - self.last=0.0 + self.last = 0.0 def update(self, percent): if (self.last + 1.0) <= percent: @@ -47,8 +47,11 @@ class TextFetchProgress(apt.progress.base.AcquireProgress): def pulse(self, owner): print "pulse: CPS: %s/s; Bytes: %s/%s; Item: %s/%s" % ( - apt_pkg.size_to_str(self.current_cps), apt_pkg.size_to_str(self.current_bytes), - apt_pkg.size_to_str(self.total_bytes), self.current_items, self.total_items) + apt_pkg.size_to_str(self.current_cps), + apt_pkg.size_to_str(self.current_bytes), + apt_pkg.size_to_str(self.total_bytes), + self.current_items, + self.total_items) return True def media_change(self, medium, drive): diff --git a/doc/examples/sources.py b/doc/examples/sources.py index 238ca48c..aa783758 100644 --- a/doc/examples/sources.py +++ b/doc/examples/sources.py @@ -11,6 +11,6 @@ sources = apt_pkg.SourceRecords() sources.restart() while sources.lookup('hello'): print sources.package, sources.version, sources.maintainer, \ - sources.section, `sources.binaries` + sources.section, repr(sources.binaries) print sources.files print sources.index.archive_uri(sources.files[0][2]) diff --git a/doc/source/conf.py b/doc/source/conf.py index 163f5074..7a565e16 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -36,7 +36,6 @@ if os.path.exists("../../build"): break - # General configuration # --------------------- @@ -68,7 +67,7 @@ copyright = u'2009-2010, Julian Andres Klode ' # try: - release=os.environ['DEBVER'] + release = os.environ['DEBVER'] except KeyError: from subprocess import Popen, PIPE p1 = Popen(["dpkg-parsechangelog", "-l../../debian/changelog"], @@ -82,7 +81,7 @@ for c in release.split("~")[0].split(".")[2]: if not c.isdigit(): break release_raw += c - + if int(release_raw) >= 90: version_s = release.split("~")[0].split(".")[:3] # Set the version to 0.X.100 if the release is 0.X.9Y (0.7.90 => 0.7.100) @@ -212,8 +211,8 @@ htmlhelp_basename = 'python-aptdoc' # Grouping the document tree into LaTeX files. List of tuples # (source index, target name, title, author, document class [howto/manual]). latex_documents = [ - ('contents', 'python-apt.tex', ur'python-apt Documentation', - ur'Julian Andres Klode ', 'manual'), + ('contents', 'python-apt.tex', ur'python-apt Documentation', + ur'Julian Andres Klode ', 'manual'), ] # The name of an image file (relative to this directory) to place at the top of diff --git a/doc/source/examples/cache-pkgfile.py b/doc/source/examples/cache-pkgfile.py index f4cc2e66..10216c19 100644 --- a/doc/source/examples/cache-pkgfile.py +++ b/doc/source/examples/cache-pkgfile.py @@ -8,7 +8,7 @@ def main(): cache = apt_pkg.Cache() for pkgfile in cache.file_list: print 'Package-File:', pkgfile.filename - print 'Index-Type:', pkgfile.index_type # 'Debian Package Index' + print 'Index-Type:', pkgfile.index_type # 'Debian Package Index' if pkgfile.not_source: print 'Source: None' else: diff --git a/setup.py b/setup.py index 0c4561c0..cfbbf44e 100644 --- a/setup.py +++ b/setup.py @@ -61,7 +61,7 @@ if len(sys.argv) > 1 and sys.argv[1] == "build": for template in glob.glob('data/templates/*.mirrors'): import shutil shutil.copy(template, os.path.join("build", template)) - + setup(name="python-apt", description="Python bindings for APT", @@ -70,10 +70,10 @@ setup(name="python-apt", author_email="deity@lists.debian.org", ext_modules=[apt_pkg, apt_inst], packages=['apt', 'apt.progress', 'aptsources'], - data_files = [('share/python-apt/templates', - glob.glob('build/data/templates/*.info')), - ('share/python-apt/templates', - glob.glob('data/templates/*.mirrors'))], - cmdclass = cmdclass, - license = 'GNU GPL', - platforms = 'posix') + data_files=[('share/python-apt/templates', + glob.glob('build/data/templates/*.info')), + ('share/python-apt/templates', + glob.glob('data/templates/*.mirrors'))], + cmdclass=cmdclass, + license='GNU GPL', + platforms='posix') diff --git a/tests/old/__init__.py b/tests/old/__init__.py index afd0f074..e93c0b65 100644 --- a/tests/old/__init__.py +++ b/tests/old/__init__.py @@ -2,7 +2,6 @@ import os import unittest - if __name__ == '__main__': os.chdir(os.path.dirname(__file__)) print os.getcwd() diff --git a/tests/old/cache.py b/tests/old/cache.py index 11156c00..5cbf19d9 100644 --- a/tests/old/cache.py +++ b/tests/old/cache.py @@ -12,8 +12,8 @@ def main(): cache = apt_pkg.Cache() depcache = apt_pkg.DepCache(cache) depcache.init() - i=0 - all=cache.package_count + i = 0 + all = cache.package_count print "Running Cache test on all packages:" # first, get all pkgs for pkg in cache.packages: diff --git a/tests/old/depcache.py b/tests/old/depcache.py index cc030ed0..67a47503 100644 --- a/tests/old/depcache.py +++ b/tests/old/depcache.py @@ -12,8 +12,8 @@ def main(): cache = apt_pkg.Cache() depcache = apt_pkg.DepCache(cache) depcache.init() - i=0 - all=cache.package_count + i = 0 + all = cache.package_count print "Running DepCache test on all packages" print "(trying to install each and then mark it keep again):" # first, get all pkgs @@ -21,7 +21,7 @@ def main(): i += 1 x = pkg.name # then get each version - ver =depcache.get_candidate_ver(pkg) + ver = depcache.get_candidate_ver(pkg) if ver is not None: depcache.mark_install(pkg) if depcache.inst_count == 0: diff --git a/tests/old/pkgproblemresolver.py b/tests/old/pkgproblemresolver.py index 7714c882..feaa3cb1 100644 --- a/tests/old/pkgproblemresolver.py +++ b/tests/old/pkgproblemresolver.py @@ -12,8 +12,8 @@ def main(): cache = apt_pkg.Cache() depcache = apt_pkg.DepCache(cache) depcache.init() - i=0 - all=cache.package_count + i = 0 + all = cache.package_count print "Running DepCache test on all packages" print "(trying to install each and then mark it keep again):" # first, get all pkgs @@ -21,7 +21,7 @@ def main(): i += 1 x = pkg.name # then get each version - ver =depcache.get_candidate_ver(pkg) + ver = depcache.get_candidate_ver(pkg) if ver is not None: depcache.mark_install(pkg) if depcache.broken_count > 0: diff --git a/tests/old/pkgrecords.py b/tests/old/pkgrecords.py index 9e06d44c..3f253bf3 100644 --- a/tests/old/pkgrecords.py +++ b/tests/old/pkgrecords.py @@ -13,7 +13,7 @@ def main(): cache = apt_pkg.Cache() depcache = apt_pkg.DepCache(cache) depcache.init() - i=0 + i = 0 print "Running PkgRecords test on all packages:" for pkg in cache.packages: i += 1 diff --git a/tests/old/pkgsrcrecords.py b/tests/old/pkgsrcrecords.py index 36790eff..42b545ed 100644 --- a/tests/old/pkgsrcrecords.py +++ b/tests/old/pkgsrcrecords.py @@ -11,7 +11,7 @@ import sys def main(): apt_pkg.init() cache = apt_pkg.Cache() - i=0 + i = 0 print "Running PkgSrcRecords test on all packages:" for x in cache.packages: i += 1 diff --git a/tests/old/refcount.py b/tests/old/refcount.py index a80595c9..70adc0c1 100755 --- a/tests/old/refcount.py +++ b/tests/old/refcount.py @@ -1,14 +1,13 @@ #!/usr/bin/python-dbg -from pprint import pprint, pformat +from pprint import pprint import apt import sys import gc -import difflib # get initial cache print sys.gettotalrefcount() -progress= apt.progress.OpTextProgress() +progress = apt.progress.OpTextProgress() c = apt.Cache(progress) print "refcount after first cache instance: ", sys.gettotalrefcount() diff --git a/tests/test_all.py b/tests/test_all.py index 25774617..de6cb0c0 100644 --- a/tests/test_all.py +++ b/tests/test_all.py @@ -11,19 +11,21 @@ import sys try: import unittest.runner import unittest + unittest # pyflakes except ImportError: # py2.6 compat import unittest2 as unittest # workaround for py3.2 that apparently does not have this anymore -# it has "abiflags" +# it has "abiflags" if not hasattr(sys, "pydebug"): if sys.abiflags.startswith("d"): sys.pydebug = True else: sys.pydebug = False + def get_library_dir(): # Find the path to the built apt_pkg and apt_inst extensions if not os.path.exists("../build"): @@ -40,14 +42,17 @@ def get_library_dir(): plat_specifier) return os.path.abspath(library_dir) + class MyTestRunner(unittest.runner.TextTestRunner): def __init__(self, *args, **kwargs): kwargs["stream"] = sys.stdout super(MyTestRunner, self).__init__(*args, **kwargs) + if __name__ == '__main__': if not os.access("/etc/apt/sources.list", os.R_OK): - sys.stdout.write("[tests] Skipping because sources.list is not readable\n") + sys.stdout.write( + "[tests] Skipping because sources.list is not readable\n") sys.exit(0) sys.stdout.write("[tests] Running on %s\n" % sys.version.replace("\n", "")) diff --git a/tests/test_apt_cache.py b/tests/test_apt_cache.py index 9940374f..ee4fc50b 100644 --- a/tests/test_apt_cache.py +++ b/tests/test_apt_cache.py @@ -18,6 +18,7 @@ import unittest if sys.version_info[0] == 2 and sys.version_info[1] == 6: from unittest2 import TestCase + TestCase # pyflakes else: from unittest import TestCase @@ -36,7 +37,8 @@ def if_sources_list_is_readable(f): if os.access("/etc/apt/sources.list", os.R_OK): f(*args, **kwargs) else: - logging.warning("skipping '%s' because sources.list is not readable" % f) + logging.warning( + "skipping '%s' because sources.list is not readable" % f) return wrapper @@ -124,20 +126,23 @@ class TestAptCache(TestCase): cache = apt.Cache(rootdir="./data/test-provides/") cache.open() if len(cache) == 0: - logging.warning("skipping test_get_provided_packages, cache empty?!?") + logging.warning( + "skipping test_get_provided_packages, cache empty?!?") return # a true virtual pkg l = cache.get_providing_packages("mail-transport-agent") self.assertTrue(len(l) > 0) self.assertTrue("postfix" in [p.name for p in l]) - self.assertTrue("mail-transport-agent" in cache["postfix"].candidate.provides) + self.assertTrue( + "mail-transport-agent" in cache["postfix"].candidate.provides) def test_low_level_pkg_provides(self): apt.apt_pkg.config.set("Apt::architecture", "i386") # create highlevel cache and get the lowlevel one from it highlevel_cache = apt.Cache(rootdir="./data/test-provides") if len(highlevel_cache) == 0: - logging.warning("skipping test_log_level_pkg_provides, cache empty?!?") + logging.warning( + "skipping test_log_level_pkg_provides, cache empty?!?") return # low level cache provides list of the pkg cache = highlevel_cache._cache @@ -150,24 +155,24 @@ class TestAptCache(TestCase): break else: self.assertNotReached() - + @if_sources_list_is_readable def test_dpkg_journal_dirty(self): # create tmp env tmpdir = tempfile.mkdtemp() - dpkg_dir = os.path.join(tmpdir,"var","lib","dpkg") - os.makedirs(os.path.join(dpkg_dir,"updates")) - open(os.path.join(dpkg_dir,"status"), "w").close() + dpkg_dir = os.path.join(tmpdir, "var", "lib", "dpkg") + os.makedirs(os.path.join(dpkg_dir, "updates")) + open(os.path.join(dpkg_dir, "status"), "w").close() apt_pkg.config.set("Dir::State::status", - os.path.join(dpkg_dir,"status")) + os.path.join(dpkg_dir, "status")) cache = apt.Cache() # test empty self.assertFalse(cache.dpkg_journal_dirty) # that is ok, only [0-9] are dpkg jounral entries - open(os.path.join(dpkg_dir,"updates","xxx"), "w").close() - self.assertFalse(cache.dpkg_journal_dirty) + open(os.path.join(dpkg_dir, "updates", "xxx"), "w").close() + self.assertFalse(cache.dpkg_journal_dirty) # that is a dirty journal - open(os.path.join(dpkg_dir,"updates","000"), "w").close() + open(os.path.join(dpkg_dir, "updates", "000"), "w").close() self.assertTrue(cache.dpkg_journal_dirty) @if_sources_list_is_readable @@ -209,29 +214,29 @@ class TestAptCache(TestCase): # update a single sources.list cache = apt.Cache() cache.update(sources_list=sources_list) - # verify we just got the excpected package file + # verify we just got the excpected package file needle_packages = glob.glob( - lists_dir+"/*tests_data_test-repo_Packages*") + lists_dir + "/*tests_data_test-repo_Packages*") self.assertEqual(len(needle_packages), 1) # verify that we *only* got the Packages file from a single source - all_packages = glob.glob(lists_dir+"/*_Packages*") + all_packages = glob.glob(lists_dir + "/*_Packages*") self.assertEqual(needle_packages, all_packages) # verify that the listcleaner was not run and the marker file is # still there self.assertTrue("marker" in os.listdir(lists_dir)) - # now run update again (without the "normal" sources.list that # contains test-repo2 and verify that we got the normal sources.list cache.update() - needle_packages = glob.glob(lists_dir+"/*tests_data_test-repo2_Packages*") + needle_packages = glob.glob( + lists_dir + "/*tests_data_test-repo2_Packages*") self.assertEqual(len(needle_packages), 1) - all_packages = glob.glob(lists_dir+"/*_Packages*") + all_packages = glob.glob(lists_dir + "/*_Packages*") self.assertEqual(needle_packages, all_packages) # and another update with a single source only cache = apt.Cache() cache.update(sources_list=sources_list) - all_packages = glob.glob(lists_dir+"/*_Packages*") + all_packages = glob.glob(lists_dir + "/*_Packages*") self.assertEqual(len(all_packages), 2) apt_pkg.config.set("dir::state", old_state) apt_pkg.config.set("dir::etc::sourcelist", old_source_list) diff --git a/tests/test_aptsources.py b/tests/test_aptsources.py index 0b74cb79..4539b2d1 100644 --- a/tests/test_aptsources.py +++ b/tests/test_aptsources.py @@ -70,7 +70,6 @@ class TestAptSources(unittest.TestCase): ["main"], architectures=["amd64", "i386"]) self.assertTrue(sources.list == before.list) - # test to add something new: multiverse sources.add("deb", "http://de.archive.ubuntu.com/ubuntu/", "edgy", @@ -150,8 +149,7 @@ class TestAptSources(unittest.TestCase): apt_pkg.config.set("Dir::Etc::sourcelist", "data/aptsources/" "sources.list") sources = aptsources.sourceslist.SourcesList(True, self.templates) - - assert sources.list[8].invalid == False + assert sources.list[8].invalid is False assert sources.list[8].type == "deb" assert sources.list[8].architectures == ["amd64", "i386"] assert sources.list[8].uri == "http://de.archive.ubuntu.com/ubuntu/" @@ -166,11 +164,11 @@ class TestAptSources(unittest.TestCase): apt_pkg.config.set("Dir::Etc::sourcelist", "data/aptsources/" "sources.list") sources = aptsources.sourceslist.SourcesList(True, self.templates) - - assert sources.list[9].invalid == False + assert sources.list[9].invalid is False assert sources.list[9].type == "deb" assert sources.list[9].architectures == ["amd64", "i386"] - self.assertEqual( sources.list[9].uri, "http://de.archive.ubuntu.com/ubuntu/") + self.assertEqual( + sources.list[9].uri, "http://de.archive.ubuntu.com/ubuntu/") assert sources.list[9].dist == "natty" assert sources.list[9].comps == ["main"] assert sources.list[9].trusted @@ -198,7 +196,7 @@ class TestAptSources(unittest.TestCase): comps = comps.union(set(entry.comps)) self.assertTrue("multiverse" in comps) self.assertTrue("universe" in comps) - + def testDistribution(self): """aptsources: Test distribution detection.""" apt_pkg.config.set("Dir::Etc::sourcelist", "data/aptsources/" diff --git a/tests/test_auth.py b/tests/test_auth.py index bc353427..a9cfe736 100644 --- a/tests/test_auth.py +++ b/tests/test_auth.py @@ -15,6 +15,8 @@ import unittest if sys.version_info[0] > 2: from http.server import HTTPServer from http.server import SimpleHTTPRequestHandler as HTTPRequestHandler + HTTPServer # pyflakes + HTTPRequestHandler # pyflakes else: from BaseHTTPServer import HTTPServer from SimpleHTTPServer import SimpleHTTPRequestHandler as HTTPRequestHandler @@ -22,6 +24,7 @@ else: if sys.version_info[0] == 2 and sys.version_info[1] == 6: from unittest2 import TestCase + TestCase # pyflakes else: from unittest import TestCase @@ -215,7 +218,8 @@ class TestAuthKeys(TestCase): def test_add_key_from_keyserver_too_short(self): """Ensure that short keyids are not imported""" with self.assertRaises(apt.auth.AptKeyError): - apt.auth.add_key_from_keyserver("46925553", "hkp://localhost:19191") + apt.auth.add_key_from_keyserver( + "46925553", "hkp://localhost:19191") def test_add_key_from_server_mitm(self): """Verify that the key fingerprint is verified after download""" @@ -227,7 +231,8 @@ class TestAuthKeys(TestCase): "0101010178F7FE5C3E65D8AF8B48AD6246925553", "hkp://localhost:%d" % self.keyserver_port) self.assertTrue( - str(cm.exception).startswith("Fingerprints do not match"), cm.exception) + str(cm.exception).startswith("Fingerprints do not match"), + cm.exception) def testAddKeyFromServer(self): """Install a GnuPG key from a remote server.""" @@ -236,7 +241,7 @@ class TestAuthKeys(TestCase): with self._discard_stderr(): apt.auth.add_key_from_keyserver( - "0xa1bD8E9D78F7FE5C3E65D8AF8B48AD6246925553", + "0xa1bD8E9D78F7FE5C3E65D8AF8B48AD6246925553", "hkp://localhost:%d" % self.keyserver_port) ret = apt.auth.list_keys() diff --git a/tests/test_configuration.py b/tests/test_configuration.py index 80509cff..adf33719 100644 --- a/tests/test_configuration.py +++ b/tests/test_configuration.py @@ -7,7 +7,6 @@ # notice and this notice are preserved. """Unit tests for verifying the correctness of apt_pkg.Configuration""" import unittest - import apt_pkg @@ -21,9 +20,9 @@ class TestConfiguration(unittest.TestCase): def test_lp707416(self): """configuration: Test empty arguments (LP: #707416)""" self.assertRaises(ValueError, apt_pkg.parse_commandline, - apt_pkg.config,[], []) + apt_pkg.config, [], []) self.assertRaises(SystemError, apt_pkg.parse_commandline, - apt_pkg.config,[], ["cmd", "--arg0"]) + apt_pkg.config, [], ["cmd", "--arg0"]) if __name__ == "__main__": diff --git a/tests/test_debfile.py b/tests/test_debfile.py index 9379884a..ec3bf518 100644 --- a/tests/test_debfile.py +++ b/tests/test_debfile.py @@ -19,6 +19,7 @@ if libdir: import apt_pkg import apt.debfile + class TestDebfile(unittest.TestCase): """ test the debfile """ @@ -32,31 +33,31 @@ class TestDebfile(unittest.TestCase): # Conflicts: apt (<= 0.1) ('gdebi-test4.deb', True), # Conflicts: apt (>= 0.1) - ('gdebi-test5.deb', False), + ('gdebi-test5.deb', False), # invalid unicode in descr ('gdebi-test6.deb', True), # provides/conflicts against "foobarbaz" ('gdebi-test7.deb', True), # provides/conflicts/replaces against "mail-transport-agent" # (should fails if mail-transport-agent is installed) - ('gdebi-test8.deb', False), + ('gdebi-test8.deb', False), # provides/conflicts against real pkg ('gdebi-test9.deb', True), - # provides debconf-tiny and the real debconf conflicts with + # provides debconf-tiny and the real debconf conflicts with ('gdebi-test10.deb', False), ] def setUp(self): apt_pkg.init_config() - apt_pkg.config.set("APT::Architecture","i386") + apt_pkg.config.set("APT::Architecture", "i386") # FIXME: When run via test_all.py, the tests fail without this if it # is set in the system. apt_pkg.config.clear("APT::Architectures") - apt_pkg.config.set("Dir::State::status", + apt_pkg.config.set("Dir::State::status", "./data/test_debs/var/lib/dpkg/status") - apt_pkg.config.set("Dir::State::lists", + apt_pkg.config.set("Dir::State::lists", "./data/test_debs/var/lib/apt/lists") - apt_pkg.config.set("Dir::Etc::sourcelist", + apt_pkg.config.set("Dir::Etc::sourcelist", "./data/test_debs/etc/apt/sources.list") apt_pkg.init_system() self.cache = apt.Cache() @@ -76,7 +77,8 @@ class TestDebfile(unittest.TestCase): def testDebFile(self): deb = apt.debfile.DebPackage(cache=self.cache) for (filename, expected_res) in self.TEST_DEBS: - logging.debug("testing %s, expecting %s" % (filename, expected_res)) + logging.debug("testing %s, expecting %s" % ( + filename, expected_res)) deb.open(os.path.join("data", "test_debs", filename)) res = deb.check() self.assertEqual(res, expected_res, @@ -85,7 +87,8 @@ class TestDebfile(unittest.TestCase): def test_utf8_sections(self): deb = apt.debfile.DebPackage(cache=self.cache) - deb.open(os.path.join("data","test_debs","utf8-package_1.0-1_all.deb")) + deb.open( + os.path.join("data", "test_debs", "utf8-package_1.0-1_all.deb")) self.assertEqual(deb["Maintainer"], "Samuel Lidén Borell ") @@ -99,7 +102,8 @@ class TestDebfile(unittest.TestCase): deb = apt.debfile.DebPackage(cache=self.cache) deb.open(os.path.join("data", "test_debs", "gdebi-test12.deb")) content = deb.data_content("usr/bin/binary") - self.assertTrue(content.startswith("Automatically converted to printable ascii:\n\x7fELF ")) + self.assertTrue(content.startswith( + "Automatically converted to printable ascii:\n\x7fELF ")) # control file needle = """Package: gdebi-test12 Version: 1.0 @@ -136,7 +140,8 @@ Description: testpackage for gdebi - contains usr/bin/binary for file reading apt_pkg.config["APT::Architecture"] = "amd64" apt_pkg.init_system() - allowed_any = apt.debfile.DebPackage("./data/test_debs/testdep-allowed-any_1.0-1_i386.deb") + allowed_any = apt.debfile.DebPackage( + "./data/test_debs/testdep-allowed-any_1.0-1_i386.deb") self.assertTrue(allowed_any.check(), allowed_any._failure_string) def test_multi_arch_same(self): @@ -144,7 +149,8 @@ Description: testpackage for gdebi - contains usr/bin/binary for file reading apt_pkg.config["APT::Architectures::"] = "amd64" apt_pkg.config["APT::Architecture"] = "amd64" apt_pkg.init_system() - same = apt.debfile.DebPackage("./data/test_debs/testdep-same-arch_1.0-1_i386.deb") + same = apt.debfile.DebPackage( + "./data/test_debs/testdep-same-arch_1.0-1_i386.deb") self.assertTrue(same.check(), same._failure_string) diff --git a/tests/test_debfile_multiarch.py b/tests/test_debfile_multiarch.py index cf6479b1..045daf72 100644 --- a/tests/test_debfile_multiarch.py +++ b/tests/test_debfile_multiarch.py @@ -18,13 +18,15 @@ import apt import apt_pkg import apt.debfile + class TestDebfileMultiarch(unittest.TestCase): """ test the multiarch debfile """ def test_multiarch_deb_check(self): if apt_pkg.get_architectures() != ["amd64", "i386"]: # TODO: use unittest.skip - #logging.warning("skipping test because running on a non-multiarch system") + #logging.warning("skipping test because running on a " + # "non-multiarch system") return deb = apt.debfile.DebPackage( "./data/test_debs/multiarch-test1_i386.deb") @@ -48,10 +50,9 @@ class TestDebfileMultiarch(unittest.TestCase): installable = deb.check() #print deb._failure_string self.assertFalse(installable) - self.assertEqual(deb._failure_string, + self.assertEqual(deb._failure_string, "Conflicts with the installed package 'lib3ds-1-3'") - if __name__ == "__main__": unittest.main() diff --git a/tests/test_group.py b/tests/test_group.py index 3c3a5b7a..e70d2479 100644 --- a/tests/test_group.py +++ b/tests/test_group.py @@ -22,7 +22,6 @@ class TestGroup(unittest.TestCase): list(group) == list(group) - def test_cache_groups(self): """group: Iterate over all groups""" assert len(list(self.cache.groups)) == self.cache.group_count diff --git a/tests/test_hashes.py b/tests/test_hashes.py index 660373cb..be817f88 100644 --- a/tests/test_hashes.py +++ b/tests/test_hashes.py @@ -90,7 +90,7 @@ class TestHashString(unittest.TestCase): def tearDown(self): """Cleanup, Close the file object used for the tests.""" - self.file.close() + self.file.close() def test_md5(self): """hashes: Test apt_pkg.HashString().md5""" diff --git a/tests/test_lp659438.py b/tests/test_lp659438.py index 334f574d..40943d10 100644 --- a/tests/test_lp659438.py +++ b/tests/test_lp659438.py @@ -20,7 +20,7 @@ # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # Licensed under the GNU General Public License Version 2 -__author__ = "Sebastian Heinlein " +__author__ = "Sebastian Heinlein " import os import shutil diff --git a/tests/test_paths.py b/tests/test_paths.py index 48f86c52..62ea1665 100644 --- a/tests/test_paths.py +++ b/tests/test_paths.py @@ -30,8 +30,10 @@ class TestPath(unittest.TestCase): def test_acquire(self): apt_pkg.AcquireFile(apt_pkg.Acquire(), "http://example.com", destdir=self.file_bytes, destfile=self.file_bytes) - apt_pkg.AcquireFile(apt_pkg.Acquire(), "http://example.com", - destdir=self.file_unicode, destfile=self.file_unicode) + apt_pkg.AcquireFile(apt_pkg.Acquire(), + "http://example.com", + destdir=self.file_unicode, + destfile=self.file_unicode) def test_ararchive(self): archive = apt_inst.ArArchive(u"data/test_debs/data-tar-xz.deb") @@ -65,7 +67,7 @@ class TestPath(unittest.TestCase): apt_inst.TarFile(os.path.join(self.dir_bytes, b"control.tar.gz")) def test_configuration(self): - with open(self.file_unicode, 'w' ) as config: + with open(self.file_unicode, 'w') as config: config.write("Hello { World 1; };") apt_pkg.read_config_file(apt_pkg.config, self.file_bytes) apt_pkg.read_config_file(apt_pkg.config, self.file_unicode) @@ -95,7 +97,7 @@ class TestPath(unittest.TestCase): self.assertEqual(size1, size2) self.assertEqual(str(hash1), str(hash2)) self.assertEqual(str(hash1), ("SHA256:fefed230e286d832ab6eb0fb7b72" - + "442165b50df23a68402ae6e9d265a31920a2")) + "442165b50df23a68402ae6e9d265a31920a2")) def test_lock(self): apt_pkg.get_lock(self.file_unicode, True) diff --git a/tests/test_pep8.py b/tests/test_pep8.py index e6a672cf..2e1f43fc 100755 --- a/tests/test_pep8.py +++ b/tests/test_pep8.py @@ -5,7 +5,7 @@ import unittest class PackagePep8TestCase(unittest.TestCase): - def test_all_code(self): + def test_pep8(self): res = 0 py_dir = os.path.join(os.path.dirname(__file__), "..") res += subprocess.call( diff --git a/tests/test_policy.py b/tests/test_policy.py index f7d41152..f15cf2d1 100644 --- a/tests/test_policy.py +++ b/tests/test_policy.py @@ -9,6 +9,7 @@ import apt import unittest + class TestAptPolicy(unittest.TestCase): def test_apt_policy_lowlevel(self): @@ -34,6 +35,5 @@ class TestAptPolicy(unittest.TestCase): pkg.candidate.policy_priority < 1001) - if __name__ == "__main__": unittest.main() diff --git a/tests/test_progress.py b/tests/test_progress.py index 508da7d4..01cd8a2d 100644 --- a/tests/test_progress.py +++ b/tests/test_progress.py @@ -12,6 +12,7 @@ import apt import apt_pkg import os + class TestAcquireProgress(apt.progress.base.AcquireProgress): def pulse(self, owner): self.pulsed = True @@ -19,6 +20,7 @@ class TestAcquireProgress(apt.progress.base.AcquireProgress): # but often this is forgoten (and causes odd error messages) # so the lib supports it. we test the lack of support value here + class TestProgress(unittest.TestCase): def setUp(self): @@ -35,7 +37,7 @@ class TestProgress(unittest.TestCase): apt_pkg.config.set("Dir::state::lists", "./tmp") # create artifical line deb_line = "deb file:%s/data/fake-packages/ /\n" % basedir - with open("fetch_sources.list","w") as fobj: + with open("fetch_sources.list", "w") as fobj: fobj.write(deb_line) apt_pkg.config.set("Dir::Etc::sourcelist", "fetch_sources.list") apt_pkg.config.clear("APT::Update::Post-Invoke") @@ -47,5 +49,6 @@ class TestProgress(unittest.TestCase): cache.update(progress) self.assertTrue(progress.pulsed) + if __name__ == "__main__": unittest.main() diff --git a/tests/test_size_to_str.py b/tests/test_size_to_str.py index 2c2c372f..1d0e9232 100644 --- a/tests/test_size_to_str.py +++ b/tests/test_size_to_str.py @@ -1,6 +1,6 @@ #!/usr/bin/python -__author__ = "Barry Warsaw , James Hunt, Michael Vogt" +__author__ = "Barry Warsaw , James Hunt, Michael Vogt" import sys import unittest @@ -9,6 +9,7 @@ import apt_pkg if sys.version_info[0] == 2 and sys.version_info[1] == 6: from unittest2 import TestCase + TestCase # pyflakes else: from unittest import TestCase @@ -18,74 +19,71 @@ class SizeToStrTestCase(TestCase): DATA = { # XXX: note the trailing spaces for some of these entries! - 10 ** 1 : "10 ", - 10 ** 2 : "100 ", - 10 ** 3 : "1000 ", - 10 ** 4 : "10.0 k", - 10 ** 5 : "100 k", - 10 ** 6 : "1000 k", - 10 ** 7 : "10.0 M", - 10 ** 8 : "100 M", - 10 ** 9 : "1000 M", - 10 ** 10 : "10.0 G", - 10 ** 11 : "100 G", - 10 ** 12 : "1000 G", - 10 ** 13 : "10.0 T", - 10 ** 14 : "100 T", - 10 ** 15 : "1000 T", - 10 ** 16 : "10.0 P", - 10 ** 17 : "100 P", - 10 ** 18 : "1000 P", - 10 ** 19 : "10.0 E", - 10 ** 20 : "100 E", - 10 ** 21 : "1000 E", - 10 ** 22 : "10.0 Z", - 10 ** 23 : "100.0 Z", - 10 ** 24 : "1000 Z", -# 10 ** 25 : "10.0 Y", - 10 ** 26 : "100 Y", - 10 ** 27 : "1000 Y", - + 10 ** 1: "10 ", + 10 ** 2: "100 ", + 10 ** 3: "1000 ", + 10 ** 4: "10.0 k", + 10 ** 5: "100 k", + 10 ** 6: "1000 k", + 10 ** 7: "10.0 M", + 10 ** 8: "100 M", + 10 ** 9: "1000 M", + 10 ** 10: "10.0 G", + 10 ** 11: "100 G", + 10 ** 12: "1000 G", + 10 ** 13: "10.0 T", + 10 ** 14: "100 T", + 10 ** 15: "1000 T", + 10 ** 16: "10.0 P", + 10 ** 17: "100 P", + 10 ** 18: "1000 P", + 10 ** 19: "10.0 E", + 10 ** 20: "100 E", + 10 ** 21: "1000 E", + 10 ** 22: "10.0 Z", + 10 ** 23: "100.0 Z", + 10 ** 24: "1000 Z", + #10 ** 25: "10.0 Y", + 10 ** 26: "100 Y", + 10 ** 27: "1000 Y", # That's our limit :) - 10 ** 28 : "10000 Y", - - 0 : "0 ", - 1 : "1 ", - 1024 : "1024 ", - 10240 : "10.2 k", - 102400 : "102 k", - 1024000 : "1024 k", - 10240000 : "10.2 M", - 102400000 : "102 M", - 2147483647 : "2147 M", - 2147483648 : "2147 M", - 1024000000 : "1024 M", - 10240000000 : "10.2 G", - - 9 : "9 ", - 99 : "99 ", - 999 : "999 ", - 9999 : "9999 ", - 99999 : "100.0 k", - 999999 : "1000 k", - 9999999 : "10000 k", - 99999999 : "100.0 M", - 999999999 : "1000 M", - 9999999999 : "10000 M", - 99999999999 : "100.0 G", - 999999999999 : "1000 G", - 9999999999999 : "10000 G", - 99999999999999 : "100.0 T", - 999999999999999 : "1000 T", - 9999999999999999 : "10.0 P", - 99999999999999999 : "100 P", - 999999999999999999 : "1000 P", - 9999999999999999999 : "10.0 E", - 99999999999999999999 : "100 E", - 999999999999999999999 : "1000 E", - 9999999999999999999999 : "10.0 Z", - 999999999999999999999999 : "1000 Z", - } + 10 ** 28: "10000 Y", + 0: "0 ", + 1: "1 ", + 1024: "1024 ", + 10240: "10.2 k", + 102400: "102 k", + 1024000: "1024 k", + 10240000: "10.2 M", + 102400000: "102 M", + 2147483647: "2147 M", + 2147483648: "2147 M", + 1024000000: "1024 M", + 10240000000: "10.2 G", + 9: "9 ", + 99: "99 ", + 999: "999 ", + 9999: "9999 ", + 99999: "100.0 k", + 999999: "1000 k", + 9999999: "10000 k", + 99999999: "100.0 M", + 999999999: "1000 M", + 9999999999: "10000 M", + 99999999999: "100.0 G", + 999999999999: "1000 G", + 9999999999999: "10000 G", + 99999999999999: "100.0 T", + 999999999999999: "1000 T", + 9999999999999999: "10.0 P", + 99999999999999999: "100 P", + 999999999999999999: "1000 P", + 9999999999999999999: "10.0 E", + 99999999999999999999: "100 E", + 999999999999999999999: "1000 E", + 9999999999999999999999: "10.0 Z", + 999999999999999999999999: "1000 Z", + } def test_from_data(self): for k, v in self.DATA.items(): @@ -96,7 +94,7 @@ class SizeToStrTestCase(TestCase): def test_raise_on_unsupported(self): for v in ["hello", None, {}, [], ()]: with self.assertRaises(TypeError): - apt_pkg.size_to_str(v) + apt_pkg.size_to_str(v) class RegressionTestCase(unittest.TestCase): diff --git a/tests/test_tagfile.py b/tests/test_tagfile.py index f26f851b..6ff6a32a 100644 --- a/tests/test_tagfile.py +++ b/tests/test_tagfile.py @@ -27,6 +27,7 @@ if libdir: import apt_pkg + class TestTagFile(unittest.TestCase): """ test the apt_pkg.TagFile """ diff --git a/tests/test_utils.py b/tests/test_utils.py index 35c0a466..12d5a554 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -13,12 +13,13 @@ import unittest from apt.utils import ( get_maintenance_end_date, get_release_date_from_release_file, - ) +) + class TestUtils(unittest.TestCase): def test_get_release_date_from_release_file(self): - path = os.path.join(os.path.dirname(__file__), + path = os.path.join(os.path.dirname(__file__), "data", "misc", "foo_Release") t = get_release_date_from_release_file(path) self.assertEqual(str(datetime.datetime.utcfromtimestamp(t)), @@ -28,33 +29,38 @@ class TestUtils(unittest.TestCase): months_of_support = 18 # test historic releases, jaunty release_date = datetime.datetime(2009, 4, 23) - (end_year, end_month) = get_maintenance_end_date(release_date, months_of_support) + (end_year, end_month) = get_maintenance_end_date( + release_date, months_of_support) self.assertEqual(end_year, 2010) self.assertEqual(end_month, 10) # test historic releases, karmic release_date = datetime.datetime(2009, 10, 29) - (end_year, end_month) = get_maintenance_end_date(release_date, months_of_support) + (end_year, end_month) = get_maintenance_end_date( + release_date, months_of_support) self.assertEqual(end_year, 2011) self.assertEqual(end_month, 4) # test maverick release_date = datetime.datetime(2010, 10, 10) - (end_year, end_month) = get_maintenance_end_date(release_date, months_of_support) + (end_year, end_month) = get_maintenance_end_date( + release_date, months_of_support) self.assertEqual(end_year, 2012) self.assertEqual(end_month, 4) # test with modulo zero release_date = datetime.datetime(2010, 6, 10) - (end_year, end_month) = get_maintenance_end_date(release_date, months_of_support) + (end_year, end_month) = get_maintenance_end_date( + release_date, months_of_support) self.assertEqual(end_year, 2011) self.assertEqual(end_month, 12) # test dapper months_of_support = 60 release_date = datetime.datetime(2008, 4, 24) - (end_year, end_month) = get_maintenance_end_date(release_date, months_of_support) + (end_year, end_month) = get_maintenance_end_date( + release_date, months_of_support) self.assertEqual(end_year, 2013) self.assertEqual(end_month, 4) - + # what datetime says #d = datetime.timedelta(18*30) #print "end date: ", release_date + d diff --git a/utils/doclint.py b/utils/doclint.py index a387b05f..f010ec53 100644 --- a/utils/doclint.py +++ b/utils/doclint.py @@ -35,19 +35,22 @@ def handle(filename): continue for member in objects.get(modname + '.' + modmember): if not member in dir(module.__dict__[modmember]): - print 'W: Unknown', modname + '.' + modmember + '.' + member - - assert(types[objects[modname+"."+modmember][member][1]] in ('method', 'attribute')) + print ('W: Unknown', modname + '.' + modmember + + '.' + member) + t = types[objects[modname + "." + modmember][member][1]] + assert(t in ('method', 'attribute')) all = getattr(module, '__all__', []) for modmember in dir(module): - if getattr(module.__dict__[modmember], "__module__", modname) != modname: + if (getattr(module.__dict__[modmember], "__module__", modname) != + modname): continue if isinstance(module.__dict__[modmember], type(module)): continue if modmember.startswith("_"): continue - if not modmember in objects[modname] and (not all or modmember in all): + if (not modmember in objects[modname] and + (not all or modmember in all)): print 'E: Missing', modname + '.' + modmember elif not modmember in objects[modname]: print 'W: Missing', modname + '.' + modmember @@ -64,14 +67,16 @@ def handle(filename): continue except: pass - if not member in objects.get(modname + '.' + modmember, ""): - print 'E: Missing', modname + '.' + modmember + '.' + member + if not member in objects.get( + modname + '.' + modmember, ""): + print('E: Missing', modname + '.' + modmember + '.' + + member) if __name__ == '__main__': scriptdir = os.path.dirname(__file__) parentdir = os.path.join(scriptdir, "..") - directory = os.path.join(parentdir, "doc", "build", "pickle") + directory = os.path.join(parentdir, "doc", "build", "pickle") directory = os.path.normpath(directory) sys.path.insert(0, os.path.abspath(parentdir)) handle(os.path.join(directory, "searchindex.pickle")) diff --git a/utils/get_ubuntu_mirrors.py b/utils/get_ubuntu_mirrors.py index cf509088..01344852 100755 --- a/utils/get_ubuntu_mirrors.py +++ b/utils/get_ubuntu_mirrors.py @@ -37,7 +37,7 @@ req = urllib2.Request("https://wiki.ubuntu.com/Archive?action=raw") try: print "Downloading mirrors list from the Ubuntu wiki..." - uri=urllib2.urlopen(req) + uri = urllib2.urlopen(req) p = re.compile('^.*((http|ftp):\/\/[A-Za-z0-9-.:\/_]+).*\n*$') for line in uri.readlines(): if r"[[Anchor(dvd-images)]]" in line: -- cgit v1.2.3 From d95a8f27774842beb43bda54c4c61b67fe76a032 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Mon, 6 Jan 2014 12:17:44 +0100 Subject: Style fix: Do not use "is True" / "is False" This is uncommon style. It's better to use "pred" instead of "pred is True" and "not pred" instead of "pred is False". --- aptsources/distro.py | 26 +++++++++++++------------- doc/examples/acquire.py | 2 +- tests/test_aptsources.py | 4 ++-- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/aptsources/distro.py b/aptsources/distro.py index a71d5af2..9b48a10f 100644 --- a/aptsources/distro.py +++ b/aptsources/distro.py @@ -95,40 +95,40 @@ class Distribution(object): enabled_comps = [] #source_code = [] for source in self.sourceslist.list: - if (source.invalid is False and + if (not source.invalid and self.is_codename(source.dist) and source.template and - source.template.official is True and + source.template.official and self.is_codename(source.template.name)): #print "yeah! found a distro repo: %s" % source.line # cdroms need do be handled differently if (source.uri.startswith("cdrom:") and - source.disabled is False): + not source.disabled): self.cdrom_sources.append(source) cdrom_comps.extend(source.comps) elif (source.uri.startswith("cdrom:") and - source.disabled is True): + source.disabled): self.cdrom_sources.append(source) elif (source.type == self.binary_type and - source.disabled is False): + not source.disabled): self.main_sources.append(source) comps.extend(source.comps) media.append(source.uri) elif (source.type == self.binary_type and - source.disabled is True): + source.disabled): self.disabled_sources.append(source) elif (source.type == self.source_type - and source.disabled is False): + and not source.disabled): self.source_code_sources.append(source) elif (source.type == self.source_type and - source.disabled is True): + source.disabled): self.disabled_sources.append(source) - if (source.invalid is False and + if (not source.invalid and source.template in self.source_template.children): - if (source.disabled is False + if (not source.disabled and source.type == self.binary_type): self.child_sources.append(source) - elif (source.disabled is False + elif (not source.disabled and source.type == self.source_type): self.source_code_sources.append(source) else: @@ -280,7 +280,7 @@ class Distribution(object): new_source = self.sourceslist.add(type, uri, dist, comps, comment) # if source code is enabled add a deb-src line after the new # source - if self.get_source_code is True and type == self.binary_type: + if self.get_source_code and type == self.binary_type: self.sourceslist.add( self.source_type, uri, dist, comps, comment, file=new_source.file, @@ -355,7 +355,7 @@ class Distribution(object): add_component_only_once(source, comps_per_sdist) # check if there is a main source code source at all - if self.get_source_code is True: + if self.get_source_code: if len(self.source_code_sources) < 1: # create a new main source self.add_source(type=self.source_type, comps=["%s" % comp]) diff --git a/doc/examples/acquire.py b/doc/examples/acquire.py index 1971ba2f..942d0686 100644 --- a/doc/examples/acquire.py +++ b/doc/examples/acquire.py @@ -66,7 +66,7 @@ for item in fetcher.items: print item if item.status == item.STAT_ERROR: print "Some error ocured: '%s'" % item.error_text - if item.complete is False: + if not item.complete: print "No error, still nothing downloaded (%s)" % item.error_text print diff --git a/tests/test_aptsources.py b/tests/test_aptsources.py index 4539b2d1..e6d0bd82 100644 --- a/tests/test_aptsources.py +++ b/tests/test_aptsources.py @@ -149,14 +149,14 @@ class TestAptSources(unittest.TestCase): apt_pkg.config.set("Dir::Etc::sourcelist", "data/aptsources/" "sources.list") sources = aptsources.sourceslist.SourcesList(True, self.templates) - assert sources.list[8].invalid is False + assert not sources.list[8].invalid assert sources.list[8].type == "deb" assert sources.list[8].architectures == ["amd64", "i386"] assert sources.list[8].uri == "http://de.archive.ubuntu.com/ubuntu/" assert sources.list[8].dist == "natty" assert sources.list[8].comps == ["main"] assert sources.list[8].line.strip() == str(sources.list[8]) - assert sources.list[8].trusted is None + assert not sources.list[8].trusted def testMultipleOptions(self): """aptsources: Test multi-arch parsing""" -- cgit v1.2.3 From 07a71a40c64893e414faf36c722679c5f35c840a Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Mon, 6 Jan 2014 12:24:59 +0100 Subject: debian/control: Replace a tab with spaces This looked a bit ugly if you had the wrong tab size. --- debian/control | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/control b/debian/control index 8fdb3941..ab6d11e1 100644 --- a/debian/control +++ b/debian/control @@ -18,7 +18,7 @@ Build-Depends: apt (>= 0.9.6), python-distutils-extra (>= 2.0), python-sphinx (>= 0.5), python-debian, - python-unittest2, + python-unittest2, pep8, pyflakes Vcs-Git: git://anonscm.debian.org/apt/python-apt.git -- cgit v1.2.3 From af7a03182edaf58a18e1821d172c0f0dd869c898 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Mon, 6 Jan 2014 12:29:25 +0100 Subject: Drop support for Python 2.6 This will allow us to use more Python 3 idioms in the code, and possibly even get a single code base that works in Python 2.7 and Python 3.3 and newer. --- debian/control | 4 ++-- tests/test_all.py | 11 ++--------- 2 files changed, 4 insertions(+), 11 deletions(-) diff --git a/debian/control b/debian/control index ab6d11e1..428c5bba 100644 --- a/debian/control +++ b/debian/control @@ -4,14 +4,14 @@ Priority: standard Maintainer: APT Development Team Uploaders: Michael Vogt , Julian Andres Klode Standards-Version: 3.9.4 -XS-Python-Version: >= 2.6 +XS-Python-Version: >= 2.7 X-Python3-Version: >= 3.3 Build-Depends: apt (>= 0.9.6), apt-utils, debhelper (>= 9), fakeroot, libapt-pkg-dev (>= 0.8.11), - python-all-dev (>= 2.6.6-3~), + python-all-dev (>= 2.7), python-all-dbg, python3-all-dev (>= 3.3), python3-all-dbg (>= 3.3), diff --git a/tests/test_all.py b/tests/test_all.py index de6cb0c0..180712f9 100644 --- a/tests/test_all.py +++ b/tests/test_all.py @@ -6,17 +6,10 @@ # notice and this notice are preserved. """Run all available unit tests.""" import os +import unittest.runner +import unittest import sys -try: - import unittest.runner - import unittest - unittest # pyflakes -except ImportError: - # py2.6 compat - import unittest2 as unittest - - # workaround for py3.2 that apparently does not have this anymore # it has "abiflags" if not hasattr(sys, "pydebug"): -- cgit v1.2.3 From f6c94dbe9cbfa645b19832842183e248f940f829 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Mon, 6 Jan 2014 12:36:29 +0100 Subject: tests: Remove checks for Python older than 2.7 This simplifies the test code a tiny bit. --- tests/test_all.py | 11 +++-------- tests/test_auth.py | 9 +-------- tests/test_size_to_str.py | 9 +-------- 3 files changed, 5 insertions(+), 24 deletions(-) diff --git a/tests/test_all.py b/tests/test_all.py index 180712f9..6eebb0cf 100644 --- a/tests/test_all.py +++ b/tests/test_all.py @@ -10,8 +10,7 @@ import unittest.runner import unittest import sys -# workaround for py3.2 that apparently does not have this anymore -# it has "abiflags" +# Python 3 only provides abiflags since 3.2 if not hasattr(sys, "pydebug"): if sys.abiflags.startswith("d"): sys.pydebug = True @@ -27,12 +26,8 @@ def get_library_dir(): from distutils.sysconfig import get_python_version # Set the path to the build directory. plat_specifier = ".%s-%s" % (get_platform(), get_python_version()) - if sys.version_info[0] >= 3 or sys.version_info[1] >= 6: - library_dir = "../build/lib%s%s" % (plat_specifier, - (sys.pydebug and "-pydebug" or "")) - else: - library_dir = "../build/lib%s%s" % ((sys.pydebug and "_d" or ""), - plat_specifier) + library_dir = "../build/lib%s%s" % (plat_specifier, + (sys.pydebug and "-pydebug" or "")) return os.path.abspath(library_dir) diff --git a/tests/test_auth.py b/tests/test_auth.py index a9cfe736..dafbdc31 100644 --- a/tests/test_auth.py +++ b/tests/test_auth.py @@ -22,13 +22,6 @@ else: from SimpleHTTPServer import SimpleHTTPRequestHandler as HTTPRequestHandler -if sys.version_info[0] == 2 and sys.version_info[1] == 6: - from unittest2 import TestCase - TestCase # pyflakes -else: - from unittest import TestCase - - import apt_pkg import apt.auth @@ -118,7 +111,7 @@ DHcut3Yey8o= -----END PGP PUBLIC KEY BLOCK-----""" -class TestAuthKeys(TestCase): +class TestAuthKeys(unittest.TestCase): """Test handling of keys for signed repositories.""" diff --git a/tests/test_size_to_str.py b/tests/test_size_to_str.py index 1d0e9232..ba1e45b3 100644 --- a/tests/test_size_to_str.py +++ b/tests/test_size_to_str.py @@ -2,19 +2,12 @@ __author__ = "Barry Warsaw , James Hunt, Michael Vogt" -import sys import unittest import apt_pkg -if sys.version_info[0] == 2 and sys.version_info[1] == 6: - from unittest2 import TestCase - TestCase # pyflakes -else: - from unittest import TestCase - -class SizeToStrTestCase(TestCase): +class SizeToStrTestCase(unittest.TestCase): """Test apt_pkg.size_to_str""" DATA = { -- cgit v1.2.3 From 8b8a55f10ca47fe297fbb9b16a8e100658c60df3 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Mon, 6 Jan 2014 13:24:51 +0100 Subject: Use print_function everywhere This brings the code closer to Python 3. Automatically converted using 2to3 -f print. --- apt/__init__.py | 2 ++ apt/auth.py | 2 ++ apt/cache.py | 28 ++++++++++--------- apt/cdrom.py | 2 ++ apt/debfile.py | 28 ++++++++++--------- apt/package.py | 70 ++++++++++++++++++++++++----------------------- apt/progress/__init__.py | 2 ++ apt/progress/base.py | 4 ++- apt/progress/gtk2.py | 4 ++- apt/progress/text.py | 2 ++ apt/utils.py | 1 + aptsources/__init__.py | 2 ++ aptsources/sourceslist.py | 2 +- 13 files changed, 86 insertions(+), 63 deletions(-) diff --git a/apt/__init__.py b/apt/__init__.py index c4e78ba0..b8d291e3 100644 --- a/apt/__init__.py +++ b/apt/__init__.py @@ -18,6 +18,8 @@ # USA # import the core of apt_pkg """High-Level Interface for working with apt.""" +from __future__ import print_function + import apt_pkg # import some fancy classes diff --git a/apt/auth.py b/apt/auth.py index acc612a9..814cf1dc 100644 --- a/apt/auth.py +++ b/apt/auth.py @@ -24,6 +24,8 @@ # USA """Handle GnuPG keys used to trust signed repositories.""" +from __future__ import print_function + import os import os.path import shutil diff --git a/apt/cache.py b/apt/cache.py index 6b1e2bda..593e70a7 100644 --- a/apt/cache.py +++ b/apt/cache.py @@ -19,6 +19,8 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 # USA +from __future__ import print_function + import fnmatch import os import weakref @@ -721,31 +723,31 @@ class FilteredCache(object): def cache_pre_changed(): - print "cache pre changed" + print("cache pre changed") def cache_post_changed(): - print "cache post changed" + print("cache post changed") def _test(): """Internal test code.""" - print "Cache self test" + print("Cache self test") apt_pkg.init() cache = Cache(apt.progress.text.OpProgress()) cache.connect("cache_pre_change", cache_pre_changed) cache.connect("cache_post_change", cache_post_changed) - print ("aptitude" in cache) + print(("aptitude" in cache)) pkg = cache["aptitude"] - print pkg.name - print len(cache) + print(pkg.name) + print(len(cache)) for pkgname in cache.keys(): assert cache[pkgname].name == pkgname cache.upgrade() changes = cache.get_changes() - print len(changes) + print(len(changes)) for pkg in changes: assert pkg.name @@ -759,28 +761,28 @@ def _test(): cache._fetch_archives(fetcher, pm) #sys.exit(1) - print "Testing filtered cache (argument is old cache)" + print("Testing filtered cache (argument is old cache)") filtered = FilteredCache(cache) filtered.cache.connect("cache_pre_change", cache_pre_changed) filtered.cache.connect("cache_post_change", cache_post_changed) filtered.cache.upgrade() filtered.set_filter(MarkedChangesFilter()) - print len(filtered) + print(len(filtered)) for pkgname in filtered.keys(): assert pkgname == filtered[pkg].name - print len(filtered) + print(len(filtered)) - print "Testing filtered cache (no argument)" + print("Testing filtered cache (no argument)") filtered = FilteredCache(progress=apt.progress.base.OpProgress()) filtered.cache.connect("cache_pre_change", cache_pre_changed) filtered.cache.connect("cache_post_change", cache_post_changed) filtered.cache.upgrade() filtered.set_filter(MarkedChangesFilter()) - print len(filtered) + print(len(filtered)) for pkgname in filtered.keys(): assert pkgname == filtered[pkgname].name - print len(filtered) + print(len(filtered)) if __name__ == '__main__': _test() diff --git a/apt/cdrom.py b/apt/cdrom.py index 3c48fd07..35a0b180 100644 --- a/apt/cdrom.py +++ b/apt/cdrom.py @@ -20,6 +20,8 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 # USA """Classes related to cdrom handling.""" +from __future__ import print_function + import glob import apt_pkg diff --git a/apt/debfile.py b/apt/debfile.py index 679c8468..1dd1a372 100644 --- a/apt/debfile.py +++ b/apt/debfile.py @@ -17,6 +17,8 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 # USA """Classes for working with locally available Debian packages.""" +from __future__ import print_function + import apt import apt_inst import apt_pkg @@ -659,7 +661,7 @@ class DebPackage(object): def _dbg(self, level, msg): """Write debugging output to sys.stderr.""" if level <= self.debug: - print >> sys.stderr, msg + print(msg, file=sys.stderr) def install(self, install_progress=None): """Install the package.""" @@ -756,25 +758,25 @@ def _test(): cache = Cache() vp = "www-browser" - print "%s virtual: %s" % (vp, cache.is_virtual_package(vp)) + print("%s virtual: %s" % (vp, cache.is_virtual_package(vp))) providers = cache.get_providing_packages(vp) - print "Providers for %s :" % vp + print("Providers for %s :" % vp) for pkg in providers: - print " %s" % pkg.name + print(" %s" % pkg.name) d = DebPackage(sys.argv[1], cache) - print "Deb: %s" % d.pkgname + print("Deb: %s" % d.pkgname) if not d.check(): - print "can't be satified" - print d._failure_string - print "missing deps: %s" % d.missing_deps - print d.required_changes + print("can't be satified") + print(d._failure_string) + print("missing deps: %s" % d.missing_deps) + print(d.required_changes) - print d.filelist + print(d.filelist) - print "Installing ..." + print("Installing ...") ret = d.install(InstallProgress()) - print ret + print(ret) #s = DscSrcPackage(cache, "../tests/3ddesktop_0.2.9-6.dsc") #s.check_dep() @@ -783,7 +785,7 @@ def _test(): s = DscSrcPackage(cache=cache) d = "libc6 (>= 2.3.2), libaio (>= 0.3.96) | libaio1 (>= 0.3.96)" - print s._satisfy_depends(apt_pkg.parse_depends(d, False)) + print(s._satisfy_depends(apt_pkg.parse_depends(d, False))) if __name__ == "__main__": _test() diff --git a/apt/package.py b/apt/package.py index d4217195..f7f07680 100644 --- a/apt/package.py +++ b/apt/package.py @@ -19,6 +19,8 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 # USA """Functionality related to packages.""" +from __future__ import print_function + import httplib import os import sys @@ -534,7 +536,7 @@ class Version(object): base = os.path.basename(self._records.filename) destfile = os.path.join(destdir, base) if _file_is_same(destfile, self.size, self._records.md5_hash): - print('Ignoring already existing file: %s' % destfile) + print(('Ignoring already existing file: %s' % destfile)) return os.path.abspath(destfile) acq = apt_pkg.Acquire(progress or apt.progress.text.AcquireProgress()) acqfile = apt_pkg.AcquireFile(acq, self.uri, self._records.md5_hash, @@ -583,7 +585,7 @@ class Version(object): if type_ == 'dsc': dsc = destfile if _file_is_same(destfile, size, md5): - print('Ignoring already existing file: %s' % destfile) + print(('Ignoring already existing file: %s' % destfile)) continue files.append(apt_pkg.AcquireFile(acq, src.index.archive_uri(path), md5, size, base, destfile=destfile)) @@ -1134,59 +1136,59 @@ class Package(object): def _test(): """Self-test.""" - print "Self-test for the Package modul" + print("Self-test for the Package modul") import random apt_pkg.init() progress = apt.progress.text.OpProgress() cache = apt.Cache(progress) pkg = cache["apt-utils"] - print "Name: %s " % pkg.name - print "ID: %s " % pkg.id - print "Priority (Candidate): %s " % pkg.candidate.priority - print "Priority (Installed): %s " % pkg.installed.priority - print "Installed: %s " % pkg.installed.version - print "Candidate: %s " % pkg.candidate.version - print "CandidateDownloadable: %s" % pkg.candidate.downloadable - print "CandidateOrigins: %s" % pkg.candidate.origins - print "SourcePkg: %s " % pkg.candidate.source_name - print "Section: %s " % pkg.section - print "Summary: %s" % pkg.candidate.summary - print "Description (formatted) :\n%s" % pkg.candidate.description - print "Description (unformatted):\n%s" % pkg.candidate.raw_description - print "InstalledSize: %s " % pkg.candidate.installed_size - print "PackageSize: %s " % pkg.candidate.size - print "Dependencies: %s" % pkg.installed.dependencies - print "Recommends: %s" % pkg.installed.recommends + print("Name: %s " % pkg.name) + print("ID: %s " % pkg.id) + print("Priority (Candidate): %s " % pkg.candidate.priority) + print("Priority (Installed): %s " % pkg.installed.priority) + print("Installed: %s " % pkg.installed.version) + print("Candidate: %s " % pkg.candidate.version) + print("CandidateDownloadable: %s" % pkg.candidate.downloadable) + print("CandidateOrigins: %s" % pkg.candidate.origins) + print("SourcePkg: %s " % pkg.candidate.source_name) + print("Section: %s " % pkg.section) + print("Summary: %s" % pkg.candidate.summary) + print("Description (formatted) :\n%s" % pkg.candidate.description) + print("Description (unformatted):\n%s" % pkg.candidate.raw_description) + print("InstalledSize: %s " % pkg.candidate.installed_size) + print("PackageSize: %s " % pkg.candidate.size) + print("Dependencies: %s" % pkg.installed.dependencies) + print("Recommends: %s" % pkg.installed.recommends) for dep in pkg.candidate.dependencies: - print ",".join("%s (%s) (%s) (%s)" % (o.name, o.version, o.relation, - o.pre_depend) for o in dep.or_dependencies) - print "arch: %s" % pkg.candidate.architecture - print "homepage: %s" % pkg.candidate.homepage - print "rec: ", pkg.candidate.record + print(",".join("%s (%s) (%s) (%s)" % (o.name, o.version, o.relation, + o.pre_depend) for o in dep.or_dependencies)) + print("arch: %s" % pkg.candidate.architecture) + print("homepage: %s" % pkg.candidate.homepage) + print("rec: ", pkg.candidate.record) - print cache["2vcard"].get_changelog() + print(cache["2vcard"].get_changelog()) for i in True, False: - print "Running install on random upgradable pkgs with AutoFix: %s " % i + print("Running install on random upgradable pkgs with AutoFix: ", i) for pkg in cache: if pkg.is_upgradable: if random.randint(0, 1) == 1: pkg.mark_install(i) - print "Broken: %s " % cache._depcache.broken_count - print "InstCount: %s " % cache._depcache.inst_count + print("Broken: %s " % cache._depcache.broken_count) + print("InstCount: %s " % cache._depcache.inst_count) - print + print() # get a new cache for i in True, False: - print "Randomly remove some packages with AutoFix: %s" % i + print("Randomly remove some packages with AutoFix: %s" % i) cache = apt.Cache(progress) for name in cache.keys(): if random.randint(0, 1) == 1: try: cache[name].mark_delete(i) except SystemError: - print "Error trying to remove: %s " % name - print "Broken: %s " % cache._depcache.broken_count - print "DelCount: %s " % cache._depcache.del_count + print("Error trying to remove: %s " % name) + print("Broken: %s " % cache._depcache.broken_count) + print("DelCount: %s " % cache._depcache.del_count) # self-test if __name__ == "__main__": diff --git a/apt/progress/__init__.py b/apt/progress/__init__.py index 776a7034..c689de5c 100644 --- a/apt/progress/__init__.py +++ b/apt/progress/__init__.py @@ -23,5 +23,7 @@ This package provides progress reporting for the python-apt package. The module GTK+ applications, and the module 'text' provides classes for terminals, etc. """ +from __future__ import print_function + __all__ = [] diff --git a/apt/progress/base.py b/apt/progress/base.py index 2c80ae29..66d56173 100644 --- a/apt/progress/base.py +++ b/apt/progress/base.py @@ -22,6 +22,8 @@ Custom progress classes should inherit from these classes. They can also be used as dummy progress classes which simply do nothing. """ +from __future__ import print_function + import errno import fcntl import os @@ -217,7 +219,7 @@ class InstallProgress(object): except IOError as err: # resource temporarly unavailable is ignored if err.errno != errno.EAGAIN and err.errno != errno.EWOULDBLOCK: - print err.strerror + print(err.strerror) return pkgname = status = status_str = percent = base = "" diff --git a/apt/progress/gtk2.py b/apt/progress/gtk2.py index b978c34f..7d142399 100644 --- a/apt/progress/gtk2.py +++ b/apt/progress/gtk2.py @@ -22,6 +22,8 @@ # USA """GObject-powered progress classes and a GTK+ status widget.""" +from __future__ import print_function + import pygtk pygtk.require('2.0') import gtk @@ -422,7 +424,7 @@ def _test(): try: cache.commit(apt_progress.acquire, apt_progress.install) except Exception as exc: - print >> sys.stderr, "Exception happened:", exc + print("Exception happened:", exc, file=sys.stderr) if len(sys.argv) > 1: deb = DebPackage(sys.argv[1], cache) deb.install(apt_progress.dpkg_install) diff --git a/apt/progress/text.py b/apt/progress/text.py index 76a4309e..880a112c 100644 --- a/apt/progress/text.py +++ b/apt/progress/text.py @@ -15,6 +15,8 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 # USA """Progress reporting for text interfaces.""" +from __future__ import print_function + import os import sys diff --git a/apt/utils.py b/apt/utils.py index 9451f4bc..5a914fc2 100644 --- a/apt/utils.py +++ b/apt/utils.py @@ -16,6 +16,7 @@ # You should have received a copy of the GNU General Public License along with # this program; if not, write to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +from __future__ import print_function import os.path diff --git a/aptsources/__init__.py b/aptsources/__init__.py index 0929e12b..d711b4f3 100644 --- a/aptsources/__init__.py +++ b/aptsources/__init__.py @@ -1,3 +1,5 @@ +from __future__ import print_function + import apt_pkg diff --git a/aptsources/sourceslist.py b/aptsources/sourceslist.py index 1b68d52e..91ce8eff 100644 --- a/aptsources/sourceslist.py +++ b/aptsources/sourceslist.py @@ -23,7 +23,7 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 # USA -from __future__ import absolute_import +from __future__ import absolute_import, print_function import glob import logging -- cgit v1.2.3 From 86b1fa71cf952c5f4aae1cabef332ba0d4f5885c Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Mon, 6 Jan 2014 13:42:46 +0100 Subject: Use a single code base for Python 2 and 3 This is much better than running 2to3 during the build, as it gives us more control over the Python 3 code. --- apt/auth.py | 2 +- apt/debfile.py | 4 ++-- apt/package.py | 26 ++++++++++++++++++-------- apt/progress/base.py | 3 ++- apt/progress/text.py | 15 ++++++++++----- setup.py | 8 -------- 6 files changed, 33 insertions(+), 25 deletions(-) diff --git a/apt/auth.py b/apt/auth.py index 814cf1dc..6fe7c01a 100644 --- a/apt/auth.py +++ b/apt/auth.py @@ -81,7 +81,7 @@ def _call_apt_key_script(*args, **kwargs): content = kwargs.get("stdin", None) # py2 needs this encoded, py3.3 will crash if it is - if isinstance(content, unicode) and sys.version_info[:2] < (3, 3): + if sys.version_info.major < 3 and isinstance(content, unicode): content = content.encode("utf-8") output, stderr = proc.communicate(content) diff --git a/apt/debfile.py b/apt/debfile.py index 1dd1a372..ca38fdc0 100644 --- a/apt/debfile.py +++ b/apt/debfile.py @@ -27,7 +27,7 @@ import os import sys from apt_pkg import gettext as _ -from StringIO import StringIO +from io import StringIO class NoDebArchiveException(IOError): @@ -637,7 +637,7 @@ class DebPackage(object): data += gz.read() # auto-convert to hex try: - data = unicode(data, "utf-8") + data = data.decode("utf-8") except Exception: new_data = _("Automatically converted to printable ascii:\n") new_data += self.to_strish(data) diff --git a/apt/package.py b/apt/package.py index f7f07680..34c1b91e 100644 --- a/apt/package.py +++ b/apt/package.py @@ -21,13 +21,20 @@ """Functionality related to packages.""" from __future__ import print_function -import httplib + import os import sys import re import socket import subprocess -import urllib2 + +try: + from http.client import BadStatusLine + from urllib.error import HTTPError + from urllib.request import urlopen +except ImportError: + from httplib import BadStatusLine + from urllib2 import HTTPError, urlopen from collections import Mapping, Sequence @@ -38,6 +45,9 @@ from apt_pkg import gettext as _ __all__ = ('BaseDependency', 'Dependency', 'Origin', 'Package', 'Record', 'Version', 'VersionList') +if sys.version_info.major >= 3: + unicode = str + def _file_is_same(path, size, md5): """Return ``True`` if the file is the same.""" @@ -325,14 +335,14 @@ class Version(object): try: if not isinstance(dsc, unicode): # Only convert where needed (i.e. Python 2.X) - dsc = unicode(dsc, "utf-8") + dsc = dsc.decode("utf-8") except UnicodeDecodeError as err: return _("Invalid unicode in description for '%s' (%s). " "Please report.") % (self.package.name, err) lines = iter(dsc.split("\n")) # Skip the first line, since its a duplication of the summary - lines.next() + next(lines) for raw_line in lines: if raw_line.strip() == ".": # The line is just line break @@ -517,7 +527,7 @@ class Version(object): .. versionadded:: 0.7.10 """ try: - return iter(self._uris()).next() + return next(iter(self._uris())) except StopIteration: return None @@ -970,7 +980,7 @@ class Package(object): if cancel_lock and cancel_lock.isSet(): return u"" # FIXME: python3.2: Should be closed manually - changelog_file = urllib2.urlopen(uri) + changelog_file = urlopen(uri) # do only get the lines that are new changelog = u"" regexp = "^%s \((.*)\)(.*)$" % (re.escape(src_pkg)) @@ -1011,14 +1021,14 @@ class Package(object): changelog = changelog.decode("utf-8") self._changelog = changelog - except urllib2.HTTPError: + except HTTPError: res = _("The list of changes is not available yet.\n\n" "Please use http://launchpad.net/ubuntu/+source/%s/" "%s/+changelog\n" "until the changes become available or try again " "later.") % (src_pkg, src_ver) return res if isinstance(res, unicode) else res.decode("utf-8") - except (IOError, httplib.BadStatusLine): + except (IOError, BadStatusLine): res = _("Failed to download the list of changes. \nPlease " "check your Internet connection.") return res if isinstance(res, unicode) else res.decode("utf-8") diff --git a/apt/progress/base.py b/apt/progress/base.py index 66d56173..95eca9ec 100644 --- a/apt/progress/base.py +++ b/apt/progress/base.py @@ -271,7 +271,8 @@ class InstallProgress(object): try: select.select([self.status_stream], [], [], self.select_timeout) - except select.error as (errno_, _errstr): + except select.error as error: + (errno_, _errstr) = error.args if errno_ != errno.EINTR: raise diff --git a/apt/progress/text.py b/apt/progress/text.py index 880a112c..d1f87539 100644 --- a/apt/progress/text.py +++ b/apt/progress/text.py @@ -25,6 +25,11 @@ from apt.progress import base __all__ = ['AcquireProgress', 'CdromProgress', 'OpProgress'] +if sys.version_info.major < 3: + input = raw_input +else: + long = int + def _(msg): """Translate the message, also try apt if translation is missing.""" @@ -93,7 +98,7 @@ class AcquireProgress(base.AcquireProgress, TextProgress): base.AcquireProgress.__init__(self) self._signal = None self._width = 80 - self._id = 1 + self._id = long(1) def start(self): """Start an Acquire progress. @@ -106,7 +111,7 @@ class AcquireProgress(base.AcquireProgress, TextProgress): self._signal = signal.signal(signal.SIGWINCH, self._winch) # Get the window size. self._winch() - self._id = 1L + self._id = long(1) def _winch(self, *dummy): """Signal handler for window resize signals.""" @@ -217,7 +222,7 @@ class AcquireProgress(base.AcquireProgress, TextProgress): self._write(_("Media change: please insert the disc labeled\n" " '%s'\n" "in the drive '%s' and press enter\n") % (medium, drive)) - return raw_input() not in ('c', 'C') + return input() not in ('c', 'C') def stop(self): """Invoked when the Acquire process stops running.""" @@ -242,7 +247,7 @@ class CdromProgress(base.CdromProgress, TextProgress): self._write(_("Please provide a name for this Disc, such as " "'Debian 2.1r1 Disk 1'"), False) try: - return raw_input(":") + return input(":") except KeyboardInterrupt: return @@ -258,6 +263,6 @@ class CdromProgress(base.CdromProgress, TextProgress): self._write(_("Please insert a Disc in the drive and press enter"), False) try: - return (raw_input() == '') + return (input() == '') except KeyboardInterrupt: return False diff --git a/setup.py b/setup.py index cfbbf44e..56f5c530 100644 --- a/setup.py +++ b/setup.py @@ -23,14 +23,6 @@ try: except ImportError: print('W: [python%s] Sphinx import error.' % sys.version[:3]) -if sys.version_info[0] == 3: - from distutils.command.build_py import build_py_2to3 - from lib2to3.refactor import get_fixers_from_package - cmdclass['build_py'] = build_py_2to3 - cmdclass['build_py'].fixer_names = sorted( - set(get_fixers_from_package("lib2to3.fixes")) - - set(["lib2to3.fixes.fix_future"])) - # The apt_pkg module. files = ['apt_pkgmodule.cc', 'acquire.cc', 'cache.cc', 'cdrom.cc', 'configuration.cc', 'depcache.cc', 'generic.cc', 'hashes.cc', -- cgit v1.2.3 From 38804bc141cf98a0d3538bde692660de2de3b037 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Mon, 6 Jan 2014 13:59:50 +0100 Subject: apt, doc: Fix the list of comp_type values Reported-by: Michael Schaller --- apt/package.py | 2 +- doc/source/library/apt.package.rst | 2 +- doc/source/library/apt_pkg.rst | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/apt/package.py b/apt/package.py index 34c1b91e..efe4d83e 100644 --- a/apt/package.py +++ b/apt/package.py @@ -65,7 +65,7 @@ class BaseDependency(object): Attributes defined here: name - The name of the dependency - relation - The relation (>,>=,==,<,<=,) + relation - The relation (>,>=,=,!=,<,<=,) version - The version depended on rawtype - The type of the dependendy (e.g. 'Recommends') pre_depend - Boolean value whether this is a pre-dependency. diff --git a/doc/source/library/apt.package.rst b/doc/source/library/apt.package.rst index 01a26973..317e859f 100644 --- a/doc/source/library/apt.package.rst +++ b/doc/source/library/apt.package.rst @@ -34,7 +34,7 @@ Dependency Information .. attribute:: relation - The relation (>,>=,==,<,<=,) + The relation (>,>=,=,!=,<,<=,) .. attribute:: version diff --git a/doc/source/library/apt_pkg.rst b/doc/source/library/apt_pkg.rst index 7a359652..d9b8ae80 100644 --- a/doc/source/library/apt_pkg.rst +++ b/doc/source/library/apt_pkg.rst @@ -1022,7 +1022,7 @@ Example: .. attribute:: comp_type - The type of comparison (>=, ==, >>, <=), as string. + The type of comparison (>=, =, !=, >, <=), as string. .. attribute:: dep_type -- cgit v1.2.3 From 1ef0777d668a6bde0eb592928996a08570864c3f Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Mon, 6 Jan 2014 16:08:05 +0100 Subject: Unify list of comparison type values everywhere They are now ordered and include the != and < operators in all cases. --- apt/package.py | 2 +- doc/source/library/apt.package.rst | 3 ++- doc/source/library/apt_pkg.rst | 3 ++- python/cache.cc | 3 ++- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/apt/package.py b/apt/package.py index efe4d83e..78b10af4 100644 --- a/apt/package.py +++ b/apt/package.py @@ -65,7 +65,7 @@ class BaseDependency(object): Attributes defined here: name - The name of the dependency - relation - The relation (>,>=,=,!=,<,<=,) + relation - The relation (<,<=,=,!=,>=,>,) version - The version depended on rawtype - The type of the dependendy (e.g. 'Recommends') pre_depend - Boolean value whether this is a pre-dependency. diff --git a/doc/source/library/apt.package.rst b/doc/source/library/apt.package.rst index 317e859f..825bf3df 100644 --- a/doc/source/library/apt.package.rst +++ b/doc/source/library/apt.package.rst @@ -34,7 +34,8 @@ Dependency Information .. attribute:: relation - The relation (>,>=,=,!=,<,<=,) + The relation (<,<=,=,!=,>=,>,), as string. Note that the empty string + is a valid string as well, if no version is specified. .. attribute:: version diff --git a/doc/source/library/apt_pkg.rst b/doc/source/library/apt_pkg.rst index d9b8ae80..d6ffaf4c 100644 --- a/doc/source/library/apt_pkg.rst +++ b/doc/source/library/apt_pkg.rst @@ -1022,7 +1022,8 @@ Example: .. attribute:: comp_type - The type of comparison (>=, =, !=, >, <=), as string. + The type of comparison (<,<=,=,!=,>=,>,), as string. Note that the + empty string is a valid string as well, if no version is specified. .. attribute:: dep_type diff --git a/python/cache.cc b/python/cache.cc index 983b56ec..c0f1eded 100644 --- a/python/cache.cc +++ b/python/cache.cc @@ -1457,7 +1457,8 @@ static PyObject *DependencyGetID(PyObject *Self,void*) static PyGetSetDef DependencyGetSet[] = { {"comp_type",DependencyGetCompType,0, - "The type of comparison, as a string (one of '<', '<=', '=', '>=', '>')."}, + "The type of comparison, as a string, namely one of:\n" + "'<', '<=', '=', '!=', '>=', '>', ''."}, {"dep_type",DependencyGetDepType,0, "The type of the dependency; may be translated"}, {"dep_type_untranslated",DependencyGetDepTypeUntranslated,0, -- cgit v1.2.3 From 16741d48bf49b05c54159c9c39ed7dd562f1f55f Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Mon, 6 Jan 2014 16:11:28 +0100 Subject: apt/package.py: Fix BaseDependency.__dstr.__ne__() It turns out I missed this. Just simplify it to return not self.__eq__(other). Also add a test case for it. Reported-by: Michael Schaller --- apt/package.py | 2 +- tests/test_deps.py | 28 ++++++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/apt/package.py b/apt/package.py index 78b10af4..5d122968 100644 --- a/apt/package.py +++ b/apt/package.py @@ -78,7 +78,7 @@ class BaseDependency(object): return str.__eq__(self, other) or str.__eq__(2 * self, other) def __ne__(self, other): - return str.__eq__(self, other) and str.__ne__(2 * self, other) + return not self.__eq__(other) def __init__(self, name, rel, ver, pre, rawtype=None): self.name = name diff --git a/tests/test_deps.py b/tests/test_deps.py index e9a75ee2..399bb9ba 100644 --- a/tests/test_deps.py +++ b/tests/test_deps.py @@ -9,6 +9,7 @@ import unittest import apt_pkg +import apt.package class TestDependencies(unittest.TestCase): @@ -110,6 +111,33 @@ class TestDependencies(unittest.TestCase): self.assertEqual(len(depends_this), len(depends_this_too), 1) self.assertEqual(len(depends_other), len(depends_other_too), 0) + def test_dstr(self): + """Test apt.package.BaseDependency.__dstr""" + dstr = apt.package.BaseDependency._BaseDependency__dstr + self.assertEqual(dstr("<"), "<<") + self.assertEqual(dstr("<"), "<") + self.assertEqual("<<", dstr("<")) + self.assertEqual("<", dstr("<")) + self.assertEqual(dstr(">"), ">>") + self.assertEqual(dstr(">"), ">") + self.assertEqual(">>", dstr(">")) + self.assertEqual(">", dstr(">")) + self.assertNotEqual(dstr(">"), "<") + self.assertNotEqual(dstr(">"), "<=") + self.assertNotEqual(dstr(">"), "<<") + self.assertNotEqual(dstr(">"), "!=") + self.assertNotEqual(dstr(">"), "=") + self.assertNotEqual(dstr(">"), "<") + self.assertNotEqual(dstr(">"), "<=") + self.assertNotEqual(dstr(">"), "<<") + self.assertNotEqual(dstr(">"), "!=") + self.assertNotEqual(dstr(">"), "=") + self.assertFalse(dstr("<") != "<") + self.assertFalse(dstr("<") != "<<") + self.assertFalse(dstr(">") != ">") + self.assertFalse(dstr(">") != ">>") + + def testParseDepends(self): """dependencies: Test apt_pkg.ParseDepends().""" if not hasattr(apt_pkg, 'ParseDepends'): -- cgit v1.2.3 From d7d4fc322537831fb75ffe5e20175fa5789aae8e Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Mon, 6 Jan 2014 16:25:19 +0100 Subject: tests/test_deps.py: Remove an invalid blank line Fixes pep8 --- tests/test_deps.py | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/test_deps.py b/tests/test_deps.py index 399bb9ba..0035fa81 100644 --- a/tests/test_deps.py +++ b/tests/test_deps.py @@ -137,7 +137,6 @@ class TestDependencies(unittest.TestCase): self.assertFalse(dstr(">") != ">") self.assertFalse(dstr(">") != ">>") - def testParseDepends(self): """dependencies: Test apt_pkg.ParseDepends().""" if not hasattr(apt_pkg, 'ParseDepends'): -- cgit v1.2.3 From 7071ea167e9efba564b095c8643d7113f250ca86 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Mon, 6 Jan 2014 18:14:07 +0100 Subject: debian/README.source: Drop it, it's useless bzr This contains some bzr advices. It's wrong for git, and we don't need it for git because git is popular. --- debian/README.source | 3 --- 1 file changed, 3 deletions(-) delete mode 100644 debian/README.source diff --git a/debian/README.source b/debian/README.source deleted file mode 100644 index ecd31364..00000000 --- a/debian/README.source +++ /dev/null @@ -1,3 +0,0 @@ -This package is maintained in bzr and it should be build -with: -$ bzr-buildpackage --native -- cgit v1.2.3 From 619752ea94420e1c22fd37542ba36803cb5aeb91 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Tue, 7 Jan 2014 01:07:22 +0100 Subject: tests: Add back test_hashsums from old and update These are automatic tests and they still work, so it's pointless not to use them. --- tests/data/hashsums/hashsum_test.data | 1 + tests/data/hashsums/hashsum_test_with_zero.data | Bin 0 -> 7 bytes tests/old/hashsum_test.data | 1 - tests/old/hashsum_test_with_zero.data | Bin 7 -> 0 bytes tests/old/test_hashsums.py | 67 ----------------------- tests/test_hashsums.py | 70 ++++++++++++++++++++++++ 6 files changed, 71 insertions(+), 68 deletions(-) create mode 100644 tests/data/hashsums/hashsum_test.data create mode 100644 tests/data/hashsums/hashsum_test_with_zero.data delete mode 100644 tests/old/hashsum_test.data delete mode 100644 tests/old/hashsum_test_with_zero.data delete mode 100644 tests/old/test_hashsums.py create mode 100644 tests/test_hashsums.py diff --git a/tests/data/hashsums/hashsum_test.data b/tests/data/hashsums/hashsum_test.data new file mode 100644 index 00000000..19102815 --- /dev/null +++ b/tests/data/hashsums/hashsum_test.data @@ -0,0 +1 @@ +foo \ No newline at end of file diff --git a/tests/data/hashsums/hashsum_test_with_zero.data b/tests/data/hashsums/hashsum_test_with_zero.data new file mode 100644 index 00000000..2ec9a6df Binary files /dev/null and b/tests/data/hashsums/hashsum_test_with_zero.data differ diff --git a/tests/old/hashsum_test.data b/tests/old/hashsum_test.data deleted file mode 100644 index 19102815..00000000 --- a/tests/old/hashsum_test.data +++ /dev/null @@ -1 +0,0 @@ -foo \ No newline at end of file diff --git a/tests/old/hashsum_test_with_zero.data b/tests/old/hashsum_test_with_zero.data deleted file mode 100644 index 2ec9a6df..00000000 Binary files a/tests/old/hashsum_test_with_zero.data and /dev/null differ diff --git a/tests/old/test_hashsums.py b/tests/old/test_hashsums.py deleted file mode 100644 index 0cf6beb7..00000000 --- a/tests/old/test_hashsums.py +++ /dev/null @@ -1,67 +0,0 @@ -#!/usr/bin/python - -import unittest -import apt_pkg - - -class testHashes(unittest.TestCase): - " test the hashsum functions against strings and files " - - def testMD5(self): - # simple - s = "foo" - s_md5 = "acbd18db4cc2f85cedef654fccc4a4d8" - res = apt_pkg.md5sum(s) - self.assert_(res == s_md5) - # file - res = apt_pkg.md5sum(open("hashsum_test.data")) - self.assert_(res == s_md5) - # with zero (\0) in the string - s = "foo\0bar" - s_md5 = "f6f5f8cd0cb63668898ba29025ae824e" - res = apt_pkg.md5sum(s) - self.assert_(res == s_md5) - # file - res = apt_pkg.md5sum(open("hashsum_test_with_zero.data")) - self.assert_(res == s_md5) - - def testSHA1(self): - # simple - s = "foo" - s_hash = "0beec7b5ea3f0fdbc95d0dd47f3c5bc275da8a33" - res = apt_pkg.sha1sum(s) - self.assert_(res == s_hash) - # file - res = apt_pkg.sha1sum(open("hashsum_test.data")) - self.assert_(res == s_hash) - # with zero (\0) in the string - s = "foo\0bar" - s_hash = "e2c300a39311a2dfcaff799528415cb74c19317f" - res = apt_pkg.sha1sum(s) - self.assert_(res == s_hash) - # file - res = apt_pkg.sha1sum(open("hashsum_test_with_zero.data")) - self.assert_(res == s_hash) - - def testSHA256(self): - # simple - s = "foo" - s_hash = \ - "2c26b46b68ffc68ff99b453c1d30413413422d706483bfa0f98a5e886266e7ae" - res = apt_pkg.sha256sum(s) - self.assert_(res == s_hash) - # file - res = apt_pkg.sha256sum(open("hashsum_test.data")) - self.assert_(res == s_hash) - # with zero (\0) in the string - s = "foo\0bar" - s_hash = \ - "d6b681bfce7155d44721afb79c296ef4f0fa80a9dd6b43c5cf74dd0f64c85512" - res = apt_pkg.sha256sum(s) - self.assert_(res == s_hash) - # file - res = apt_pkg.sha256sum(open("hashsum_test_with_zero.data")) - self.assert_(res == s_hash) - -if __name__ == "__main__": - unittest.main() diff --git a/tests/test_hashsums.py b/tests/test_hashsums.py new file mode 100644 index 00000000..1819e343 --- /dev/null +++ b/tests/test_hashsums.py @@ -0,0 +1,70 @@ +#!/usr/bin/python + +import unittest +import apt_pkg + + +class testHashes(unittest.TestCase): + " test the hashsum functions against strings and files " + + DATA_PATH = "data/hashsums/hashsum_test.data" + DATA_WITH_ZERO_PATH = "data/hashsums/hashsum_test_with_zero.data" + + def testMD5(self): + # simple + s = b"foo" + s_md5 = "acbd18db4cc2f85cedef654fccc4a4d8" + res = apt_pkg.md5sum(s) + self.assertEqual(res, s_md5) + # file + with open(self.DATA_PATH) as fobj: + self.assertEqual(apt_pkg.md5sum(fobj), s_md5) + # with zero (\0) in the string + s = b"foo\0bar" + s_md5 = "f6f5f8cd0cb63668898ba29025ae824e" + res = apt_pkg.md5sum(s) + self.assertEqual(res, s_md5) + # file + with open(self.DATA_WITH_ZERO_PATH) as fobj: + self.assertEqual(apt_pkg.md5sum(fobj), s_md5) + + def testSHA1(self): + # simple + s = b"foo" + s_hash = "0beec7b5ea3f0fdbc95d0dd47f3c5bc275da8a33" + res = apt_pkg.sha1sum(s) + self.assertEqual(res, s_hash) + # file + with open(self.DATA_PATH) as fobj: + self.assertEqual(apt_pkg.sha1sum(fobj), s_hash) + # with zero (\0) in the string + s = b"foo\0bar" + s_hash = "e2c300a39311a2dfcaff799528415cb74c19317f" + res = apt_pkg.sha1sum(s) + self.assertEqual(res, s_hash) + # file + with open(self.DATA_WITH_ZERO_PATH) as fobj: + self.assertEqual(apt_pkg.sha1sum(fobj), s_hash) + + def testSHA256(self): + # simple + s = b"foo" + s_hash = \ + "2c26b46b68ffc68ff99b453c1d30413413422d706483bfa0f98a5e886266e7ae" + res = apt_pkg.sha256sum(s) + self.assertEqual(res, s_hash) + # file + with open(self.DATA_PATH) as fobj: + self.assertEqual(apt_pkg.sha256sum(fobj), s_hash) + # with zero (\0) in the string + s = b"foo\0bar" + s_hash = \ + "d6b681bfce7155d44721afb79c296ef4f0fa80a9dd6b43c5cf74dd0f64c85512" + res = apt_pkg.sha256sum(s) + self.assertEqual(res, s_hash) + # file + with open(self.DATA_WITH_ZERO_PATH) as fobj: + self.assertEqual(apt_pkg.sha256sum(fobj), s_hash) + +if __name__ == "__main__": + unittest.main() -- cgit v1.2.3 From bfa2ce346a1b84ed80db5be3c3a56b6954ebc1af Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Tue, 7 Jan 2014 14:42:27 +0100 Subject: debian/gbp.conf: Set sign-tags = True --- debian/gbp.conf | 1 + 1 file changed, 1 insertion(+) diff --git a/debian/gbp.conf b/debian/gbp.conf index 9a5cb4f8..e9f2f7c0 100644 --- a/debian/gbp.conf +++ b/debian/gbp.conf @@ -3,3 +3,4 @@ prebuild = ./pre-build.sh export-dir = ../build-area debian-branch = debian/sid debian-tag = %(version)s +sign-tags = True -- cgit v1.2.3 From d72fb3567d08dea6739a37ae641e80b79c524915 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Tue, 7 Jan 2014 18:16:06 +0100 Subject: apply patch from Barry Warsaw to fix autopkgtest --- debian/changelog | 5 +++++ debian/tests/control | 2 +- debian/tests/run-tests | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/debian/changelog b/debian/changelog index 319e721a..d48122b0 100644 --- a/debian/changelog +++ b/debian/changelog @@ -5,6 +5,11 @@ python-apt (0.9.2) UNRELEASED; urgency=low - when using apt.Cache(rootdir=/some/dir) only read the APT configuration from this rootdir instead of /etc (closes: #728274) + [ Barry Warsaw ] + * debian/tests/control: Add python-all and python3-all as Depends for the + autopkgtests so all the supported Python versions are pulled in. + (closes: #734500) + [ Michael Schaller] * apt/cache.py: - Fixed PEP8 issues diff --git a/debian/tests/control b/debian/tests/control index bdca7d61..9c92c35d 100644 --- a/debian/tests/control +++ b/debian/tests/control @@ -1,2 +1,2 @@ Tests: run-tests -Depends: @, apt-utils, python-debian, fakeroot, intltool, pep8, pyflakes +Depends: @, apt-utils, python-debian, python-all, python3-all, fakeroot, intltool, pep8, pyflakes diff --git a/debian/tests/run-tests b/debian/tests/run-tests index bb980c6b..7d7a4bf3 100644 --- a/debian/tests/run-tests +++ b/debian/tests/run-tests @@ -3,6 +3,6 @@ set -e # from debian/rules -for python in $(utils/pyversions -r); do +for python in $(utils/pyversions -r); do $python tests/test_all.py -q done -- cgit v1.2.3 From 14a0a07a331c936537a346f69e3c39db175e00cf Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Tue, 14 Jan 2014 21:53:48 +0100 Subject: python/pkgmanager.cc: Do not create temporary CppPyRef Instead of creating a CppPyRef with the only purpose of destroying it, just decrement the reference count. Reported-by: cppcheck --- python/pkgmanager.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/pkgmanager.cc b/python/pkgmanager.cc index cf19e6bf..05f033f3 100644 --- a/python/pkgmanager.cc +++ b/python/pkgmanager.cc @@ -191,7 +191,7 @@ class PyPkgManager : public pkgDPkgPM { StatusFd)); } virtual void Reset() { - CppPyRef(PyObject_CallMethod(pyinst, "reset", NULL)); + Py_XDECREF(PyObject_CallMethod(pyinst, "reset", NULL)); } public: -- cgit v1.2.3 From cf0b0c05ee4d228363f8331c30f993b8ce5c569b Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Thu, 23 Jan 2014 14:27:34 +0100 Subject: tests/test_aptsources.py: Fix regression in d95a8f2 Commit d95a8f27774842beb43bda54c4c61b67fe76a032 introduced a regression in this test that did not catch an invalid False value for the trusted property of a source without trusted set. --- tests/test_aptsources.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_aptsources.py b/tests/test_aptsources.py index e6d0bd82..f955205f 100644 --- a/tests/test_aptsources.py +++ b/tests/test_aptsources.py @@ -156,7 +156,7 @@ class TestAptSources(unittest.TestCase): assert sources.list[8].dist == "natty" assert sources.list[8].comps == ["main"] assert sources.list[8].line.strip() == str(sources.list[8]) - assert not sources.list[8].trusted + assert sources.list[8].trusted is None def testMultipleOptions(self): """aptsources: Test multi-arch parsing""" -- cgit v1.2.3 From 3e33aaa11c0062b6bf97601e3221a9858a533ad2 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Sat, 25 Jan 2014 15:46:57 +0100 Subject: tests/test_deps.py: test_dstr cleanup and fixes Simplify the code by not stating all test cases in the code, but using a loop. Also adds more tests this way. --- tests/test_deps.py | 35 +++++++++++++---------------------- 1 file changed, 13 insertions(+), 22 deletions(-) diff --git a/tests/test_deps.py b/tests/test_deps.py index 0035fa81..96bcd57b 100644 --- a/tests/test_deps.py +++ b/tests/test_deps.py @@ -6,6 +6,7 @@ # are permitted in any medium without royalty provided the copyright # notice and this notice are preserved. """Unit tests for verifying the correctness of check_dep, etc in apt_pkg.""" +import itertools import unittest import apt_pkg @@ -114,28 +115,18 @@ class TestDependencies(unittest.TestCase): def test_dstr(self): """Test apt.package.BaseDependency.__dstr""" dstr = apt.package.BaseDependency._BaseDependency__dstr - self.assertEqual(dstr("<"), "<<") - self.assertEqual(dstr("<"), "<") - self.assertEqual("<<", dstr("<")) - self.assertEqual("<", dstr("<")) - self.assertEqual(dstr(">"), ">>") - self.assertEqual(dstr(">"), ">") - self.assertEqual(">>", dstr(">")) - self.assertEqual(">", dstr(">")) - self.assertNotEqual(dstr(">"), "<") - self.assertNotEqual(dstr(">"), "<=") - self.assertNotEqual(dstr(">"), "<<") - self.assertNotEqual(dstr(">"), "!=") - self.assertNotEqual(dstr(">"), "=") - self.assertNotEqual(dstr(">"), "<") - self.assertNotEqual(dstr(">"), "<=") - self.assertNotEqual(dstr(">"), "<<") - self.assertNotEqual(dstr(">"), "!=") - self.assertNotEqual(dstr(">"), "=") - self.assertFalse(dstr("<") != "<") - self.assertFalse(dstr("<") != "<<") - self.assertFalse(dstr(">") != ">") - self.assertFalse(dstr(">") != ">>") + equal = {"<": {"<<", "<"}, + "=": {"==", "="}, + ">": {">>", ">"}} + operators = ["<<", "<", "<=", "!=", "=", "==", ">=", ">", ">>"] + + for a, b in itertools.product(equal.keys(), operators): + if b in equal[a]: + self.assertEqual(dstr(a), b) + self.assertEqual(b, dstr(a)) + else: + self.assertNotEqual(dstr(a), b) + self.assertNotEqual(b, dstr(a)) def testParseDepends(self): """dependencies: Test apt_pkg.ParseDepends().""" -- cgit v1.2.3 From e50f19ba24ff8999d6d18da3fd06cdb44dfccced Mon Sep 17 00:00:00 2001 From: Michael Schaller Date: Sat, 11 Jan 2014 13:07:46 +0100 Subject: apt/package.py: Improved readability and documentation of BaseDependency.__dstr(). --- apt/package.py | 21 ++++++++++++++++++--- debian/changelog | 1 + 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/apt/package.py b/apt/package.py index 5d122968..d1a72744 100644 --- a/apt/package.py +++ b/apt/package.py @@ -72,17 +72,32 @@ class BaseDependency(object): """ class __dstr(str): - """Helper to make > match >> and < match <<""" + """Compare helper for compatibility with old third-party code. + + Old third-party code might still compare the relation with the + previously used relations (<<,<=,==,!=,>=,>>,) instead of the curently + used ones (<,<=,=,!=,>=,>,). This compare helper lets < match to <<, + > match to >> and = match to ==. + """ def __eq__(self, other): - return str.__eq__(self, other) or str.__eq__(2 * self, other) + if str.__eq__(self, other): + return True + elif str.__eq__(self, '<'): + return str.__eq__('<<', other) + elif str.__eq__(self, '>'): + return str.__eq__('>>', other) + elif str.__eq__(self, '='): + return str.__eq__('==', other) + else: + return False def __ne__(self, other): return not self.__eq__(other) def __init__(self, name, rel, ver, pre, rawtype=None): self.name = name - self.relation = len(rel) == 1 and self.__dstr(rel) or rel + self.relation = self.__dstr(rel) self.version = ver self.pre_depend = pre self.rawtype = rawtype diff --git a/debian/changelog b/debian/changelog index d48122b0..32c29681 100644 --- a/debian/changelog +++ b/debian/changelog @@ -17,6 +17,7 @@ python-apt (0.9.2) UNRELEASED; urgency=low * apt/package.py: - Fixed PEP8 issues - Fixed pyflakes issue: Removed unused import 'warnings' + - Improved readability and documentation of BaseDependency.__dstr(). -- Michael Vogt Sat, 23 Nov 2013 08:49:51 +0100 -- cgit v1.2.3 From b86459a1114684f4e65a5639d46975670304f65b Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Sat, 25 Jan 2014 17:02:10 +0100 Subject: apt/package.py: Pass an apt_pkg.Dependency to BaseDependency Instead of passing the properties to __init__(), let's just pass the apt_pkg.Dependency. Store that in a _dep attribute, and provide properties to provide the API. The other classes do it this way as well. Reported-by: Michael Schaller --- apt/package.py | 60 ++++++++++++++++++++++++++------------ doc/source/library/apt.package.rst | 23 ++------------- 2 files changed, 43 insertions(+), 40 deletions(-) diff --git a/apt/package.py b/apt/package.py index d1a72744..d75a5185 100644 --- a/apt/package.py +++ b/apt/package.py @@ -61,15 +61,7 @@ class FetchError(Exception): class BaseDependency(object): - """A single dependency. - - Attributes defined here: - name - The name of the dependency - relation - The relation (<,<=,=,!=,>=,>,) - version - The version depended on - rawtype - The type of the dependendy (e.g. 'Recommends') - pre_depend - Boolean value whether this is a pre-dependency. - """ + """A single dependency.""" class __dstr(str): """Compare helper for compatibility with old third-party code. @@ -95,12 +87,45 @@ class BaseDependency(object): def __ne__(self, other): return not self.__eq__(other) - def __init__(self, name, rel, ver, pre, rawtype=None): - self.name = name - self.relation = self.__dstr(rel) - self.version = ver - self.pre_depend = pre - self.rawtype = rawtype + def __init__(self, dep): + self._dep = dep # apt_pkg.Dependency + + @property + def name(self): + """The name of the target package.""" + return self._dep.target_pkg.name + + @property + def relation(self): + """The relation (<, <=, !=, =, >=, >, ). + + Note that the empty string is a valid string as well, if no version + is specified. + """ + return self.__dstr(self._dep.comp_type) + + @property + def version(self): + """The target version or None. + + It is None if and only if relation is the empty string.""" + return self._dep.target_ver + + @property + def rawtype(self): + """Type of the dependency. + + This should be one of 'Breaks', 'Conflicts', 'Depends', 'Enhances', + 'PreDepends', 'Recommends', 'Replaces', 'Suggests'. + + Additional types might be added in the future. + """ + return self._dep.dep_type_untranslated + + @property + def pre_depend(self): + """Whether this is a PreDepends.""" + return self._dep.dep_type_untranslated == 'PreDepends' def __repr__(self): return ('' @@ -433,10 +458,7 @@ class Version(object): for dep_ver_list in depends[type_]: base_deps = [] for dep_or in dep_ver_list: - base_deps.append(BaseDependency(dep_or.target_pkg.name, - dep_or.comp_type, dep_or.target_ver, - (type_ == "PreDepends"), - rawtype=type_)) + base_deps.append(BaseDependency(dep_or)) depends_list.append(Dependency(base_deps)) except KeyError: pass diff --git a/doc/source/library/apt.package.rst b/doc/source/library/apt.package.rst index 825bf3df..1a69c1e2 100644 --- a/doc/source/library/apt.package.rst +++ b/doc/source/library/apt.package.rst @@ -23,27 +23,8 @@ The Version class Dependency Information ---------------------- -.. class:: BaseDependency - - The :class:`BaseDependency` class defines various attributes for accessing - the parts of a dependency. The attributes are as follows: - - .. attribute:: name - - The name of the dependency - - .. attribute:: relation - - The relation (<,<=,=,!=,>=,>,), as string. Note that the empty string - is a valid string as well, if no version is specified. - - .. attribute:: version - - The version or None. - - .. attribute:: pre_depend - - Boolean value whether this is a pre-dependency. +.. autoclass:: BaseDependency + :members: .. class:: Dependency -- cgit v1.2.3 From 944c4b17530ffda650ff10c6767698b34d6f35cf Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Sat, 25 Jan 2014 17:42:12 +0100 Subject: debian/control: Set Standards-Version to 3.9.5 --- debian/control | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/control b/debian/control index 428c5bba..ad869031 100644 --- a/debian/control +++ b/debian/control @@ -3,7 +3,7 @@ Section: python Priority: standard Maintainer: APT Development Team Uploaders: Michael Vogt , Julian Andres Klode -Standards-Version: 3.9.4 +Standards-Version: 3.9.5 XS-Python-Version: >= 2.7 X-Python3-Version: >= 3.3 Build-Depends: apt (>= 0.9.6), -- cgit v1.2.3 From bf806cb924d61dc11b4365014daee4f47948973f Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Sat, 25 Jan 2014 18:16:43 +0100 Subject: debian/control: Drop python-{unittest2,debian} build deps They are not used anymore. --- debian/control | 2 -- 1 file changed, 2 deletions(-) diff --git a/debian/control b/debian/control index ad869031..5992884c 100644 --- a/debian/control +++ b/debian/control @@ -17,8 +17,6 @@ Build-Depends: apt (>= 0.9.6), python3-all-dbg (>= 3.3), python-distutils-extra (>= 2.0), python-sphinx (>= 0.5), - python-debian, - python-unittest2, pep8, pyflakes Vcs-Git: git://anonscm.debian.org/apt/python-apt.git -- cgit v1.2.3 From 9b8ea91691dd2b7d21da933583e94c2482d3d532 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Sat, 25 Jan 2014 18:18:42 +0100 Subject: Release 0.9.2 --- debian/changelog | 33 ++++++++++++++++++++++++++++++--- 1 file changed, 30 insertions(+), 3 deletions(-) diff --git a/debian/changelog b/debian/changelog index 32c29681..2a0d6b1d 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,15 +1,18 @@ -python-apt (0.9.2) UNRELEASED; urgency=low +python-apt (0.9.2) unstable; urgency=medium [ Michael Vogt ] * apt/cache.py: - when using apt.Cache(rootdir=/some/dir) only read the APT configuration from this rootdir instead of /etc (closes: #728274) + * make pep8 test part of the unittests + * add pyflakes test + * add .travis.yml & update python3 dependency to 3.3 [ Barry Warsaw ] * debian/tests/control: Add python-all and python3-all as Depends for the autopkgtests so all the supported Python versions are pulled in. (closes: #734500) - + [ Michael Schaller] * apt/cache.py: - Fixed PEP8 issues @@ -19,7 +22,31 @@ python-apt (0.9.2) UNRELEASED; urgency=low - Fixed pyflakes issue: Removed unused import 'warnings' - Improved readability and documentation of BaseDependency.__dstr(). - -- Michael Vogt Sat, 23 Nov 2013 08:49:51 +0100 + [ Julian Andres Klode ] + * apt/cache.py: Call os.path.abspath() on a supplied rootdir (LP: #792295) + * apt/package.py: Fix BaseDependency.__dstr.__ne__() + * apt/package.py: Pass an apt_pkg.Dependency to BaseDependency + * tests: Add back test_hashsums from old and update + * Style fixes: + - Style fix: Do not use "is True" / "is False" + - debian/control: Replace a tab with spaces + - tests/test_deps.py: Remove an invalid blank line + * Use a single code base for Python 2 and 3 + - Use print_function everywhere + - Drop support for Python 2.6 + - tests: Remove checks for Python older than 2.7 + * Documentation fixes: + - apt, doc: Fix the list of comp_type values + - Unify list of comparison type values everywhere + * Static analysis fixes: + - (cppcheck) python/pkgmanager.cc: Do not create temporary CppPyRef + * Packaging changes: + - debian/README.source: Drop it, it's useless bzr + - debian/gbp.conf: Set sign-tags = True + - debian/control: Set Standards-Version to 3.9.5 + - debian/control: Drop python-{unittest2,debian} build deps + + -- Julian Andres Klode Sat, 25 Jan 2014 18:18:38 +0100 python-apt (0.9.1) unstable; urgency=low -- cgit v1.2.3 From 8f2f04f080334b21b455c6e00199b4c095e1181d Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Sun, 26 Jan 2014 00:11:06 +0100 Subject: doc/source/conf.py: Python 3 support Correctly decode the process output in Python 3, so everything works if sphinx is run using python3. --- doc/source/conf.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/doc/source/conf.py b/doc/source/conf.py index 7a565e16..41dda03c 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -75,6 +75,8 @@ except KeyError: p2 = Popen(["sed", "-n", 's/^Version: //p'], stdin=p1.stdout, stdout=PIPE) release = p2.communicate()[0] +if sys.version_info.major >= 3: + release = release.decode("utf-8") # Handle the alpha release scheme release_raw = "0" for c in release.split("~")[0].split(".")[2]: -- cgit v1.2.3 From e8a92cc40e35c8ab95bd70caf6fa813564b235b1 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Sun, 26 Jan 2014 00:37:34 +0100 Subject: debian/rules: Use dh_sphinxdoc integration This ensures that we do not include JavaScript from Sphinx in our binary package. Adjust debian/control to include the dependencies created by dh_sphinxdoc. --- debian/control | 2 +- debian/rules | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/debian/control b/debian/control index 5992884c..4bc26ff3 100644 --- a/debian/control +++ b/debian/control @@ -76,7 +76,7 @@ Package: python-apt-doc Priority: optional Architecture: all Section: doc -Depends: libjs-jquery, libjs-underscore, ${misc:Depends} +Depends: libjs-jquery, libjs-underscore, ${misc:Depends}, ${sphinxdoc:Depends} Enhances: python-apt Replaces: python-apt (<< 0.7.94) Description: Python interface to libapt-pkg (API documentation) diff --git a/debian/rules b/debian/rules index 4a33c533..37366324 100755 --- a/debian/rules +++ b/debian/rules @@ -6,7 +6,7 @@ export PATH := $(CURDIR)/utils:$(PATH) export pyversions := $(CURDIR)/utils/pyversions %: - dh $@ --with python2,python3 + dh $@ --with python2,python3,sphinxdoc override_dh_auto_build: dh_auto_build -- cgit v1.2.3 From defc7e469043be7ac2253dca1485a87284399f73 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Sun, 26 Jan 2014 00:52:46 +0100 Subject: utils/doclint.py: Drop, not working anymore. Sphinx changed its pickle format some time ago, so this script does not work anymore --- utils/doclint.py | 82 -------------------------------------------------------- utils/mirrortest | 29 ++++++++++---------- 2 files changed, 14 insertions(+), 97 deletions(-) delete mode 100644 utils/doclint.py diff --git a/utils/doclint.py b/utils/doclint.py deleted file mode 100644 index f010ec53..00000000 --- a/utils/doclint.py +++ /dev/null @@ -1,82 +0,0 @@ -#!/usr/bin/python -# Documentation lint. -# Copyright (C) 2009 Julian Andres Klode -# -# Copying and distribution of this file, with or without modification, -# are permitted in any medium without royalty provided the copyright -# notice and this notice are preserved. -# -# This comes without any warranty. -"""Read the pickle file created by sphinx and check it.""" - -from __future__ import with_statement -import cPickle -import os -import sys - - -def handle(filename): - with open(filename) as fobj: - index = cPickle.load(fobj) - - objects = index['descrefs'] - modules = index['modules'] - types = index['desctypes'] - - for modname in modules: - module = __import__(modname, fromlist=["*"]) - - for modmember in objects[modname]: - if not modmember in module.__dict__: - print 'W: Unknown', modname + '.' + modmember - elif types[objects[modname][modmember][1]] == u'class': - if modname + '.' + modmember not in objects: - print 'I: No members', modname + '.' + modmember - continue - for member in objects.get(modname + '.' + modmember): - if not member in dir(module.__dict__[modmember]): - print ('W: Unknown', modname + '.' + modmember + - '.' + member) - t = types[objects[modname + "." + modmember][member][1]] - assert(t in ('method', 'attribute')) - - all = getattr(module, '__all__', []) - for modmember in dir(module): - if (getattr(module.__dict__[modmember], "__module__", modname) != - modname): - continue - if isinstance(module.__dict__[modmember], type(module)): - continue - if modmember.startswith("_"): - continue - if (not modmember in objects[modname] and - (not all or modmember in all)): - print 'E: Missing', modname + '.' + modmember - elif not modmember in objects[modname]: - print 'W: Missing', modname + '.' + modmember - elif types[objects[modname][modmember][1]] == u'class': - for member in dir(module.__dict__[modmember]): - if member.startswith("_"): - continue - try: - contin = False - for base in module.__dict__[modmember].__bases__: - if member in dir(base): - contin = True - if contin: - continue - except: - pass - if not member in objects.get( - modname + '.' + modmember, ""): - print('E: Missing', modname + '.' + modmember + '.' + - member) - - -if __name__ == '__main__': - scriptdir = os.path.dirname(__file__) - parentdir = os.path.join(scriptdir, "..") - directory = os.path.join(parentdir, "doc", "build", "pickle") - directory = os.path.normpath(directory) - sys.path.insert(0, os.path.abspath(parentdir)) - handle(os.path.join(directory, "searchindex.pickle")) diff --git a/utils/mirrortest b/utils/mirrortest index a724c81f..cec37e8d 100755 --- a/utils/mirrortest +++ b/utils/mirrortest @@ -1,9 +1,9 @@ -#!/usr/bin/env python -import threading, Queue, time, re, os, tempfile +#!/usr/bin/env python3 +import threading, queue, time, re, os, tempfile import aptsources.sourceslist import aptsources.distro from timeit import Timer -import urllib +import urllib.request, urllib.parse, urllib.error import socket import random socket.setdefaulttimeout(2) @@ -24,9 +24,9 @@ class MirrorTest: host = mirror.hostname except: continue - print "Pinging (Worker %s) %s (%s) ..." % (self.id, + print("Pinging (Worker %s) %s (%s) ..." % (self.id, host, - MirrorTest.completed_pings) + MirrorTest.completed_pings)) commando = os.popen("ping -q -c 4 -W 2 -i 0.3 %s" % host, "r") while True: @@ -43,17 +43,17 @@ class MirrorTest: def speed_test(self, mirror): url = "%s/%s" % (mirror.get_repo_urls()[0], self.test_file) - print "Downloading %s ..." % url + print("Downloading %s ..." % url) start = time.time() try: - data = urllib.urlopen(url).read(51200) + data = urllib.request.urlopen(url).read(51200) return 50 / (time.time() - start) except: return 0 def __init__(self, hosts, test_file): self.test_file = test_file - jobs = Queue.Queue() + jobs = queue.Queue() results = [] for h in hosts: jobs.put(h) @@ -71,21 +71,20 @@ class MirrorTest: t.join() results.sort() - print "\n\nTop ten RTTs:" + print("\n\nTop ten RTTs:") for r in results[0:10]: - print "%s: %s" % (r[1], r[0]) - print "\n\n" + print("%s: %s" % (r[1], r[0])) + print("\n\n") results.insert(0, [0, "rand", hosts[random.randint(1, len(hosts))]]) results.insert(0, [0, "rand", hosts[random.randint(1, len(hosts))]]) - final = map(lambda r: (self.speed_test(r[2]), r[2]), - results[0:12]) + final = [(self.speed_test(r[2]), r[2]) for r in results[0:12]] final.sort() final.reverse() - print "\n\nBest mirrors:" + print("\n\nBest mirrors:") for f in final: - print "%s: %s KByte/s" % (f[1].hostname, int(f[0])) + print("%s: %s KByte/s" % (f[1].hostname, int(f[0]))) if __name__ == "__main__": distro = aptsources.distro.get_distro() -- cgit v1.2.3 From c5ff65130e3c4353bfcdf1dcf3ab1d912597601d Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Mon, 27 Jan 2014 20:27:26 +0100 Subject: python/generic.h: Fix MkPyNumber to work if char is unsigned. We currently consider two cases "unsigned char" and "char". This works as long as "char" is signed, but this is not guaranteed. Change "char" to "signed char" instead. --- python/generic.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/generic.h b/python/generic.h index 26736f1a..bcc4a5e4 100644 --- a/python/generic.h +++ b/python/generic.h @@ -250,7 +250,7 @@ inline PyObject *MkPyNumber(long long o) { return PyLong_FromLongLong(o); } inline PyObject *MkPyNumber(long o) { return PyInt_FromLong(o); } inline PyObject *MkPyNumber(int o) { return PyInt_FromLong(o); } inline PyObject *MkPyNumber(short o) { return PyInt_FromLong(o); } -inline PyObject *MkPyNumber(char o) { return PyInt_FromLong(o); } +inline PyObject *MkPyNumber(signed char o) { return PyInt_FromLong(o); } inline PyObject *MkPyNumber(double o) { return PyFloat_FromDouble(o); } -- cgit v1.2.3 From 0b6f34f3812bb29cc40045d0d34a2da8bd808ce9 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Sat, 22 Feb 2014 18:15:38 +0100 Subject: data: Add Tanglu distribution information Add information about Tanglu 1.0 'Aequorea' and Tanglu 2.0 'Bartholomea'. Welcome, Tanglu. --- data/templates/Tanglu.info.in | 42 ++++++++++++++++++++++++++++++++++++++++++ data/templates/Tanglu.mirrors | 3 +++ 2 files changed, 45 insertions(+) create mode 100644 data/templates/Tanglu.info.in create mode 100644 data/templates/Tanglu.mirrors diff --git a/data/templates/Tanglu.info.in b/data/templates/Tanglu.info.in new file mode 100644 index 00000000..df370832 --- /dev/null +++ b/data/templates/Tanglu.info.in @@ -0,0 +1,42 @@ +_ChangelogURI: http://changelogs.tanglu.org/changelogs/%s/%s/%s/%s_%s/changelog + +Suite: aequorea +RepositoryType: deb +BaseURI: http://archive.tanglu.org/tanglu/ +MatchURI: archive.tanglu.org/tanglu +MirrorsFile: Tanglu.mirrors +_Description: Tanglu 1.0 'Aequorea' +Component: main +_CompDescription: Officially supported +Component: contrib +_CompDescription: DFSG-compatible Software with Non-Free Dependencies +Component: non-free +_CompDescription: Non-DFSG-compatible Software + +Suite: aequorea-updates +RepositoryType: deb +ParentSuite: aequorea +_Description: Recommended updates + +Suite: bartholomea +RepositoryType: deb +BaseURI: http://archive.tanglu.org/tanglu/ +MatchURI: archive.tanglu.org/tanglu +MirrorsFile: Tanglu.mirrors +_Description: Tanglu 2.0 'Bartholomea' +Component: main +_CompDescription: Officially supported +Component: contrib +_CompDescription: DFSG-compatible Software with Non-Free Dependencies +Component: non-free +_CompDescription: Non-DFSG-compatible Software + +Suite: bartholomea-security +RepositoryType: deb +ParentSuite: bartholomea +_Description: Security updates + +Suite: bartholomea-updates +RepositoryType: deb +ParentSuite: bartholomea +_Description: Recommended updates diff --git a/data/templates/Tanglu.mirrors b/data/templates/Tanglu.mirrors new file mode 100644 index 00000000..dd8ab425 --- /dev/null +++ b/data/templates/Tanglu.mirrors @@ -0,0 +1,3 @@ +#LOC:DE +http://de.archive.tanglu.org/tanglu/ +http://mirror1.hs-esslingen.de/pub/Mirrors/archive.tanglu.org/tanglu/ -- cgit v1.2.3 From c6ff9b94649494032b1009c8f5590ec445106c9d Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Sat, 22 Feb 2014 18:52:10 +0100 Subject: debian/python3-apt-dbg.files: Fix pattern for kFreeBSD We previously moved all files containing a "d", but kfreebsd contains a "d" itself, so the build failed. --- debian/python3-apt-dbg.files | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/python3-apt-dbg.files b/debian/python3-apt-dbg.files index 88cbfcb0..90856651 100644 --- a/debian/python3-apt-dbg.files +++ b/debian/python3-apt-dbg.files @@ -1 +1 @@ -usr/lib/python3*/*/*d*.so +usr/lib/python3*/*/*dm-*.so -- cgit v1.2.3 From 35fbdb5da686b2d3b2893e46050acfc00877527c Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Sat, 22 Feb 2014 18:56:23 +0100 Subject: tests/test_policy.py: Disable, uses system state (FTBFS on ppc64) Disable the tests until we can fix them properly. --- tests/test_policy.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/test_policy.py b/tests/test_policy.py index f15cf2d1..27d69e4b 100644 --- a/tests/test_policy.py +++ b/tests/test_policy.py @@ -13,6 +13,7 @@ import unittest class TestAptPolicy(unittest.TestCase): def test_apt_policy_lowlevel(self): + return # TODO: Make tests independent of system state # get a policy cache = apt.Cache() policy = cache._depcache.policy @@ -29,6 +30,7 @@ class TestAptPolicy(unittest.TestCase): self.assertTrue(policy.get_priority(pkgfile) < 1001) def test_apt_policy_highlevel(self): + return # TODO: Make tests independent of system state cache = apt.Cache() pkg = cache["apt"] self.assertTrue(pkg.candidate.policy_priority > 1 and -- cgit v1.2.3 From 002cd5cb0e6a9d0e20fff877b81f43b037346e8f Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Sat, 22 Feb 2014 17:46:42 +0100 Subject: tests/data/aptsources/sources.list.testDistribution: Add tanglu --- tests/data/aptsources/sources.list.testDistribution | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/data/aptsources/sources.list.testDistribution b/tests/data/aptsources/sources.list.testDistribution index 79224a34..021ee879 100644 --- a/tests/data/aptsources/sources.list.testDistribution +++ b/tests/data/aptsources/sources.list.testDistribution @@ -6,6 +6,7 @@ deb http://de.archive.ubuntu.com/ubuntu/ hardy-updates restricted deb http://de.archive.ubuntu.com/ubuntu/ hardy-security main deb http://de.archive.ubuntu.com/ubuntu/ hardy-security multiverse deb http://ftp.debian.org/debian sid main +deb http://archive.tanglu.org/tanglu aequorea main deb http://ftp.hosteurope.de/mirror/archive.ubuntu.com/ hardy main deb http://ftp.hosteurope.de/mirror/archive.ubuntu.com/ hardy-backports main deb http://archive.ubuntu.com/ubuntu/ intrepid main -- cgit v1.2.3 From 208d276e21daeb0976f749f7c2deeab58bd2dd95 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Sat, 22 Feb 2014 19:04:52 +0100 Subject: tests/test_policy.py: Fix comment to conform to PEP8 --- tests/test_policy.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/test_policy.py b/tests/test_policy.py index 27d69e4b..e9ea151f 100644 --- a/tests/test_policy.py +++ b/tests/test_policy.py @@ -13,7 +13,7 @@ import unittest class TestAptPolicy(unittest.TestCase): def test_apt_policy_lowlevel(self): - return # TODO: Make tests independent of system state + return # TODO: Make tests independent of system state # get a policy cache = apt.Cache() policy = cache._depcache.policy @@ -30,7 +30,7 @@ class TestAptPolicy(unittest.TestCase): self.assertTrue(policy.get_priority(pkgfile) < 1001) def test_apt_policy_highlevel(self): - return # TODO: Make tests independent of system state + return # TODO: Make tests independent of system state cache = apt.Cache() pkg = cache["apt"] self.assertTrue(pkg.candidate.policy_priority > 1 and -- cgit v1.2.3 From e80e2ee5f2d6415028a0ca9d58a6714ac10a5a4b Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Sat, 22 Feb 2014 19:06:04 +0100 Subject: Release 0.9.3 --- debian/changelog | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/debian/changelog b/debian/changelog index 2a0d6b1d..c183cfc5 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,17 @@ +python-apt (0.9.3) unstable; urgency=medium + + * doc/source/conf.py: Python 3 support + * debian/rules: Use dh_sphinxdoc integration + * utils/doclint.py: Drop, not working anymore. + * python/generic.h: Fix MkPyNumber to work if char is unsigned. + * data: Add Tanglu distribution information + * debian/python3-apt-dbg.files: Fix pattern for kFreeBSD + * tests/test_policy.py: Disable, uses system state (FTBFS on ppc64) + * tests/data/aptsources/sources.list.testDistribution: Add tanglu + * tests/test_policy.py: Fix comment to conform to PEP8 + + -- Julian Andres Klode Sat, 22 Feb 2014 19:05:48 +0100 + python-apt (0.9.2) unstable; urgency=medium [ Michael Vogt ] -- cgit v1.2.3 From 7daf0144f4809b8f27d56d49d3a61ca67d77ead1 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Sat, 22 Feb 2014 20:32:48 +0100 Subject: debian/rules: Do not run dh_sphinxdoc -a Running dh_sphinxdoc -a causes the build to FTBFS on buildds, because the sphinx documentation is not built. Only run dh_sphinxdoc if we are building the sphinx documentation. --- debian/rules | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/debian/rules b/debian/rules index 37366324..3ceeb205 100755 --- a/debian/rules +++ b/debian/rules @@ -15,6 +15,11 @@ override_dh_install: dh_movefiles dh_install +override_dh_sphinxdoc: + set -e; if [ -z $(filter -a,$(DH_INTERNAL_OPTIONS)) ]; then \ + dh_sphinxdoc; \ + fi + override_dh_installdocs: set -e; if [ -z $(filter -a,$(DH_INTERNAL_OPTIONS)) ]; then \ python setup.py build_sphinx; \ -- cgit v1.2.3 From e2dc90ada1f861ee64cde554159f497d388e4df8 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Sat, 22 Feb 2014 20:33:15 +0100 Subject: Release 0.9.3.1 --- debian/changelog | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/debian/changelog b/debian/changelog index c183cfc5..a31611e2 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +python-apt (0.9.3.1) unstable; urgency=medium + + * debian/rules: Do not run dh_sphinxdoc -a + + -- Julian Andres Klode Sat, 22 Feb 2014 20:33:06 +0100 + python-apt (0.9.3) unstable; urgency=medium * doc/source/conf.py: Python 3 support -- cgit v1.2.3 From a8c7a3ea4d471cfe1fc4eec624e626c888726391 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Mon, 10 Mar 2014 14:31:38 +0100 Subject: Revert "* apt/cache.py:" (rootdir change) This reverts commit 5e76e9fccee519c63602562dc4065deb3f97748b. Conflicts: apt/cache.py debian/changelog --- apt/cache.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/apt/cache.py b/apt/cache.py index 593e70a7..36a9fa6b 100644 --- a/apt/cache.py +++ b/apt/cache.py @@ -85,16 +85,13 @@ class Cache(object): apt_pkg.config.set("Dir::Cache::pkgcache", "") if rootdir: rootdir = os.path.abspath(rootdir) - # clear old config first (Bug#728274) - apt_pkg.config.clear("APT") - apt_pkg.config.set("Dir", rootdir) - apt_pkg.init_config() if os.path.exists(rootdir + "/etc/apt/apt.conf"): apt_pkg.read_config_file(apt_pkg.config, rootdir + "/etc/apt/apt.conf") if os.path.isdir(rootdir + "/etc/apt/apt.conf.d"): apt_pkg.read_config_dir(apt_pkg.config, rootdir + "/etc/apt/apt.conf.d") + apt_pkg.config.set("Dir", rootdir) apt_pkg.config.set("Dir::State::status", rootdir + "/var/lib/dpkg/status") # also set dpkg to the rootdir path so that its called for the -- cgit v1.2.3 From eb2f471051965b4acded583710ab71621c3e6b4d Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Mon, 10 Mar 2014 14:35:08 +0100 Subject: Release 0.9.3.2 --- debian/changelog | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/debian/changelog b/debian/changelog index a31611e2..a6df3428 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,12 @@ +python-apt (0.9.3.2) unstable; urgency=high + + * Revert "* apt/cache.py:" (rootdir change) (Closes: #741251) (LP: #1288171) + + We cannot reset the configuration when rootdir is specified in + apt.Cache(). This reopens: #728274. + + -- Julian Andres Klode Mon, 10 Mar 2014 14:32:53 +0100 + python-apt (0.9.3.1) unstable; urgency=medium * debian/rules: Do not run dh_sphinxdoc -a -- cgit v1.2.3 From a05fa8f6bacea135ba2954e9702aa95b54203322 Mon Sep 17 00:00:00 2001 From: Steve Langasek Date: Sat, 15 Mar 2014 18:51:40 +0100 Subject: aptsources/sourceslist.py: ensure that our sources are opened with UTF-8 ensure that our sources are opened with UTF-8 encoding, regardless of the current locale, and handle the sources lines as Unicode internally for consistency between python2 and python3. LP: #1069019. [jak: Squashed a PEP8 fixup change by Brian Murray] --- aptsources/sourceslist.py | 39 +++++++++++++++++++++------------------ 1 file changed, 21 insertions(+), 18 deletions(-) diff --git a/aptsources/sourceslist.py b/aptsources/sourceslist.py index 91ce8eff..6065fee4 100644 --- a/aptsources/sourceslist.py +++ b/aptsources/sourceslist.py @@ -31,6 +31,7 @@ import os.path import re import shutil import time +import io import apt_pkg from .distinfo import DistInfo @@ -234,25 +235,26 @@ class SourceEntry(object): """ return the current line as string """ if self.invalid: return self.line - line = "" + line = u"" if self.disabled: - line = "# " + line = u"# " line += self.type if self.architectures and self.trusted is not None: - line += " [arch=%s trusted=%s]" % ( - ",".join(self.architectures), "yes" if self.trusted else "no") + line += u" [arch=%s trusted=%s]" % ( + u",".join(self.architectures), + u"yes" if self.trusted else u"no") elif self.trusted is not None: - line += " [trusted=%s]" % ("yes" if self.trusted else "no") + line += u" [trusted=%s]" % (u"yes" if self.trusted else u"no") elif self.architectures: - line += " [arch=%s]" % ",".join(self.architectures) - line += " %s %s" % (self.uri, self.dist) + line += u" [arch=%s]" % u",".join(self.architectures) + line += u" %s %s" % (self.uri, self.dist) if len(self.comps) > 0: - line += " " + " ".join(self.comps) + line += u" " + u" ".join(self.comps) if self.comment != "": - line += " #" + self.comment - line += "\n" + line += u" #" + self.comment + line += u"\n" return line @@ -343,13 +345,13 @@ class SourcesList(object): # there isn't any matching source, so create a new line and parse it line = type if architectures: - line += " [arch=%s]" % ",".join(architectures) - line += " %s %s" % (uri, dist) + line += u" [arch=%s]" % u",".join(architectures) + line += u" %s %s" % (uri, dist) for c in comps: - line = line + " " + c + line = line + u" " + c if comment != "": - line = "%s #%s\n" % (line, comment) - line = line + "\n" + line = u"%s #%s\n" % (line, comment) + line = line + u"\n" new_entry = SourceEntry(line) if file is not None: new_entry.file = file @@ -387,7 +389,7 @@ class SourcesList(object): def load(self, file): """ (re)load the current sources """ try: - with open(file, "r") as f: + with io.open(file, "r", encoding="utf-8") as f: for line in f: source = SourceEntry(line, file) self.list.append(source) @@ -405,14 +407,15 @@ class SourcesList(object): "# Remember that you can only use http, ftp or file URIs\n" "# CDROMs are managed through the apt-cdrom tool.\n") - with open(path, "w") as f: + with io.open(path, "w", encoding="utf-8") as f: f.write(header) return try: for source in self.list: if source.file not in files: - files[source.file] = open(source.file, "w") + files[source.file] = io.open(source.file, "w", + encoding="utf-8") files[source.file].write(source.str()) finally: for f in files: -- cgit v1.2.3 From 39d8d407894b9d6416bac445440b0a761c8afe56 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Sat, 15 Mar 2014 18:54:03 +0100 Subject: Release 0.9.3.3 --- debian/changelog | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/debian/changelog b/debian/changelog index a6df3428..3a9af935 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,16 @@ +python-apt (0.9.3.3) unstable; urgency=medium + + [ Steve Langasek ] + * aptsources/sourceslist.py: ensure that our sources are opened with UTF-8 + encoding, regardless of the current locale, and handle the sources lines + as Unicode internally for consistency between python2 and python3. + LP: #1069019. + + [ Brian Murray ] + * Fix pep8 error. + + -- Julian Andres Klode Sat, 15 Mar 2014 18:53:58 +0100 + python-apt (0.9.3.2) unstable; urgency=high * Revert "* apt/cache.py:" (rootdir change) (Closes: #741251) (LP: #1288171) -- cgit v1.2.3 From 47dfb3fac23721f76fc3084835f2c3c6382777ce Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Sun, 16 Mar 2014 20:42:27 +0100 Subject: python/progress.cc: Fix InstallProgress to set child_pid (LP: #1177720) We do not wait for a child at all otherwise. --- python/progress.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/python/progress.cc b/python/progress.cc index a7cf1afa..9b813d74 100644 --- a/python/progress.cc +++ b/python/progress.cc @@ -362,6 +362,9 @@ pkgPackageManager::OrderResult PyInstallProgress::Run(pkgPackageManager *pm) child_id = fork(); } + PyObject *child_o = PyLong_FromLong(child_id); + PyObject_SetAttrString(callbackInst, "child_pid", child_o); + Py_DECREF(child_o); #if 0 // FIXME: this needs to be merged into apt to support medium swaping if (child_id == 0) { -- cgit v1.2.3 From cd47e3e7e0a87ead87724d0120d408b7993e94c7 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Sun, 16 Mar 2014 20:43:44 +0100 Subject: python/progress.cc: Remove invalid checks for mixedCase methods They are not working, because they set an exception if the mixedCase name is missing. --- python/progress.cc | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/python/progress.cc b/python/progress.cc index 9b813d74..425ca501 100644 --- a/python/progress.cc +++ b/python/progress.cc @@ -308,24 +308,21 @@ bool PyFetchProgress::Pulse(pkgAcquire * Owner) void PyInstallProgress::StartUpdate() { - if (!RunSimpleCallback("startUpdate")) - RunSimpleCallback("start_update"); + RunSimpleCallback("start_update"); PyCbObj_BEGIN_ALLOW_THREADS } void PyInstallProgress::UpdateInterface() { PyCbObj_END_ALLOW_THREADS - if (!RunSimpleCallback("updateInterface")) - RunSimpleCallback("update_interface"); + RunSimpleCallback("update_interface"); PyCbObj_BEGIN_ALLOW_THREADS } void PyInstallProgress::FinishUpdate() { PyCbObj_END_ALLOW_THREADS - if (!RunSimpleCallback("finishUpdate")) - RunSimpleCallback("finish_update"); + RunSimpleCallback("finish_update"); } pkgPackageManager::OrderResult PyInstallProgress::Run(pkgPackageManager *pm) -- cgit v1.2.3 From b3696b91a76226ced91e8e9de5f7d55642f1ee7a Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Sun, 16 Mar 2014 21:24:12 +0100 Subject: utils/get_*_mirrors*.py: Ensure failure if no mirrors were read This ensures that we do not accidentally build a package without a mirror list, just because the servers have some error or empty file which we do not know about (for example, Launchpad may have a 503, and we would not notice). --- utils/get_debian_mirrors.py | 10 ++++++++-- utils/get_ubuntu_mirrors_from_lp.py | 7 +++++++ 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/utils/get_debian_mirrors.py b/utils/get_debian_mirrors.py index c1ec3be8..4d34f5b6 100755 --- a/utils/get_debian_mirrors.py +++ b/utils/get_debian_mirrors.py @@ -17,7 +17,9 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 # USA +from __future__ import print_function import collections +import sys import urllib2 from debian_bundle import deb822 @@ -36,6 +38,10 @@ for mirror in deb822.Deb822.iter_paragraphs(masterlist): mirrors[country].add("%s://%s%s" % (proto, site, mirror["Archive-%s" % proto])) +if len(mirrors) == 0: + print("E: Could not read the mirror list due to some unknown issue", + file=sys.stderr) + sys.exit(1) for country in sorted(mirrors): - print "#LOC:%s" % country - print "\n".join(sorted(mirrors[country])) + print("#LOC:%s" % country) + print("\n".join(sorted(mirrors[country]))) diff --git a/utils/get_ubuntu_mirrors_from_lp.py b/utils/get_ubuntu_mirrors_from_lp.py index 6ff2d885..8fc34c8d 100755 --- a/utils/get_ubuntu_mirrors_from_lp.py +++ b/utils/get_ubuntu_mirrors_from_lp.py @@ -24,6 +24,7 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 # USA +import sys import feedparser d = feedparser.parse("https://launchpad.net/ubuntu/+archivemirrors-rss") @@ -40,6 +41,12 @@ for entry in d.entries: keys = sorted(countries) + +if len(keys) == 0: + print("E: Could not read the mirror list due to some issue" + " -- status code: %s" % d.status, file=sys.stderr) + sys.exit(1) + print("mirror://mirrors.ubuntu.com/mirrors.txt") for country in keys: print("#LOC:%s" % country) -- cgit v1.2.3 From b9844054663142c3e8dad1a6e1b3612c7db2054b Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Sun, 16 Mar 2014 21:43:36 +0100 Subject: utils/get_*_mirrors*.py: Use sys.stderr.write instead of print pyflakes does not handle from __future__ import print_function, so work around it. --- utils/get_debian_mirrors.py | 4 ++-- utils/get_ubuntu_mirrors_from_lp.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/utils/get_debian_mirrors.py b/utils/get_debian_mirrors.py index 4d34f5b6..5f4d7ff0 100755 --- a/utils/get_debian_mirrors.py +++ b/utils/get_debian_mirrors.py @@ -39,8 +39,8 @@ for mirror in deb822.Deb822.iter_paragraphs(masterlist): mirror["Archive-%s" % proto])) if len(mirrors) == 0: - print("E: Could not read the mirror list due to some unknown issue", - file=sys.stderr) + sys.stderr.write("E: Could not read the mirror list due to " + "some unknown issue\n") sys.exit(1) for country in sorted(mirrors): print("#LOC:%s" % country) diff --git a/utils/get_ubuntu_mirrors_from_lp.py b/utils/get_ubuntu_mirrors_from_lp.py index 8fc34c8d..dd02b63d 100755 --- a/utils/get_ubuntu_mirrors_from_lp.py +++ b/utils/get_ubuntu_mirrors_from_lp.py @@ -43,8 +43,8 @@ for entry in d.entries: keys = sorted(countries) if len(keys) == 0: - print("E: Could not read the mirror list due to some issue" - " -- status code: %s" % d.status, file=sys.stderr) + sys.stderr.write("E: Could not read the mirror list due to some issue" + " -- status code: %s\n" % d.status) sys.exit(1) print("mirror://mirrors.ubuntu.com/mirrors.txt") -- cgit v1.2.3 From 3c9e1b4fce9a587436965c495f5e43f96e115207 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Mon, 17 Mar 2014 14:39:25 +0100 Subject: Support all compressors for data.tar/control.tar (Closes: #718330) This makes our support very flexible, and open for future additions of new compression algorithms. debfile_extract_tar() is almost identical to ExtractTarMember() of apt's debDebFile. --- python/arfile.cc | 72 ++++++++++++++++++++++------------- tests/data/test_debs/data-tar-xz.deb | Bin 626 -> 680 bytes tests/data/test_debs/data-tar.deb | Bin 0 -> 20672 bytes tests/test_debfile.py | 6 +++ tests/test_paths.py | 8 ++-- 5 files changed, 55 insertions(+), 31 deletions(-) create mode 100644 tests/data/test_debs/data-tar.deb diff --git a/python/arfile.cc b/python/arfile.cc index 8f45e658..3284ff7c 100644 --- a/python/arfile.cc +++ b/python/arfile.cc @@ -523,6 +523,45 @@ static PyObject *_gettar(PyDebFileObject *self, const ARArchive::Member *m, return tarfile; } +/* + * Mostly copy-paste from APT + */ +static PyObject *debfile_get_tar(PyDebFileObject *self, const char *Name) +{ + // Get the archive member + const ARArchive::Member *Member = NULL; + const ARArchive &AR = *self->Object; + std::string Compressor; + + std::vector compressor = + APT::Configuration::getCompressors(); + for (std::vector::const_iterator c = + compressor.begin(); c != compressor.end(); ++c) { + Member = AR.FindMember(std::string(Name).append(c->Extension).c_str()); + if (Member == NULL) + continue; + Compressor = c->Binary; + break; + } + + if (Member == NULL) + Member = AR.FindMember(std::string(Name).c_str()); + + if (Member == NULL) { + std::string ext = std::string(Name) + ".{"; + for (std::vector::const_iterator c = + compressor.begin(); c != compressor.end(); ++c) { + if (!c->Extension.empty()) + ext.append(c->Extension.substr(1)); + } + ext.append("}"); + _error->Error(("Internal error, could not locate member %s"), + ext.c_str()); + return HandleErrors(); + } + + return _gettar(self, Member, Compressor.c_str()); +} static PyObject *debfile_new(PyTypeObject *type, PyObject *args, PyObject *kwds) @@ -532,34 +571,13 @@ static PyObject *debfile_new(PyTypeObject *type, PyObject *args, PyObject *kwds) return NULL; // DebFile - self->control = _gettar(self, self->Object->FindMember("control.tar.gz"), - "gzip"); - if (!self->control) - return PyErr_Format(PyExc_SystemError, "No debian archive, missing %s", - "control.tar.gz"); - - // try all compression types - std::vector types = APT::Configuration::getCompressionTypes(); - for (std::vector::const_iterator t = types.begin(); - t != types.end(); ++t) { - std::string member = std::string("data.tar.").append(*t); - std::string comp = _config->Find(std::string("Acquire::CompressionTypes::").append(*t)); - self->data = _gettar(self, self->Object->FindMember(member.c_str()), - comp.c_str()); - if (self->data) - break; - } - // no data found, we need to - if (!self->data) { - std::string error; - for (std::vector::const_iterator t = types.begin(); - t != types.end(); ++t) - error.append(*t + ","); - return PyErr_Format(PyExc_SystemError, - "No debian archive, missing data.tar.{%s}", - error.c_str()); - } + self->control = debfile_get_tar(self, "control.tar"); + if (self->control == NULL) + return NULL; + self->data = debfile_get_tar(self, "data.tar"); + if (self->data == NULL) + return NULL; const ARArchive::Member *member = self->Object->FindMember("debian-binary"); if (!member) diff --git a/tests/data/test_debs/data-tar-xz.deb b/tests/data/test_debs/data-tar-xz.deb index fc15f597..9dd4d670 100644 Binary files a/tests/data/test_debs/data-tar-xz.deb and b/tests/data/test_debs/data-tar-xz.deb differ diff --git a/tests/data/test_debs/data-tar.deb b/tests/data/test_debs/data-tar.deb new file mode 100644 index 00000000..d8e4a988 Binary files /dev/null and b/tests/data/test_debs/data-tar.deb differ diff --git a/tests/test_debfile.py b/tests/test_debfile.py index ec3bf518..21255517 100644 --- a/tests/test_debfile.py +++ b/tests/test_debfile.py @@ -120,6 +120,12 @@ Description: testpackage for gdebi - contains usr/bin/binary for file reading deb = apt.debfile.DebPackage("./data/test_debs/data-tar-xz.deb") self.assertEqual(deb.filelist, ["./", "usr/", "usr/bin/"]) + @unittest.skipIf(apt_pkg.version_compare(apt_pkg.VERSION, "0.9.15.4~") < 0, + "APT too old for uncompressed control.tar/data.tar") + def test_uncompressed_data(self): + deb = apt.debfile.DebPackage("./data/test_debs/data-tar.deb") + self.assertEqual(deb.filelist, ["./", "usr/", "usr/bin/"]) + def test_check_exception(self): deb = apt.debfile.DebPackage("./data/test_debs/data-tar-xz.deb") self.assertRaises(AttributeError, lambda: deb.missing_deps) diff --git a/tests/test_paths.py b/tests/test_paths.py index 62ea1665..51d22f49 100644 --- a/tests/test_paths.py +++ b/tests/test_paths.py @@ -53,8 +53,8 @@ class TestPath(unittest.TestCase): self.assertTrue(archive[b"debian-binary"]) self.assertTrue(archive[u"debian-binary"]) - tar = archive.gettar(u"control.tar.gz", "gzip") - tar = archive.gettar(b"control.tar.gz", "gzip") + tar = archive.gettar(u"control.tar.xz", "xz") + tar = archive.gettar(b"control.tar.xz", "xz") tar.extractall(self.dir_unicode) tar.extractall(self.dir_bytes) @@ -63,8 +63,8 @@ class TestPath(unittest.TestCase): tar.extractdata(b"control") tar.extractdata(u"control") - apt_inst.TarFile(os.path.join(self.dir_unicode, u"control.tar.gz")) - apt_inst.TarFile(os.path.join(self.dir_bytes, b"control.tar.gz")) + apt_inst.TarFile(os.path.join(self.dir_unicode, u"control.tar.xz")) + apt_inst.TarFile(os.path.join(self.dir_bytes, b"control.tar.xz")) def test_configuration(self): with open(self.file_unicode, 'w') as config: -- cgit v1.2.3 From 50a8a9d573d97f0678721a84bcf9fdc697e96cb0 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Tue, 18 Mar 2014 19:26:52 +0100 Subject: Revert "aptsources/sourceslist.py: ensure that our sources are opened with UTF-8" This reverts commit a05fa8f6bacea135ba2954e9702aa95b54203322. --- aptsources/sourceslist.py | 39 ++++++++++++++++++--------------------- 1 file changed, 18 insertions(+), 21 deletions(-) diff --git a/aptsources/sourceslist.py b/aptsources/sourceslist.py index 6065fee4..91ce8eff 100644 --- a/aptsources/sourceslist.py +++ b/aptsources/sourceslist.py @@ -31,7 +31,6 @@ import os.path import re import shutil import time -import io import apt_pkg from .distinfo import DistInfo @@ -235,26 +234,25 @@ class SourceEntry(object): """ return the current line as string """ if self.invalid: return self.line - line = u"" + line = "" if self.disabled: - line = u"# " + line = "# " line += self.type if self.architectures and self.trusted is not None: - line += u" [arch=%s trusted=%s]" % ( - u",".join(self.architectures), - u"yes" if self.trusted else u"no") + line += " [arch=%s trusted=%s]" % ( + ",".join(self.architectures), "yes" if self.trusted else "no") elif self.trusted is not None: - line += u" [trusted=%s]" % (u"yes" if self.trusted else u"no") + line += " [trusted=%s]" % ("yes" if self.trusted else "no") elif self.architectures: - line += u" [arch=%s]" % u",".join(self.architectures) - line += u" %s %s" % (self.uri, self.dist) + line += " [arch=%s]" % ",".join(self.architectures) + line += " %s %s" % (self.uri, self.dist) if len(self.comps) > 0: - line += u" " + u" ".join(self.comps) + line += " " + " ".join(self.comps) if self.comment != "": - line += u" #" + self.comment - line += u"\n" + line += " #" + self.comment + line += "\n" return line @@ -345,13 +343,13 @@ class SourcesList(object): # there isn't any matching source, so create a new line and parse it line = type if architectures: - line += u" [arch=%s]" % u",".join(architectures) - line += u" %s %s" % (uri, dist) + line += " [arch=%s]" % ",".join(architectures) + line += " %s %s" % (uri, dist) for c in comps: - line = line + u" " + c + line = line + " " + c if comment != "": - line = u"%s #%s\n" % (line, comment) - line = line + u"\n" + line = "%s #%s\n" % (line, comment) + line = line + "\n" new_entry = SourceEntry(line) if file is not None: new_entry.file = file @@ -389,7 +387,7 @@ class SourcesList(object): def load(self, file): """ (re)load the current sources """ try: - with io.open(file, "r", encoding="utf-8") as f: + with open(file, "r") as f: for line in f: source = SourceEntry(line, file) self.list.append(source) @@ -407,15 +405,14 @@ class SourcesList(object): "# Remember that you can only use http, ftp or file URIs\n" "# CDROMs are managed through the apt-cdrom tool.\n") - with io.open(path, "w", encoding="utf-8") as f: + with open(path, "w") as f: f.write(header) return try: for source in self.list: if source.file not in files: - files[source.file] = io.open(source.file, "w", - encoding="utf-8") + files[source.file] = open(source.file, "w") files[source.file].write(source.str()) finally: for f in files: -- cgit v1.2.3 From 05c43e3e9c3eb97898f12de0297f81b3ed0b6c89 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Thu, 20 Mar 2014 16:49:27 +0100 Subject: Release 0.9.3.4 --- debian/changelog | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/debian/changelog b/debian/changelog index 3a9af935..582de786 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,15 @@ +python-apt (0.9.3.4) unstable; urgency=medium + + * python/progress.cc: Fix InstallProgress to set child_pid (LP: #1177720) + * python/progress.cc: Remove invalid checks for mixedCase methods + * utils/get_*_mirrors*.py: Ensure failure if no mirrors were read + * utils/get_*_mirrors*.py: Use sys.stderr.write instead of print + * Support all compressors for data.tar/control.tar (Closes: #718330) + * Revert "aptsources/sourceslist.py: ensure that our sources are opened with UTF-8" + (Closes: #742118) + + -- Julian Andres Klode Thu, 20 Mar 2014 16:48:12 +0100 + python-apt (0.9.3.3) unstable; urgency=medium [ Steve Langasek ] -- cgit v1.2.3 From ab1e0bbef9c41017640e90c36b0beeb942a16b2f Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Sat, 22 Mar 2014 18:14:53 +0100 Subject: utils/get_ubuntu_mirrors.py: Drop, its unused and broken The Ubuntu wiki does not include a list of mirrors anymore.o --- utils/get_ubuntu_mirrors.py | 57 --------------------------------------------- 1 file changed, 57 deletions(-) delete mode 100755 utils/get_ubuntu_mirrors.py diff --git a/utils/get_ubuntu_mirrors.py b/utils/get_ubuntu_mirrors.py deleted file mode 100755 index 01344852..00000000 --- a/utils/get_ubuntu_mirrors.py +++ /dev/null @@ -1,57 +0,0 @@ -#!/usr/bin/env python -# -# get_ubuntu_mirrors.py -# -# Download the latest list with available mirrors from the Ubuntu -# wiki and extract the hosts from the raw page -# -# Copyright (c) 2006 Free Software Foundation Europe -# -# Author: Sebastian Heinlein -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -# USA - -import urllib2 -import re -import sys - -# the list of official Ubuntu servers -mirrors = [] -# path to the local mirror list -list_path = "../data/templates/Ubuntu.mirrors" - -req = urllib2.Request("https://wiki.ubuntu.com/Archive?action=raw") - -try: - print "Downloading mirrors list from the Ubuntu wiki..." - uri = urllib2.urlopen(req) - p = re.compile('^.*((http|ftp):\/\/[A-Za-z0-9-.:\/_]+).*\n*$') - for line in uri.readlines(): - if r"[[Anchor(dvd-images)]]" in line: - break - if "http://" in line or "ftp://" in line: - mirrors.append(p.sub(r"\1", line)) - uri.close() -except: - print "Failed to download or extract the mirrors list!" - sys.exit(1) - -print "Writing local mirrors list: %s" % list_path -list = open(list_path, "w") -for mirror in mirrors: - list.write("%s\n" % mirror) -list.close() -print "Done." -- cgit v1.2.3 From 774c68832202d8fa4ef1432d8c180e9a4794feba Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Sat, 22 Mar 2014 18:19:04 +0100 Subject: doc/source/conf.py: Do not use 'u' and 'r' prefixes together This does not work in Python 3. --- doc/source/conf.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/source/conf.py b/doc/source/conf.py index 41dda03c..6775269f 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -213,8 +213,8 @@ htmlhelp_basename = 'python-aptdoc' # Grouping the document tree into LaTeX files. List of tuples # (source index, target name, title, author, document class [howto/manual]). latex_documents = [ - ('contents', 'python-apt.tex', ur'python-apt Documentation', - ur'Julian Andres Klode ', 'manual'), + ('contents', 'python-apt.tex', u'python-apt Documentation', + u'Julian Andres Klode ', 'manual'), ] # The name of an image file (relative to this directory) to place at the top of -- cgit v1.2.3 From db910e38e65586c7ab7875edbe2b7f21e03d5450 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Sat, 22 Mar 2014 18:34:33 +0100 Subject: tests: Drop some more Python 2.6 cruft We do not support Python 2.6 anymore, so we can get rid of this. --- tests/test_apt_cache.py | 8 +------- tests/test_auth.py | 12 ------------ 2 files changed, 1 insertion(+), 19 deletions(-) diff --git a/tests/test_apt_cache.py b/tests/test_apt_cache.py index ee4fc50b..4df5e27d 100644 --- a/tests/test_apt_cache.py +++ b/tests/test_apt_cache.py @@ -16,12 +16,6 @@ import sys import tempfile import unittest -if sys.version_info[0] == 2 and sys.version_info[1] == 6: - from unittest2 import TestCase - TestCase # pyflakes -else: - from unittest import TestCase - from test_all import get_library_dir libdir = get_library_dir() @@ -51,7 +45,7 @@ def get_open_file_descriptors(): return set(map(int, fds)) -class TestAptCache(TestCase): +class TestAptCache(unittest.TestCase): """ test the apt cache """ def setUp(self): diff --git a/tests/test_auth.py b/tests/test_auth.py index dafbdc31..790ed380 100644 --- a/tests/test_auth.py +++ b/tests/test_auth.py @@ -115,18 +115,6 @@ class TestAuthKeys(unittest.TestCase): """Test handling of keys for signed repositories.""" - if sys.version_info[0] == 2 and sys.version_info[1] < 7: - def addCleanup(self, function, *args, **kwds): - try: - self.cleanup.append(lambda: function(*args, **kwds)) - except AttributeError: - self.cleanup = [lambda: function(*args, **kwds)] - - def tearDown(self): - for f in self.cleanup: - f() - self.cleanup = [] - def setUp(self): # reset any config manipulations done in the individual tests apt_pkg.init_config() -- cgit v1.2.3 From faef2c5236d0966e3ecf3dcee52f0fe2e3aaf7b6 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Sat, 22 Mar 2014 20:04:26 +0100 Subject: debian/control: Drop X{B,S}-Python-Version and use X-Python-Version The others are deprecated. --- debian/control | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/debian/control b/debian/control index 4bc26ff3..db785fbe 100644 --- a/debian/control +++ b/debian/control @@ -4,7 +4,7 @@ Priority: standard Maintainer: APT Development Team Uploaders: Michael Vogt , Julian Andres Klode Standards-Version: 3.9.5 -XS-Python-Version: >= 2.7 +X-Python-Version: >= 2.7 X-Python3-Version: >= 3.3 Build-Depends: apt (>= 0.9.6), apt-utils, @@ -58,7 +58,6 @@ Breaks: packagekit-backend-apt (<= 0.4.8-0ubuntu4), wajig (<< 2.0.46) Provides: ${python:Provides} Suggests: python-apt-dbg, python-gtk2, python-vte, python-apt-doc -XB-Python-Version: ${python:Versions} Description: Python interface to libapt-pkg The apt_pkg Python interface will provide full access to the internal libapt-pkg structures allowing Python programs to easily perform a @@ -93,7 +92,6 @@ Multi-Arch: allowed Section: debug Depends: python-dbg, python-apt (= ${binary:Version}), ${shlibs:Depends}, ${misc:Depends} -XB-Python-Version: ${python:Versions} Description: Python interface to libapt-pkg (debug extension) The apt_pkg Python interface will provide full access to the internal libapt-pkg structures allowing Python programs to easily perform a -- cgit v1.2.3 From 9b4ed293fc9e903775bed8a237c4654f574b5f77 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Sat, 22 Mar 2014 20:06:18 +0100 Subject: debian/pycompat: Drop, it's not used anymore --- debian/pycompat | 1 - 1 file changed, 1 deletion(-) delete mode 100644 debian/pycompat diff --git a/debian/pycompat b/debian/pycompat deleted file mode 100644 index 0cfbf088..00000000 --- a/debian/pycompat +++ /dev/null @@ -1 +0,0 @@ -2 -- cgit v1.2.3 From 3f931a65d810a1d74d20523b644f009fddb4105c Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Sat, 22 Mar 2014 20:32:51 +0100 Subject: python/tag.cc: Ignore missing 'encoding' attribute in file objects In case the encoding attribute does not exist, Python sets an exception. We must thus clear the exception, otherwise it might be raised at some later point in the code. --- python/tag.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/python/tag.cc b/python/tag.cc index 9f175cc4..50786cee 100644 --- a/python/tag.cc +++ b/python/tag.cc @@ -474,6 +474,8 @@ static PyObject *TagFileNew(PyTypeObject *type,PyObject *Args,PyObject *kwds) #if PY_MAJOR_VERSION >= 3 if (fileno != -1) { New->Encoding = PyObject_GetAttr(File, PyUnicode_FromString("encoding")); + if (!New->Encoding) + PyErr_Clear(); if (New->Encoding && !PyUnicode_Check(New->Encoding)) New->Encoding = 0; } else -- cgit v1.2.3 From 9b3b1d216a844279d50cdd87a302069710f873c9 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Wed, 2 Apr 2014 00:18:36 +0200 Subject: apt/package.py: Do not shadow _ This can lead to bugs later on and makes pyflakes 0.8 cry. --- apt/package.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/apt/package.py b/apt/package.py index d75a5185..c67540e6 100644 --- a/apt/package.py +++ b/apt/package.py @@ -436,7 +436,7 @@ class Version(object): """ priority = 0 policy = self.package._pcache._depcache.policy - for (packagefile, _) in self._cand.file_list: + for (packagefile, _unused) in self._cand.file_list: priority = max(priority, policy.get_priority(packagefile)) return priority @@ -493,7 +493,7 @@ class Version(object): def origins(self): """Return a list of origins for the package version.""" origins = [] - for (packagefile, _) in self._cand.file_list: + for (packagefile, _unused) in self._cand.file_list: origins.append(Origin(self.package, packagefile)) return origins @@ -544,7 +544,7 @@ class Version(object): .. versionadded:: 0.7.10 """ - for (packagefile, _) in self._cand.file_list: + for (packagefile, _unused) in self._cand.file_list: indexfile = self.package._pcache._list.find_index(packagefile) if indexfile: yield indexfile.archive_uri(self._records.filename) -- cgit v1.2.3 From 6d629062a9ccd7d69985bf5c3def764a0a118ba6 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Wed, 2 Apr 2014 00:37:56 +0200 Subject: Release 0.9.3.5 --- debian/changelog | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/debian/changelog b/debian/changelog index 582de786..ad11226a 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,15 @@ +python-apt (0.9.3.5) unstable; urgency=medium + + * utils/get_ubuntu_mirrors.py: Drop, its unused and broken + * doc/source/conf.py: Do not use 'u' and 'r' prefixes together + * tests: Drop some more Python 2.6 cruft + * debian/control: Drop X{B,S}-Python-Version and use X-Python-Version + * debian/pycompat: Drop, it's not used anymore + * python/tag.cc: Ignore missing 'encoding' attribute in file objects + * apt/package.py: Do not shadow _ + + -- Julian Andres Klode Wed, 02 Apr 2014 00:37:27 +0200 + python-apt (0.9.3.4) unstable; urgency=medium * python/progress.cc: Fix InstallProgress to set child_pid (LP: #1177720) -- cgit v1.2.3 From c793c367d32d5a5adc220268ac4a0144419ac4d0 Mon Sep 17 00:00:00 2001 From: Johannes Schauer Date: Fri, 25 Apr 2014 10:53:09 +0200 Subject: Add support for build profiles Closes: 744243 --- python/apt_pkgmodule.cc | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/python/apt_pkgmodule.cc b/python/apt_pkgmodule.cc index 644827c3..5f211b3e 100644 --- a/python/apt_pkgmodule.cc +++ b/python/apt_pkgmodule.cc @@ -156,8 +156,8 @@ static const char *parse_src_depends_doc = "If 'strip_multi_arch' is True, :any (and potentially other special values)\n" "will be stripped from the full package name"; static PyObject *RealParseDepends(PyObject *Self,PyObject *Args, - bool ParseArchFlags, std::string name, - bool debStyle=false) + bool ParseArchFlags, bool ParseRestrictionsList, + std::string name, bool debStyle=false) { std::string Package; std::string Version; @@ -180,7 +180,8 @@ static PyObject *RealParseDepends(PyObject *Self,PyObject *Args, break; Start = debListParser::ParseDepends(Start,Stop,Package,Version,Op, - ParseArchFlags, StripMultiArch); + ParseArchFlags, StripMultiArch, + ParseRestrictionsList); if (Start == 0) { PyErr_SetString(PyExc_ValueError,"Problem Parsing Dependency"); @@ -213,11 +214,11 @@ static PyObject *RealParseDepends(PyObject *Self,PyObject *Args, } static PyObject *ParseDepends(PyObject *Self,PyObject *Args) { - return RealParseDepends(Self, Args, false, "parse_depends"); + return RealParseDepends(Self, Args, false, false, "parse_depends"); } static PyObject *ParseSrcDepends(PyObject *Self,PyObject *Args) { - return RealParseDepends(Self, Args, true, "parse_src_depends"); + return RealParseDepends(Self, Args, true, true, "parse_src_depends"); } /*}}}*/ // md5sum - Compute the md5sum of a file or string /*{{{*/ -- cgit v1.2.3 From 5b20a0c8bd6260b01f42ea402a7c4118921a75d9 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Fri, 25 Apr 2014 11:05:04 +0200 Subject: debian/control: update build-depends on libapt-pkg-dev for build-profile support --- debian/control | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/control b/debian/control index db785fbe..ce5eecb3 100644 --- a/debian/control +++ b/debian/control @@ -10,7 +10,7 @@ Build-Depends: apt (>= 0.9.6), apt-utils, debhelper (>= 9), fakeroot, - libapt-pkg-dev (>= 0.8.11), + libapt-pkg-dev (>= 0.9.16.1), python-all-dev (>= 2.7), python-all-dbg, python3-all-dev (>= 3.3), -- cgit v1.2.3 From b416712057aa10881352c660693bd345dd88e50b Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Fri, 25 Apr 2014 12:57:52 +0200 Subject: add ubuntu utopic --- data/templates/Ubuntu.info.in | 119 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 119 insertions(+) diff --git a/data/templates/Ubuntu.info.in b/data/templates/Ubuntu.info.in index 6a125d51..0d26c805 100644 --- a/data/templates/Ubuntu.info.in +++ b/data/templates/Ubuntu.info.in @@ -107,6 +107,125 @@ MatchURI: archive.ubuntu.com/ubuntu|ports.ubuntu.com/ubuntu-ports _Description: Unsupported updates +Suite: utopic +RepositoryType: deb +BaseURI: http://ports.ubuntu.com/ubuntu-ports/ +MatchURI: ports.ubuntu.com/ubuntu-ports +BaseURI-amd64: http://archive.ubuntu.com/ubuntu +MatchURI-amd64: archive.ubuntu.com/ubuntu +BaseURI-i386: http://archive.ubuntu.com/ubuntu +MatchURI-i386: archive.ubuntu.com/ubuntu +MirrorsFile-amd64: Ubuntu.mirrors +MirrorsFile-i386: Ubuntu.mirrors +_Description: Ubuntu 14.10 'Utopic Unicorn' +Component: main +_CompDescription: Officially supported +_CompDescriptionLong: Canonical-supported free and open-source software +Component: universe +_CompDescription: Community-maintained +_CompDescriptionLong: Community-maintained free and open-source software +Component: restricted +_CompDescription: Non-free drivers +_CompDescriptionLong: Proprietary drivers for devices +Component: multiverse +ParentComponent: universe +_CompDescription: Restricted software +_CompDescriptionLong: Software restricted by copyright or legal issues + +Suite: utopic +ParentSuite: utopic +RepositoryType: deb-src +BaseURI: http://archive.ubuntu.com/ubuntu/ +MatchURI: archive.ubuntu.com/ubuntu|ports.ubuntu.com/ubuntu-ports +_Description: Ubuntu 14.10 'Utopic Unicorn' + +Suite: utopic +RepositoryType: deb +MatchName: .* +BaseURI: cdrom:\[Ubuntu.*14.10 +MatchURI: cdrom:\[Ubuntu.*14.10 +_Description: Cdrom with Ubuntu 14.10 'Utopic Unicorn' +Available: False +Component: main +_CompDescription: Officially supported +Component: restricted +_CompDescription: Restricted copyright + +Suite: utopic +Official: false +RepositoryType: deb +BaseURI: http://archive.canonical.com +MatchURI: archive.canonical.com +_Description: Canonical Partners +Component: partner +_CompDescription: Software packaged by Canonical for their partners +_CompDescriptionLong: This software is not part of Ubuntu. + +Suite: utopic +Official: false +RepositoryType: deb +BaseURI: http://extras.ubuntu.com +MatchURI: extras.ubuntu.com +_Description: Independent +Component: main +_CompDescription: Provided by third-party software developers +_CompDescriptionLong: Software offered by third party developers. + +Suite: utopic-security +ParentSuite: utopic +RepositoryType: deb +BaseURI: http://ports.ubuntu.com/ubuntu-ports/ +MatchURI: ports.ubuntu.com/ubuntu-ports +BaseURI-amd64: http://security.ubuntu.com/ubuntu/ +MatchURI-amd64: archive.ubuntu.com/ubuntu|security.ubuntu.com +BaseURI-i386: http://security.ubuntu.com/ubuntu/ +MatchURI-i386: archive.ubuntu.com/ubuntu|security.ubuntu.com +_Description: Important security updates + +Suite: utopic-security +ParentSuite: utopic +RepositoryType: deb-src +BaseURI: http://archive.ubuntu.com/ubuntu/ +MatchURI: archive.ubuntu.com/ubuntu|ports.ubuntu.com/ubuntu-ports|security.ubuntu.com +_Description: Important security updates + +Suite: utopic-updates +ParentSuite: utopic +RepositoryType: deb +_Description: Recommended updates + +Suite: utopic-updates +ParentSuite: utopic +RepositoryType: deb-src +BaseURI: http://archive.ubuntu.com/ubuntu/ +MatchURI: archive.ubuntu.com/ubuntu|ports.ubuntu.com/ubuntu-ports +_Description: Recommended updates + +Suite: utopic-proposed +ParentSuite: utopic +RepositoryType: deb +_Description: Pre-released updates + +Suite: utopic-proposed +ParentSuite: utopic +RepositoryType: deb-src +BaseURI: http://archive.ubuntu.com/ubuntu/ +MatchURI: archive.ubuntu.com/ubuntu|ports.ubuntu.com/ubuntu-ports +_Description: Pre-released updates + +Suite: utopic-backports +ParentSuite: utopic +RepositoryType: deb +_Description: Unsupported updates + +Suite: utopic-backports +ParentSuite: utopic +RepositoryType: deb-src +BaseURI: http://archive.ubuntu.com/ubuntu/ +MatchURI: archive.ubuntu.com/ubuntu|ports.ubuntu.com/ubuntu-ports +_Description: Unsupported updates + + Suite: trusty RepositoryType: deb BaseURI: http://ports.ubuntu.com/ubuntu-ports/ -- cgit v1.2.3 From 27a191edc93368cc81b3589868186867cedd35b7 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Fri, 25 Apr 2014 13:00:16 +0200 Subject: releasing package python-apt version 0.9.3.6 --- debian/changelog | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/debian/changelog b/debian/changelog index ad11226a..45077f2e 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,16 @@ +python-apt (0.9.3.6) unstable; urgency=medium + + [ Johannes Schauer ] + * Add support for build profiles (Closes: 744243) + + [ Michael Vogt ] + * debian/control: + - update build-depends on libapt-pkg-dev for build-profile support + * data/templates/Ubuntu.info.in: + - add ubuntu utopic + + -- Michael Vogt Fri, 25 Apr 2014 13:00:08 +0200 + python-apt (0.9.3.5) unstable; urgency=medium * utils/get_ubuntu_mirrors.py: Drop, its unused and broken -- cgit v1.2.3 From 9de6a183f09f0d0adbcc5817872c5a0024f5ef47 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Fri, 6 Jun 2014 08:31:39 +0200 Subject: Include "Blankon" template Closes: #747498 --- data/templates/Blankon.info.in | 370 +++++++++++++++++++++++++++++++++++++++++ data/templates/Blankon.mirrors | 17 ++ 2 files changed, 387 insertions(+) create mode 100644 data/templates/Blankon.info.in create mode 100644 data/templates/Blankon.mirrors diff --git a/data/templates/Blankon.info.in b/data/templates/Blankon.info.in new file mode 100644 index 00000000..960ff223 --- /dev/null +++ b/data/templates/Blankon.info.in @@ -0,0 +1,370 @@ +ChangelogURI: http://arsip.blankonlinux.or.id/blankon/changelogs/pool/%s/%s/%s/%s_%s/changelog + +Suite: tambora +RepositoryType: deb +BaseURI: http://arsip.blankonlinux.or.id/blankon/ +MatchURI: arsip.blankonlinux.or.id/blankon +MirrorsFile-amd64: /usr/share/python-apt/templates/Blankon.mirrors +MirrorsFile-i386: /usr/share/python-apt/templates/Blankon.mirrors +_Description: Blankon 10.0 'Tambora' +Component: main +_CompDescription: Officially supported +_CompDescriptionLong: Blankon-supported Free/Open Source software +Component: extras +_CompDescription: Community-maintained +_CompDescriptionLong: Community-maintained Free/Open Source software +Component: restricted +_CompDescription: Non-free drivers +_CompDescriptionLong: Proprietary drivers for devices +Component: extras-restricted +_CompDescription: Restricted software +_CompDescriptionLong: Software restricted by copyright or legal issues + +Suite: tambora +MatchName: .* +BaseURI: cdrom:\[Blankon.*10.0 +MatchURI: cdrom:\[Blankon.*10.0 +_Description: CDROM with Blankon 10.0 'Tambora' +Available: False +Component: main +_CompDescription: Officially supported +Component: restricted +_CompDescription: Restricted copyright + +Suite: tambora-security +ParentSuite: tambora +RepositoryType: deb +BaseURI: http://arsip.blankonlinux.or.id/blankon/ +MatchURI: arsip.blankonlinux.or.id/blankon +_Description: Important security updates + +Suite: tambora-updates +ParentSuite: tambora +RepositoryType: deb +_Description: Recommended updates + +Suite: suroboyo +RepositoryType: deb +BaseURI: http://arsip.blankonlinux.or.id/blankon/ +MatchURI: arsip.blankonlinux.or.id/blankon +MirrorsFile-amd64: /usr/share/python-apt/templates/Blankon.mirrors +MirrorsFile-i386: /usr/share/python-apt/templates/Blankon.mirrors +_Description: Blankon 9.0 'Suroboyo' +Component: main +_CompDescription: Officially supported +_CompDescriptionLong: Blankon-supported Free/Open Source software +Component: extras +_CompDescription: Community-maintained +_CompDescriptionLong: Community-maintained Free/Open Source software +Component: restricted +_CompDescription: Non-free drivers +_CompDescriptionLong: Proprietary drivers for devices +Component: extras-restricted +_CompDescription: Restricted software +_CompDescriptionLong: Software restricted by copyright or legal issues + +Suite: suroboyo +MatchName: .* +BaseURI: cdrom:\[Blankon.*9.0 +MatchURI: cdrom:\[Blankon.*9.0 +_Description: CDROM with Blankon 9.0 'Suroboyo' +Available: False +Component: main +_CompDescription: Officially supported +Component: restricted +_CompDescription: Restricted copyright + +Suite: suroboyo-security +ParentSuite: suroboyo +RepositoryType: deb +BaseURI: http://arsip.blankonlinux.or.id/blankon/ +MatchURI: arsip.blankonlinux.or.id/blankon +_Description: Important security updates + +Suite: suroboyo-updates +ParentSuite: suroboyo +RepositoryType: deb +_Description: Recommended updates + +Suite: rote +RepositoryType: deb +BaseURI: http://arsip.blankonlinux.or.id/blankon/ +MatchURI: arsip.blankonlinux.or.id/blankon +MirrorsFile-amd64: /usr/share/python-apt/templates/Blankon.mirrors +MirrorsFile-i386: /usr/share/python-apt/templates/Blankon.mirrors +_Description: Blankon 8.0 'Rote' +Component: main +_CompDescription: Officially supported +_CompDescriptionLong: Blankon-supported Free/Open Source software +Component: extras +_CompDescription: Community-maintained +_CompDescriptionLong: Community-maintained Free/Open Source software +Component: restricted +_CompDescription: Non-free drivers +_CompDescriptionLong: Proprietary drivers for devices +Component: extras-restricted +_CompDescription: Restricted software +_CompDescriptionLong: Software restricted by copyright or legal issues + +Suite: rote +MatchName: .* +BaseURI: cdrom:\[Blankon.*8.0 +MatchURI: cdrom:\[Blankon.*8.0 +_Description: CDROM with Blankon 8.0 'Rote' +Available: False +Component: main +_CompDescription: Officially supported +Component: restricted +_CompDescription: Restricted copyright + +Suite: rote-security +ParentSuite: rote +RepositoryType: deb +BaseURI: http://arsip.blankonlinux.or.id/blankon/ +MatchURI: arsip.blankonlinux.or.id/blankon +_Description: Important security updates + +Suite: rote-updates +ParentSuite: rote +RepositoryType: deb +_Description: Recommended updates + +Suite: pattimura +RepositoryType: deb +BaseURI: http://arsip.blankonlinux.or.id/blankon-legacy/ +MatchURI: arsip.blankonlinux.or.id/blankon-legacy +MirrorsFile-amd64: /usr/share/python-apt/templates/Blankon.mirrors +MirrorsFile-i386: /usr/share/python-apt/templates/Blankon.mirrors +_Description: Blankon 7.0 'Pattimura' +Component: main +_CompDescription: Officially supported +_CompDescriptionLong: Blankon-supported Free/Open Source software +Component: extras +_CompDescription: Community-maintained +_CompDescriptionLong: Community-maintained Free/Open Source software +Component: restricted +_CompDescription: Non-free drivers +_CompDescriptionLong: Proprietary drivers for devices +Component: extras-restricted +_CompDescription: Restricted software +_CompDescriptionLong: Software restricted by copyright or legal issues + +Suite: pattimura +MatchName: .* +BaseURI: cdrom:\[Blankon.*7.0 +MatchURI: cdrom:\[Blankon.*7.0 +_Description: CDROM with Blankon 7.0 'Pattimura' +Available: False +Component: main +_CompDescription: Officially supported +Component: restricted +_CompDescription: Restricted copyright + +Suite: pattimura-security +ParentSuite: pattimura +RepositoryType: deb +BaseURI: http://arsip.blankonlinux.or.id/blankon-legacy/ +MatchURI: arsip.blankonlinux.or.id/blankon-legacy +_Description: Important security updates + +Suite: pattimura-updates +ParentSuite: pattimura +RepositoryType: deb +_Description: Recommended updates + +Suite: ombilin +RepositoryType: deb +BaseURI: http://arsip.blankonlinux.or.id/blankon-legacy/ +MatchURI: arsip.blankonlinux.or.id/blankon-legacy +MirrorsFile-amd64: /usr/share/python-apt/templates/Blankon.mirrors +MirrorsFile-i386: /usr/share/python-apt/templates/Blankon.mirrors +_Description: Blankon 6.0 'Ombilin' +Component: main +_CompDescription: Officially supported +_CompDescriptionLong: Blankon-supported Free/Open Source software +Component: extras +_CompDescription: Community-maintained +_CompDescriptionLong: Community-maintained Free/Open Source software +Component: restricted +_CompDescription: Non-free drivers +_CompDescriptionLong: Proprietary drivers for devices +Component: extras-restricted +_CompDescription: Restricted software +_CompDescriptionLong: Software restricted by copyright or legal issues + +Suite: ombilin +MatchName: .* +BaseURI: cdrom:\[Blankon.*6.0 +MatchURI: cdrom:\[Blankon.*6.0 +_Description: CDROM with Blankon 6.0 'Ombilin' +Available: False +Component: main +_CompDescription: Officially supported +Component: restricted +_CompDescription: Restricted copyright + +Suite: ombilin-security +ParentSuite: ombilin +RepositoryType: deb +BaseURI: http://arsip.blankonlinux.or.id/blankon-legacy/ +MatchURI: arsip.blankonlinux.or.id/blankon-legacy +_Description: Important security updates + +Suite: ombilin-updates +ParentSuite: ombilin +RepositoryType: deb +_Description: Recommended updates + +Suite: nanggar +RepositoryType: deb +BaseURI: http://arsip.blankonlinux.or.id/blankon-legacy/ +MatchURI: arsip.blankonlinux.or.id/blankon-legacy +MirrorsFile-amd64: /usr/share/python-apt/templates/Blankon.mirrors +MirrorsFile-i386: /usr/share/python-apt/templates/Blankon.mirrors +_Description: Blankon 5.0 'Nanggar' +Component: main +_CompDescription: Officially supported +_CompDescriptionLong: BlankOn-supported Open Source software +Component: universe +_CompDescription: Community-maintained +_CompDescriptionLong: Community-maintained Open Source software +Component: restricted +_CompDescription: Non-free drivers +_CompDescriptionLong: Proprietary drivers for devices +Component: multiverse +_CompDescription: Restricted software +_CompDescriptionLong: Software restricted by copyright or legal issues + +Suite: nanggar +MatchName: .* +BaseURI: cdrom:\[Blankon.*5.0 +MatchURI: cdrom:\[Blankon.*5.0 +_Description: Cdrom with Blankon 5.0 'Nanggar' +Available: False +Component: main +_CompDescription: Officially supported +Component: restricted +_CompDescription: Restricted copyright + +Suite: nanggar-security +ParentSuite: nanggar +RepositoryType: deb +BaseURI: http://arsip.blankonlinux.or.id/blankon-legacy/ +MatchURI: arsip.blankonlinux.or.id/blankon-legacy +_Description: Important security updates + +Suite: nanggar-updates +ParentSuite: nanggar +RepositoryType: deb +_Description: Recommended updates + +Suite: meuligoe +RepositoryType: deb +BaseURI: http://arsip.blankonlinux.or.id/blankon-legacy/ +MatchURI: arsip.blankonlinux.or.id/blankon-legacy +MirrorsFile-amd64: /usr/share/python-apt/templates/Blankon.mirrors +MirrorsFile-i386: /usr/share/python-apt/templates/Blankon.mirrors +_Description: Blankon 4.1 'Meuligoe' +Component: main +_CompDescription: Officially supported +_CompDescriptionLong: BlankOn-supported Open Source software +Component: restricted +_CompDescription: Non-free drivers +_CompDescriptionLong: Proprietary drivers for devices + +Suite: meuligoe +MatchName: .* +BaseURI: cdrom:\[Blankon.*4.1 +MatchURI: cdrom:\[Blankon.*4.1 +_Description: Cdrom with Blankon 4.1 'Meuligoe' +Available: False +Component: main +_CompDescription: Officially supported +Component: restricted +_CompDescription: Restricted copyright + +Suite: meuligoe-security +ParentSuite: meuligoe +RepositoryType: deb +BaseURI: http://arsip.blankonlinux.or.id/blankon-legacy/ +MatchURI: arsip.blankonlinux.or.id/blankon-legacy +_Description: Important security updates + +Suite: meuligoe-updates +ParentSuite: meuligoe +RepositoryType: deb +_Description: Recommended updates + +Suite: lontara +RepositoryType: deb +BaseURI: http://arsip.blankonlinux.or.id/blankon-legacy/ +MatchURI: arsip.blankonlinux.or.id/blankon-legacy +MirrorsFile-amd64: /usr/share/python-apt/templates/Blankon.mirrors +MirrorsFile-i386: /usr/share/python-apt/templates/Blankon.mirrors +_Description: BlankOn 3.0 'Lontara' +Component: main +_CompDescription: Officially supported +_CompDescriptionLong: BlankOn-supported Open Source software +Component: restricted +_CompDescription: Non-free drivers +_CompDescriptionLong: Proprietary drivers for devices + +Suite: lontara +MatchName: .* +BaseURI: cdrom:\[Blankon.*3.0 +MatchURI: cdrom:\[Blankon.*3.0 +_Description: Cdrom with Blankon 3.0 'Lontara' +Available: False +Component: main +_CompDescription: Officially supported +Component: restricted +_CompDescription: Restricted copyright + +Suite: lontara-security +ParentSuite: lontara +RepositoryType: deb +BaseURI: http://arsip.blankonlinux.or.id/blankon-legacy/ +MatchURI: arsip.blankonlinux.or.id/blankon-legacy +_Description: Important security updates + +Suite: lontara-updates +ParentSuite: lontara +RepositoryType: deb +_Description: Recommended updates + +Suite: konde +RepositoryType: deb +BaseURI: http://arsip.blankonlinux.or.id/blankon-legacy/ +MatchURI: arsip.blankonlinux.or.id/blankon-legacy +MirrorsFile-amd64: /usr/share/python-apt/templates/Blankon.mirrors +MirrorsFile-i386: /usr/share/python-apt/templates/Blankon.mirrors +_Description: Blankon 2.0 'Konde' +Component: main +_CompDescription: Officially supported +_CompDescriptionLong: BlankOn-supported Open Source software +Component: restricted +_CompDescription: Non-free drivers +_CompDescriptionLong: Proprietary drivers for devices + +Suite: konde +MatchName: .* +BaseURI: cdrom:\[Blankon.*2.0 +MatchURI: cdrom:\[Blankon.*2.0 +_Description: Cdrom with Blankon 2.0 'Konde' +Available: False +Component: main +_CompDescription: Officially supported +Component: restricted +_CompDescription: Restricted copyright + +Suite: konde-security +ParentSuite: konde +RepositoryType: deb +BaseURI: http://arsip.blankonlinux.or.id/blankon-legacy/ +MatchURI: arsip.blankonlinux.or.id/blankon-legacy +_Description: Important security updates + +Suite: konde-updates +ParentSuite: konde +RepositoryType: deb +_Description: Recommended updates diff --git a/data/templates/Blankon.mirrors b/data/templates/Blankon.mirrors new file mode 100644 index 00000000..f277c033 --- /dev/null +++ b/data/templates/Blankon.mirrors @@ -0,0 +1,17 @@ +#LOC:ID +http://kambing.ui.ac.id/blankon/ +http://mirror.omadata.com/blankon/ +http://repo.ugm.ac.id/repo/blankon/ +http://buaya.klas.or.id/blankon/ +http://bos.fkip.uns.ac.id/blankon +http://pandawa.ipb.ac.id/blankon/ +http://dl2.foss-id.web.id/blankon/ +http://shol.vlsm.org/blankon/ +http://openstorage.gunadarma.ac.id/blankon/ +http://debian.rab.co.id/blankon/ +http://singo.ub.ac.id/blankon/ +http://ftp.paudni.kemdiknas.go.id/blankon/ +http://blankon.idrepo.or.id/blankon/ +http://mirror.kioss.undip.ac.id/blankon/ +http://repo.unnes.ac.id/repo/blankon/ +http://kartolo.sby.datautama.net.id/blankon/ -- cgit v1.2.3 From 543dfd085a39251894d86dcddbedb414fb9de6c3 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Mon, 9 Jun 2014 09:53:08 +0200 Subject: Add apt_pkg.SourceRecords.next() to step through all SrcRecords --- debian/control | 2 +- python/pkgsrcrecords.cc | 24 ++++++++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/debian/control b/debian/control index 8fdb3941..0ba3c2cf 100644 --- a/debian/control +++ b/debian/control @@ -10,7 +10,7 @@ Build-Depends: apt (>= 0.9.6), apt-utils, debhelper (>= 9), fakeroot, - libapt-pkg-dev (>= 0.8.11), + libapt-pkg-dev (>= 1.0.4~), python-all-dev (>= 2.6.6-3~), python-all-dbg, python3-all-dev (>= 3.3), diff --git a/python/pkgsrcrecords.cc b/python/pkgsrcrecords.cc index 6a60a9af..06602b9f 100644 --- a/python/pkgsrcrecords.cc +++ b/python/pkgsrcrecords.cc @@ -75,10 +75,34 @@ static PyObject *PkgSrcRecordsRestart(PyObject *Self,PyObject *Args) return HandleErrors(Py_None); } +static char *doc_PkgSrcRecordsNext = + "next() -> bool\n\n" + "Go to the source package. Each call moves\n" + "the position of the records parser forward. If there are no\n" + "more records, return None. If the lookup failed this way,\n" + "access to any of the attributes will result in an AttributeError."; +static PyObject *PkgSrcRecordsNext(PyObject *Self,PyObject *Args) +{ + PkgSrcRecordsStruct &Struct = GetCpp(Self); + + if (PyArg_ParseTuple(Args,"") == 0) + return 0; + + Struct.Last = (pkgSrcRecords::Parser*)Struct.Records->Next(); + if (Struct.Last == 0) { + Struct.Records->Restart(); + Py_INCREF(Py_None); + return HandleErrors(Py_None); + } + + return PyBool_FromLong(1); +} + static PyMethodDef PkgSrcRecordsMethods[] = { {"lookup",PkgSrcRecordsLookup,METH_VARARGS,doc_PkgSrcRecordsLookup}, {"restart",PkgSrcRecordsRestart,METH_VARARGS,doc_PkgSrcRecordsRestart}, + {"next",PkgSrcRecordsNext,METH_VARARGS,doc_PkgSrcRecordsNext}, {} }; -- cgit v1.2.3 From 887406dbb341ed684cd898f15b133baac252bc25 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Mon, 9 Jun 2014 17:13:51 +0200 Subject: rename apt_pkg.SourceRecords.next() to apt_pkg.SourceRecords.step() to avoid confusion with python iterators --- python/pkgsrcrecords.cc | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/python/pkgsrcrecords.cc b/python/pkgsrcrecords.cc index 06602b9f..308299e2 100644 --- a/python/pkgsrcrecords.cc +++ b/python/pkgsrcrecords.cc @@ -75,13 +75,13 @@ static PyObject *PkgSrcRecordsRestart(PyObject *Self,PyObject *Args) return HandleErrors(Py_None); } -static char *doc_PkgSrcRecordsNext = - "next() -> bool\n\n" - "Go to the source package. Each call moves\n" +static char *doc_PkgSrcRecordsStep = + "step() -> bool\n\n" + "Step to the next source package. Each call moves\n" "the position of the records parser forward. If there are no\n" "more records, return None. If the lookup failed this way,\n" "access to any of the attributes will result in an AttributeError."; -static PyObject *PkgSrcRecordsNext(PyObject *Self,PyObject *Args) +static PyObject *PkgSrcRecordsStep(PyObject *Self,PyObject *Args) { PkgSrcRecordsStruct &Struct = GetCpp(Self); @@ -102,7 +102,7 @@ static PyMethodDef PkgSrcRecordsMethods[] = { {"lookup",PkgSrcRecordsLookup,METH_VARARGS,doc_PkgSrcRecordsLookup}, {"restart",PkgSrcRecordsRestart,METH_VARARGS,doc_PkgSrcRecordsRestart}, - {"next",PkgSrcRecordsNext,METH_VARARGS,doc_PkgSrcRecordsNext}, + {"step",PkgSrcRecordsStep,METH_VARARGS,doc_PkgSrcRecordsStep}, {} }; -- cgit v1.2.3 From 09079e23657cbe0b751499bd2860d0b2633c4ef8 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Tue, 10 Jun 2014 18:25:11 +0200 Subject: prepare 0.9.3.7 --- debian/changelog | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/debian/changelog b/debian/changelog index 45077f2e..0d85ae76 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,13 @@ +python-apt (0.9.3.7) UNRELEASED; urgency=medium + + * Include "Blankon" template (Closes: #747498) + * Add apt_pkg.SourceRecords.step() to step through all SrcRecords + * debian/control: + - update build-dependency for libapt-pkg-dev to 1.0.4 for + pkgSourceRecords::Step() + + -- Michael Vogt Tue, 10 Jun 2014 18:23:33 +0200 + python-apt (0.9.3.6) unstable; urgency=medium [ Johannes Schauer ] -- cgit v1.2.3 From 133453cd78109e10f9f23168ba3e5923e9afffae Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Tue, 10 Jun 2014 18:43:06 +0200 Subject: Revert "Merge remote-tracking branch 'mvo/feature/srcrec-enum' into debian/sid" This reverts commit 1b6b123a052ca2d53e90b62da09ce300d701265a, reversing changes made to 9de6a183f09f0d0adbcc5817872c5a0024f5ef47. --- debian/control | 2 +- po/python-apt.pot | 228 +++++++++++++++++++++++------------------------- python/pkgsrcrecords.cc | 24 ----- python/tag.cc | 3 +- tests/test_tagfile.py | 24 ----- 5 files changed, 111 insertions(+), 170 deletions(-) diff --git a/debian/control b/debian/control index 9d112644..ce5eecb3 100644 --- a/debian/control +++ b/debian/control @@ -10,7 +10,7 @@ Build-Depends: apt (>= 0.9.6), apt-utils, debhelper (>= 9), fakeroot, - libapt-pkg-dev (>= 1.0.4~), + libapt-pkg-dev (>= 0.9.16.1), python-all-dev (>= 2.7), python-all-dbg, python3-all-dev (>= 3.3), diff --git a/po/python-apt.pot b/po/python-apt.pot index 08650c1f..8d8b1261 100644 --- a/po/python-apt.pot +++ b/po/python-apt.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2014-06-06 11:07+0200\n" +"POT-Creation-Date: 2014-01-01 09:20+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -30,376 +30,366 @@ msgstr "" #. Description #: ../data/templates/Ubuntu.info.in:140 -msgid "Ubuntu 14.10 'Utopic Unicorn'" -msgstr "" - -#. Description -#: ../data/templates/Ubuntu.info.in:147 -msgid "Cdrom with Ubuntu 14.10 'Utopic Unicorn'" -msgstr "" - -#. Description -#: ../data/templates/Ubuntu.info.in:259 msgid "Ubuntu 14.04 'Trusty Tahr'" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:266 +#: ../data/templates/Ubuntu.info.in:147 msgid "Cdrom with Ubuntu 14.04 'Trusty Tahr'" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:378 +#: ../data/templates/Ubuntu.info.in:259 msgid "Ubuntu 13.10 'Saucy Salamander'" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:385 +#: ../data/templates/Ubuntu.info.in:266 msgid "Cdrom with Ubuntu 13.10 'Saucy Salamander'" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:497 +#: ../data/templates/Ubuntu.info.in:378 msgid "Ubuntu 13.04 'Raring Ringtail'" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:504 +#: ../data/templates/Ubuntu.info.in:385 msgid "Cdrom with Ubuntu 13.04 'Raring Ringtail'" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:616 +#: ../data/templates/Ubuntu.info.in:497 msgid "Ubuntu 12.10 'Quantal Quetzal'" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:623 +#: ../data/templates/Ubuntu.info.in:504 msgid "Cdrom with Ubuntu 12.10 'Quantal Quetzal'" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:734 +#: ../data/templates/Ubuntu.info.in:615 msgid "Ubuntu 12.04 'Precise Pangolin'" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:741 +#: ../data/templates/Ubuntu.info.in:622 msgid "Cdrom with Ubuntu 12.04 'Precise Pangolin'" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:852 +#: ../data/templates/Ubuntu.info.in:733 msgid "Ubuntu 11.10 'Oneiric Ocelot'" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:859 +#: ../data/templates/Ubuntu.info.in:740 msgid "Cdrom with Ubuntu 11.10 'Oneiric Ocelot'" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:971 +#: ../data/templates/Ubuntu.info.in:852 msgid "Ubuntu 11.04 'Natty Narwhal'" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:978 +#: ../data/templates/Ubuntu.info.in:859 msgid "Cdrom with Ubuntu 11.04 'Natty Narwhal'" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:1069 +#: ../data/templates/Ubuntu.info.in:950 msgid "Ubuntu 10.10 'Maverick Meerkat'" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:1089 +#: ../data/templates/Ubuntu.info.in:970 msgid "Cdrom with Ubuntu 10.10 'Maverick Meerkat'" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:1101 +#: ../data/templates/Ubuntu.info.in:982 msgid "Canonical Partners" msgstr "" #. CompDescription -#: ../data/templates/Ubuntu.info.in:1103 +#: ../data/templates/Ubuntu.info.in:984 msgid "Software packaged by Canonical for their partners" msgstr "" #. CompDescriptionLong -#: ../data/templates/Ubuntu.info.in:1104 +#: ../data/templates/Ubuntu.info.in:985 msgid "This software is not part of Ubuntu." msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:1111 +#: ../data/templates/Ubuntu.info.in:992 msgid "Independent" msgstr "" #. CompDescription -#: ../data/templates/Ubuntu.info.in:1113 +#: ../data/templates/Ubuntu.info.in:994 msgid "Provided by third-party software developers" msgstr "" #. CompDescriptionLong -#: ../data/templates/Ubuntu.info.in:1114 +#: ../data/templates/Ubuntu.info.in:995 msgid "Software offered by third party developers." msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:1152 +#: ../data/templates/Ubuntu.info.in:1033 msgid "Ubuntu 10.04 'Lucid Lynx'" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:1172 +#: ../data/templates/Ubuntu.info.in:1053 msgid "Cdrom with Ubuntu 10.04 'Lucid Lynx'" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:1215 +#: ../data/templates/Ubuntu.info.in:1096 msgid "Ubuntu 9.10 'Karmic Koala'" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:1235 +#: ../data/templates/Ubuntu.info.in:1116 msgid "Cdrom with Ubuntu 9.10 'Karmic Koala'" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:1278 +#: ../data/templates/Ubuntu.info.in:1159 msgid "Ubuntu 9.04 'Jaunty Jackalope'" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:1297 +#: ../data/templates/Ubuntu.info.in:1178 msgid "Cdrom with Ubuntu 9.04 'Jaunty Jackalope'" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:1340 +#: ../data/templates/Ubuntu.info.in:1221 msgid "Ubuntu 8.10 'Intrepid Ibex'" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:1360 +#: ../data/templates/Ubuntu.info.in:1241 msgid "Cdrom with Ubuntu 8.10 'Intrepid Ibex'" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:1404 +#: ../data/templates/Ubuntu.info.in:1285 msgid "Ubuntu 8.04 'Hardy Heron'" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:1424 +#: ../data/templates/Ubuntu.info.in:1305 msgid "Cdrom with Ubuntu 8.04 'Hardy Heron'" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:1469 +#: ../data/templates/Ubuntu.info.in:1350 msgid "Ubuntu 7.10 'Gutsy Gibbon'" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:1488 +#: ../data/templates/Ubuntu.info.in:1369 msgid "Cdrom with Ubuntu 7.10 'Gutsy Gibbon'" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:1533 +#: ../data/templates/Ubuntu.info.in:1414 msgid "Ubuntu 7.04 'Feisty Fawn'" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:1552 +#: ../data/templates/Ubuntu.info.in:1433 msgid "Cdrom with Ubuntu 7.04 'Feisty Fawn'" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:1594 +#: ../data/templates/Ubuntu.info.in:1475 msgid "Ubuntu 6.10 'Edgy Eft'" msgstr "" #. CompDescription -#: ../data/templates/Ubuntu.info.in:1599 +#: ../data/templates/Ubuntu.info.in:1480 msgid "Community-maintained" msgstr "" #. CompDescription -#: ../data/templates/Ubuntu.info.in:1605 +#: ../data/templates/Ubuntu.info.in:1486 msgid "Restricted software" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:1613 +#: ../data/templates/Ubuntu.info.in:1494 msgid "Cdrom with Ubuntu 6.10 'Edgy Eft'" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:1655 +#: ../data/templates/Ubuntu.info.in:1536 msgid "Ubuntu 6.06 LTS 'Dapper Drake'" msgstr "" #. CompDescriptionLong -#: ../data/templates/Ubuntu.info.in:1658 +#: ../data/templates/Ubuntu.info.in:1539 msgid "Canonical-supported free and open-source software" msgstr "" #. CompDescription -#: ../data/templates/Ubuntu.info.in:1660 +#: ../data/templates/Ubuntu.info.in:1541 msgid "Community-maintained (universe)" msgstr "" #. CompDescriptionLong -#: ../data/templates/Ubuntu.info.in:1661 +#: ../data/templates/Ubuntu.info.in:1542 msgid "Community-maintained free and open-source software" msgstr "" #. CompDescription -#: ../data/templates/Ubuntu.info.in:1663 +#: ../data/templates/Ubuntu.info.in:1544 msgid "Non-free drivers" msgstr "" #. CompDescriptionLong -#: ../data/templates/Ubuntu.info.in:1664 +#: ../data/templates/Ubuntu.info.in:1545 msgid "Proprietary drivers for devices" msgstr "" #. CompDescription -#: ../data/templates/Ubuntu.info.in:1666 +#: ../data/templates/Ubuntu.info.in:1547 msgid "Restricted software (Multiverse)" msgstr "" #. CompDescriptionLong -#: ../data/templates/Ubuntu.info.in:1667 +#: ../data/templates/Ubuntu.info.in:1548 msgid "Software restricted by copyright or legal issues" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:1674 +#: ../data/templates/Ubuntu.info.in:1555 msgid "Cdrom with Ubuntu 6.06 LTS 'Dapper Drake'" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:1690 +#: ../data/templates/Ubuntu.info.in:1571 msgid "Important security updates" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:1695 ../data/templates/Debian.info.in:56 +#: ../data/templates/Ubuntu.info.in:1576 ../data/templates/Debian.info.in:56 msgid "Recommended updates" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:1700 +#: ../data/templates/Ubuntu.info.in:1581 msgid "Pre-released updates" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:1705 +#: ../data/templates/Ubuntu.info.in:1586 msgid "Unsupported updates" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:1716 +#: ../data/templates/Ubuntu.info.in:1597 msgid "Ubuntu 5.10 'Breezy Badger'" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:1731 +#: ../data/templates/Ubuntu.info.in:1612 msgid "Cdrom with Ubuntu 5.10 'Breezy Badger'" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:1747 +#: ../data/templates/Ubuntu.info.in:1628 msgid "Ubuntu 5.10 Security Updates" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:1752 +#: ../data/templates/Ubuntu.info.in:1633 msgid "Ubuntu 5.10 Updates" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:1757 +#: ../data/templates/Ubuntu.info.in:1638 msgid "Ubuntu 5.10 Backports" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:1768 +#: ../data/templates/Ubuntu.info.in:1649 msgid "Ubuntu 5.04 'Hoary Hedgehog'" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:1783 +#: ../data/templates/Ubuntu.info.in:1664 msgid "Cdrom with Ubuntu 5.04 'Hoary Hedgehog'" msgstr "" #. CompDescription -#: ../data/templates/Ubuntu.info.in:1786 ../data/templates/Debian.info.in:209 +#: ../data/templates/Ubuntu.info.in:1667 ../data/templates/Debian.info.in:209 msgid "Officially supported" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:1799 +#: ../data/templates/Ubuntu.info.in:1680 msgid "Ubuntu 5.04 Security Updates" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:1804 +#: ../data/templates/Ubuntu.info.in:1685 msgid "Ubuntu 5.04 Updates" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:1809 +#: ../data/templates/Ubuntu.info.in:1690 msgid "Ubuntu 5.04 Backports" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:1815 +#: ../data/templates/Ubuntu.info.in:1696 msgid "Ubuntu 4.10 'Warty Warthog'" msgstr "" #. CompDescription -#: ../data/templates/Ubuntu.info.in:1821 +#: ../data/templates/Ubuntu.info.in:1702 msgid "Community-maintained (Universe)" msgstr "" #. CompDescription -#: ../data/templates/Ubuntu.info.in:1823 +#: ../data/templates/Ubuntu.info.in:1704 msgid "Non-free (Multiverse)" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:1830 +#: ../data/templates/Ubuntu.info.in:1711 msgid "Cdrom with Ubuntu 4.10 'Warty Warthog'" msgstr "" #. CompDescription -#: ../data/templates/Ubuntu.info.in:1833 +#: ../data/templates/Ubuntu.info.in:1714 msgid "No longer officially supported" msgstr "" #. CompDescription -#: ../data/templates/Ubuntu.info.in:1835 +#: ../data/templates/Ubuntu.info.in:1716 msgid "Restricted copyright" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:1842 +#: ../data/templates/Ubuntu.info.in:1723 msgid "Ubuntu 4.10 Security Updates" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:1847 +#: ../data/templates/Ubuntu.info.in:1728 msgid "Ubuntu 4.10 Updates" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:1852 +#: ../data/templates/Ubuntu.info.in:1733 msgid "Ubuntu 4.10 Backports" msgstr "" @@ -492,39 +482,39 @@ msgstr "" msgid "Custom servers" msgstr "" -#: ../apt/progress/gtk2.py:245 +#: ../apt/progress/gtk2.py:243 #, python-format msgid "Downloading file %(current)li of %(total)li with %(speed)s/s" msgstr "" -#: ../apt/progress/gtk2.py:251 +#: ../apt/progress/gtk2.py:249 #, python-format msgid "Downloading file %(current)li of %(total)li" msgstr "" #. Setup some child widgets -#: ../apt/progress/gtk2.py:274 +#: ../apt/progress/gtk2.py:272 msgid "Details" msgstr "" -#: ../apt/progress/gtk2.py:347 +#: ../apt/progress/gtk2.py:345 msgid "Starting..." msgstr "" -#: ../apt/progress/gtk2.py:353 +#: ../apt/progress/gtk2.py:351 msgid "Complete" msgstr "" -#: ../apt/package.py:380 +#: ../apt/package.py:328 #, python-format msgid "Invalid unicode in description for '%s' (%s). Please report." msgstr "" -#: ../apt/package.py:950 ../apt/package.py:1056 +#: ../apt/package.py:901 ../apt/package.py:1007 msgid "The list of changes is not available" msgstr "" -#: ../apt/package.py:1062 +#: ../apt/package.py:1013 #, python-format msgid "" "The list of changes is not available yet.\n" @@ -533,120 +523,120 @@ msgid "" "until the changes become available or try again later." msgstr "" -#: ../apt/package.py:1069 +#: ../apt/package.py:1020 msgid "" "Failed to download the list of changes. \n" "Please check your Internet connection." msgstr "" -#: ../apt/debfile.py:89 +#: ../apt/debfile.py:87 #, python-format msgid "List of files for '%s' could not be read" msgstr "" -#: ../apt/debfile.py:101 +#: ../apt/debfile.py:99 #, python-format msgid "List of control files for '%s' could not be read" msgstr "" -#: ../apt/debfile.py:226 +#: ../apt/debfile.py:224 #, python-format msgid "Dependency is not satisfiable: %s\n" msgstr "" -#: ../apt/debfile.py:249 +#: ../apt/debfile.py:247 #, python-format msgid "Conflicts with the installed package '%s'" msgstr "" -#: ../apt/debfile.py:396 +#: ../apt/debfile.py:394 #, python-format msgid "" "Breaks existing package '%(pkgname)s' dependency %(depname)s " "(%(deprelation)s %(depversion)s)" msgstr "" -#: ../apt/debfile.py:423 +#: ../apt/debfile.py:421 #, python-format msgid "" "Breaks existing package '%(pkgname)s' conflict: %(targetpkg)s (%(comptype)s " "%(targetver)s)" msgstr "" -#: ../apt/debfile.py:437 +#: ../apt/debfile.py:435 #, python-format msgid "" "Breaks existing package '%(pkgname)s' that conflict: '%(targetpkg)s'. But " "the '%(debfile)s' provides it via: '%(provides)s'" msgstr "" -#: ../apt/debfile.py:488 +#: ../apt/debfile.py:486 msgid "No Architecture field in the package" msgstr "" -#: ../apt/debfile.py:498 +#: ../apt/debfile.py:496 #, python-format msgid "Wrong architecture '%s'" msgstr "" -#: ../apt/debfile.py:506 +#: ../apt/debfile.py:504 msgid "A later version is already installed" msgstr "" -#: ../apt/debfile.py:531 +#: ../apt/debfile.py:529 msgid "Failed to satisfy all dependencies (broken cache)" msgstr "" -#: ../apt/debfile.py:560 +#: ../apt/debfile.py:558 #, python-format msgid "Cannot install '%s'" msgstr "" -#: ../apt/debfile.py:636 +#: ../apt/debfile.py:634 msgid "" "Automatically decompressed:\n" "\n" msgstr "" -#: ../apt/debfile.py:642 +#: ../apt/debfile.py:640 msgid "Automatically converted to printable ascii:\n" msgstr "" -#: ../apt/debfile.py:733 +#: ../apt/debfile.py:731 #, python-format msgid "Install Build-Dependencies for source package '%s' that builds %s\n" msgstr "" -#: ../apt/debfile.py:744 +#: ../apt/debfile.py:742 msgid "An essential package would be removed" msgstr "" -#: ../apt/progress/text.py:89 +#: ../apt/progress/text.py:82 #, python-format msgid "%c%s... Done" msgstr "" -#: ../apt/progress/text.py:129 +#: ../apt/progress/text.py:122 msgid "Hit " msgstr "" -#: ../apt/progress/text.py:138 +#: ../apt/progress/text.py:131 msgid "Ign " msgstr "" -#: ../apt/progress/text.py:140 +#: ../apt/progress/text.py:133 msgid "Err " msgstr "" -#: ../apt/progress/text.py:151 +#: ../apt/progress/text.py:144 msgid "Get:" msgstr "" -#: ../apt/progress/text.py:211 +#: ../apt/progress/text.py:204 msgid " [Working]" msgstr "" -#: ../apt/progress/text.py:222 +#: ../apt/progress/text.py:215 #, python-format msgid "" "Media change: please insert the disc labeled\n" @@ -655,19 +645,19 @@ msgid "" msgstr "" #. Trick for getting a translation from apt -#: ../apt/progress/text.py:231 +#: ../apt/progress/text.py:224 #, python-format msgid "Fetched %sB in %s (%sB/s)\n" msgstr "" -#: ../apt/progress/text.py:247 +#: ../apt/progress/text.py:240 msgid "Please provide a name for this Disc, such as 'Debian 2.1r1 Disk 1'" msgstr "" -#: ../apt/progress/text.py:263 +#: ../apt/progress/text.py:256 msgid "Please insert a Disc in the drive and press enter" msgstr "" -#: ../apt/cache.py:163 +#: ../apt/cache.py:164 msgid "Building data structures" msgstr "" diff --git a/python/pkgsrcrecords.cc b/python/pkgsrcrecords.cc index 308299e2..6a60a9af 100644 --- a/python/pkgsrcrecords.cc +++ b/python/pkgsrcrecords.cc @@ -75,34 +75,10 @@ static PyObject *PkgSrcRecordsRestart(PyObject *Self,PyObject *Args) return HandleErrors(Py_None); } -static char *doc_PkgSrcRecordsStep = - "step() -> bool\n\n" - "Step to the next source package. Each call moves\n" - "the position of the records parser forward. If there are no\n" - "more records, return None. If the lookup failed this way,\n" - "access to any of the attributes will result in an AttributeError."; -static PyObject *PkgSrcRecordsStep(PyObject *Self,PyObject *Args) -{ - PkgSrcRecordsStruct &Struct = GetCpp(Self); - - if (PyArg_ParseTuple(Args,"") == 0) - return 0; - - Struct.Last = (pkgSrcRecords::Parser*)Struct.Records->Next(); - if (Struct.Last == 0) { - Struct.Records->Restart(); - Py_INCREF(Py_None); - return HandleErrors(Py_None); - } - - return PyBool_FromLong(1); -} - static PyMethodDef PkgSrcRecordsMethods[] = { {"lookup",PkgSrcRecordsLookup,METH_VARARGS,doc_PkgSrcRecordsLookup}, {"restart",PkgSrcRecordsRestart,METH_VARARGS,doc_PkgSrcRecordsRestart}, - {"step",PkgSrcRecordsStep,METH_VARARGS,doc_PkgSrcRecordsStep}, {} }; diff --git a/python/tag.cc b/python/tag.cc index bab7811e..50786cee 100644 --- a/python/tag.cc +++ b/python/tag.cc @@ -290,8 +290,6 @@ static PyObject *TagSecStr(PyObject *Self) const char *Start; const char *Stop; GetCpp(Self).GetSection(Start,Stop); - printf("%x\n", &GetCpp(Self)); - std::cerr << Start << std::endl; return TagSecString_FromStringAndSize(Self,Start,Stop-Start); } /*}}}*/ @@ -490,6 +488,7 @@ static PyObject *TagFileNew(PyTypeObject *type,PyObject *Args,PyObject *kwds) New->Section = (TagSecData*)(&PyTagSection_Type)->tp_alloc(&PyTagSection_Type, 0); new (&New->Section->Object) pkgTagSection(); New->Section->Owner = New; + Py_INCREF(New->Section->Owner); New->Section->Data = 0; New->Section->Bytes = Bytes; #if PY_MAJOR_VERSION >= 3 diff --git a/tests/test_tagfile.py b/tests/test_tagfile.py index ff7d81cd..6ff6a32a 100644 --- a/tests/test_tagfile.py +++ b/tests/test_tagfile.py @@ -132,29 +132,5 @@ class TestTagFile(unittest.TestCase): self.assertEqual( value.encode("ISO-8859-1"), tagfile.section["Maintainer"]) - @unittest.skipIf(not os.path.exists("/proc/self/fd"), "need /proc/self/fd") - def test_leak(self): - # clenaup gc first - import gc - gc.collect() - # see what fds we have - fds = os.listdir("/proc/self/fd") - testfile = __file__ - tagf = apt_pkg.TagFile(testfile) - tagf.step() - print("1", tagf.section) - sec = tagf.section - print("2", sec) - print(gc.get_referrers(sec)) - self.assertTrue(str(tagf.section).startswith("#!/usr/bin/python")) - del tagf - print(gc.get_referrers(sec)) - # sec is still ok - print("42", sec) - self.assertTrue(str(sec).startswith("#!/usr/bin/python")) - # ensure fd is closed - self.assertEqual(fds, os.listdir("/proc/self/fd")) - - if __name__ == "__main__": unittest.main() -- cgit v1.2.3 From e575cea699b7ebbf4d3045f4131075f7d0e415e6 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Tue, 10 Jun 2014 18:47:25 +0200 Subject: add apt_pkg.SourceRecords.step() to all steping through all SrcRecords --- debian/control | 2 +- python/pkgsrcrecords.cc | 24 ++++++++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/debian/control b/debian/control index ce5eecb3..9d112644 100644 --- a/debian/control +++ b/debian/control @@ -10,7 +10,7 @@ Build-Depends: apt (>= 0.9.6), apt-utils, debhelper (>= 9), fakeroot, - libapt-pkg-dev (>= 0.9.16.1), + libapt-pkg-dev (>= 1.0.4~), python-all-dev (>= 2.7), python-all-dbg, python3-all-dev (>= 3.3), diff --git a/python/pkgsrcrecords.cc b/python/pkgsrcrecords.cc index 6a60a9af..6f80731d 100644 --- a/python/pkgsrcrecords.cc +++ b/python/pkgsrcrecords.cc @@ -75,10 +75,34 @@ static PyObject *PkgSrcRecordsRestart(PyObject *Self,PyObject *Args) return HandleErrors(Py_None); } +static char *doc_PkgSrcRecordsStep = + "step() -> bool\n\n" + "Go to the source package. Each call moves\n" + "the position of the records parser forward. If there are no\n" + "more records, return None. If the lookup failed this way,\n" + "access to any of the attributes will result in an AttributeError."; +static PyObject *PkgSrcRecordsStep(PyObject *Self,PyObject *Args) +{ + PkgSrcRecordsStruct &Struct = GetCpp(Self); + + if (PyArg_ParseTuple(Args,"") == 0) + return 0; + + Struct.Last = (pkgSrcRecords::Parser*)Struct.Records->Next(); + if (Struct.Last == 0) { + Struct.Records->Restart(); + Py_INCREF(Py_None); + return HandleErrors(Py_None); + } + + return PyBool_FromLong(1); +} + static PyMethodDef PkgSrcRecordsMethods[] = { {"lookup",PkgSrcRecordsLookup,METH_VARARGS,doc_PkgSrcRecordsLookup}, {"restart",PkgSrcRecordsRestart,METH_VARARGS,doc_PkgSrcRecordsRestart}, + {"step",PkgSrcRecordsNext,METH_VARARGS,doc_PkgSrcRecordsNext}, {} }; -- cgit v1.2.3 From 7164a34502048d23b5d079d26e2a019feaa0ff5a Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Tue, 10 Jun 2014 18:58:31 +0200 Subject: libapt uses pkgSourceRecords::Step() too --- python/pkgsrcrecords.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/python/pkgsrcrecords.cc b/python/pkgsrcrecords.cc index 6f80731d..6ec4e63c 100644 --- a/python/pkgsrcrecords.cc +++ b/python/pkgsrcrecords.cc @@ -88,7 +88,7 @@ static PyObject *PkgSrcRecordsStep(PyObject *Self,PyObject *Args) if (PyArg_ParseTuple(Args,"") == 0) return 0; - Struct.Last = (pkgSrcRecords::Parser*)Struct.Records->Next(); + Struct.Last = (pkgSrcRecords::Parser*)Struct.Records->Step(); if (Struct.Last == 0) { Struct.Records->Restart(); Py_INCREF(Py_None); @@ -102,7 +102,7 @@ static PyMethodDef PkgSrcRecordsMethods[] = { {"lookup",PkgSrcRecordsLookup,METH_VARARGS,doc_PkgSrcRecordsLookup}, {"restart",PkgSrcRecordsRestart,METH_VARARGS,doc_PkgSrcRecordsRestart}, - {"step",PkgSrcRecordsNext,METH_VARARGS,doc_PkgSrcRecordsNext}, + {"step",PkgSrcRecordsStep,METH_VARARGS,doc_PkgSrcRecordsStep}, {} }; -- cgit v1.2.3 From 1fd7279ca39c22f9a688e404b27bc1f3aef30cc7 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Tue, 10 Jun 2014 18:58:43 +0200 Subject: releasing package python-apt version 0.9.3.7 --- debian/changelog | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index 0d85ae76..60b5b859 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,4 @@ -python-apt (0.9.3.7) UNRELEASED; urgency=medium +python-apt (0.9.3.7) unstable; urgency=medium * Include "Blankon" template (Closes: #747498) * Add apt_pkg.SourceRecords.step() to step through all SrcRecords -- cgit v1.2.3 From 9db885ce4fb06f8e154b97cd6cf4e0f09a241f54 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Mon, 30 Jun 2014 11:21:36 +0200 Subject: make pep8 happy (again) --- apt/cache.py | 2 +- apt/debfile.py | 20 +++++++++--------- apt/utils.py | 10 ++++----- aptsources/distinfo.py | 4 ++-- aptsources/distro.py | 42 ++++++++++++++++++------------------- aptsources/sourceslist.py | 41 ++++++++++++++++++------------------ doc/examples/all_deps.py | 4 ++-- doc/source/examples/missing-deps.py | 2 +- tests/test_aptsources.py | 38 ++++++++++++++++----------------- tests/test_debfile_multiarch.py | 2 +- tests/test_pep8.py | 3 ++- utils/get_debian_mirrors.py | 2 +- utils/get_ubuntu_mirrors_from_lp.py | 2 +- 13 files changed, 86 insertions(+), 86 deletions(-) diff --git a/apt/cache.py b/apt/cache.py index 36a9fa6b..69ee3693 100644 --- a/apt/cache.py +++ b/apt/cache.py @@ -530,7 +530,7 @@ class Cache(object): def connect(self, name, callback): """ connect to a signal, currently only used for cache_{post,pre}_{changed,open} """ - if not name in self._callbacks: + if name not in self._callbacks: self._callbacks[name] = [] self._callbacks[name].append(callback) diff --git a/apt/debfile.py b/apt/debfile.py index ca38fdc0..2c95bdf1 100644 --- a/apt/debfile.py +++ b/apt/debfile.py @@ -119,7 +119,7 @@ class DebPackage(object): # now do the real multiarch checking multiarch_pkgname = "%s:%s" % (pkgname, self._multiarch) # the upper layers will handle this - if not multiarch_pkgname in self._cache: + if multiarch_pkgname not in self._cache: return multiarch_pkgname # now check the multiarch state cand = self._cache[multiarch_pkgname].candidate._cand @@ -131,7 +131,7 @@ class DebPackage(object): # for conflicts we need a special case here, any not multiarch enabled # package has a implicit conflict if (in_conflict_checking and - not (cand.multi_arch & cand.MULTI_ARCH_SAME)): + not (cand.multi_arch & cand.MULTI_ARCH_SAME)): return pkgname return multiarch_pkgname @@ -152,7 +152,7 @@ class DebPackage(object): depname = self._maybe_append_multiarch_suffix(depname) # check for virtual pkgs - if not depname in self._cache: + if depname not in self._cache: if self._cache.is_virtual_package(depname): self._dbg( 3, "_is_or_group_satisfied(): %s is virtual dep" % @@ -190,7 +190,7 @@ class DebPackage(object): depname = self._maybe_append_multiarch_suffix(depname) # if we don't have it in the cache, it may be virtual - if not depname in self._cache: + if depname not in self._cache: if not self._cache.is_virtual_package(depname): continue providers = self._cache.get_providing_packages(depname) @@ -245,7 +245,7 @@ class DebPackage(object): #print "pkgver: %s " % pkgver #print "oper: %s " % oper if (apt_pkg.check_dep(pkgver, oper, ver) and not - self.replaces_real_pkg(pkgname, oper, ver)): + self.replaces_real_pkg(pkgname, oper, ver)): self._failure_string += _("Conflicts with the installed package " "'%s'") % pkg.name self._dbg(3, "conflicts with installed pkg '%s'" % pkg.name) @@ -266,7 +266,7 @@ class DebPackage(object): depname, in_conflict_checking=True) # check conflicts with virtual pkgs - if not depname in self._cache: + if depname not in self._cache: # FIXME: we have to check for virtual replaces here as # well (to pass tests/gdebi-test8.deb) if self._cache.is_virtual_package(depname): @@ -430,7 +430,7 @@ class DebPackage(object): self._cache.op_progress.done() return False if (c_or.target_pkg.name in provides and - self.pkgname != pkg.name): + self.pkgname != pkg.name): self._dbg( 2, "would break (conflicts) %s" % provides) self._failure_string += _( @@ -483,7 +483,7 @@ class DebPackage(object): self._check_was_run = True # check arch - if not "Architecture" in self._sections: + if "Architecture" not in self._sections: self._dbg(1, "ERROR: no architecture field") self._failure_string = _("No Architecture field in the package") return False @@ -713,11 +713,11 @@ class DscSrcPackage(DebPackage): try: for sec in tagfile: for tag in depends_tags: - if not tag in sec: + if tag not in sec: continue self._depends.extend(apt_pkg.parse_src_depends(sec[tag])) for tag in conflicts_tags: - if not tag in sec: + if tag not in sec: continue self._conflicts.extend(apt_pkg.parse_src_depends(sec[tag])) if 'Source' in sec: diff --git a/apt/utils.py b/apt/utils.py index 5a914fc2..948aac92 100644 --- a/apt/utils.py +++ b/apt/utils.py @@ -50,7 +50,7 @@ def get_release_date_from_release_file(path): return None tag = apt_pkg.TagFile(open(path)) section = next(tag) - if not "Date" in section: + if "Date" not in section: return None date = section["Date"] return apt_pkg.str_to_time(date) @@ -70,8 +70,8 @@ def get_release_filename_for_pkg(cache, pkgname, label, release): for ver_file, _index in aver.file_list: #print verFile if (ver_file.origin == label and - ver_file.label == label and - ver_file.archive == release): + ver_file.label == label and + ver_file.archive == release): ver = aver if not ver: return None @@ -79,8 +79,8 @@ def get_release_filename_for_pkg(cache, pkgname, label, release): for metaindex in cache._list.list: for m in metaindex.index_files: if (indexfile and - indexfile.describe == m.describe and - indexfile.is_trusted): + indexfile.describe == m.describe and + indexfile.is_trusted): dirname = apt_pkg.config.find_dir("Dir::State::lists") name = (apt_pkg.uri_to_filename(metaindex.uri) + "dists_%s_Release" % metaindex.dist) diff --git a/aptsources/distinfo.py b/aptsources/distinfo.py index b03e68f8..8fcbac96 100644 --- a/aptsources/distinfo.py +++ b/aptsources/distinfo.py @@ -254,8 +254,8 @@ class DistInfo(object): template.description = _(value) elif field == 'Component': if (component and not - template.has_component(component.name)): - template.components.append(component) + template.has_component(component.name)): + template.components.append(component) component = Component(value) elif field == 'CompDescription': component.set_description(_(value)) diff --git a/aptsources/distro.py b/aptsources/distro.py index 9b48a10f..f75aa06b 100644 --- a/aptsources/distro.py +++ b/aptsources/distro.py @@ -77,7 +77,7 @@ class Distribution(object): # find the distro template for template in self.sourceslist.matcher.templates: if (self.is_codename(template.name) and - template.distribution == self.id): + template.distribution == self.id): #print "yeah! found a template for %s" % self.description #print template.description, template.base_uri, \ # template.components @@ -96,40 +96,40 @@ class Distribution(object): #source_code = [] for source in self.sourceslist.list: if (not source.invalid and - self.is_codename(source.dist) and - source.template and - source.template.official and - self.is_codename(source.template.name)): + self.is_codename(source.dist) and + source.template and + source.template.official and + self.is_codename(source.template.name)): #print "yeah! found a distro repo: %s" % source.line # cdroms need do be handled differently if (source.uri.startswith("cdrom:") and - not source.disabled): - self.cdrom_sources.append(source) - cdrom_comps.extend(source.comps) + not source.disabled): + self.cdrom_sources.append(source) + cdrom_comps.extend(source.comps) elif (source.uri.startswith("cdrom:") and - source.disabled): + source.disabled): self.cdrom_sources.append(source) elif (source.type == self.binary_type and - not source.disabled): + not source.disabled): self.main_sources.append(source) comps.extend(source.comps) media.append(source.uri) elif (source.type == self.binary_type and - source.disabled): + source.disabled): self.disabled_sources.append(source) - elif (source.type == self.source_type - and not source.disabled): + elif (source.type == self.source_type and + not source.disabled): self.source_code_sources.append(source) elif (source.type == self.source_type and - source.disabled): + source.disabled): self.disabled_sources.append(source) if (not source.invalid and - source.template in self.source_template.children): + source.template in self.source_template.children): if (not source.disabled - and source.type == self.binary_type): - self.child_sources.append(source) + and source.type == self.binary_type): + self.child_sources.append(source) elif (not source.disabled - and source.type == self.source_type): + and source.type == self.source_type): self.source_code_sources.append(source) else: self.disabled_sources.append(source) @@ -256,9 +256,9 @@ class Distribution(object): for server in self.used_servers: mirror_entry = [self._get_mirror_name(server), server, False] if (compare_mirrors(server, self.nearest_server) or - compare_mirrors(server, self.main_server)): + compare_mirrors(server, self.main_server)): continue - elif not mirror_entry in mirrors: + elif mirror_entry not in mirrors: mirrors.append(mirror_entry) return mirrors @@ -405,7 +405,7 @@ class Distribution(object): for source in self.child_sources: # Do not change the forces server of a child source if (source.template.base_uri is None or - source.template.base_uri != source.uri): + source.template.base_uri != source.uri): change_server_of_source(source, uri, seen_binary) for source in self.source_code_sources: change_server_of_source(source, uri, seen_source) diff --git a/aptsources/sourceslist.py b/aptsources/sourceslist.py index 91ce8eff..842b1451 100644 --- a/aptsources/sourceslist.py +++ b/aptsources/sourceslist.py @@ -87,23 +87,22 @@ class SourceEntry(object): """ single sources.list entry """ def __init__(self, line, file=None): - self.invalid = False # is the source entry valid - self.disabled = False # is it disabled ('#' in front) - self.type = "" # what type (deb, deb-src) - self.architectures = [] # architectures - self.trusted = None # Trusted - self.uri = "" # base-uri - self.dist = "" # distribution (dapper, edgy, etc) - self.comps = [] # list of available componetns - # (may empty) - self.comment = "" # (optional) comment - self.line = line # the original sources.list line + self.invalid = False # is the source entry valid + self.disabled = False # is it disabled ('#' in front) + self.type = "" # what type (deb, deb-src) + self.architectures = [] # architectures + self.trusted = None # Trusted + self.uri = "" # base-uri + self.dist = "" # distribution (dapper, edgy, etc) + self.comps = [] # list of available componetns (may empty) + self.comment = "" # (optional) comment + self.line = line # the original sources.list line if file is None: file = apt_pkg.config.find_dir( "Dir::Etc") + apt_pkg.config.find("Dir::Etc::sourcelist") - self.file = file # the file that the entry is located in + self.file = file # the file that the entry is located in self.parse(line) - self.template = None # type DistInfo.Suite + self.template = None # type DistInfo.Suite self.children = [] def __eq__(self, other): @@ -301,7 +300,7 @@ class SourcesList(object): def __find(self, *predicates, **attrs): for source in self.list: if (all(getattr(source, key) == attrs[key] for key in attrs) and - all(predicate(source) for predicate in predicates)): + all(predicate(source) for predicate in predicates)): yield source def add(self, type, uri, dist, orig_comps, comment="", pos=-1, file=None, @@ -379,8 +378,8 @@ class SourcesList(object): if backup_ext is None: backup_ext = time.strftime("%y%m%d.%H%M") for source in self.list: - if not source.file in already_backuped \ - and os.path.exists(source.file): + if (source.file not in already_backuped + and os.path.exists(source.file)): shutil.copy(source.file, "%s%s" % (source.file, backup_ext)) return backup_ext @@ -467,15 +466,15 @@ class SourceEntryMatcher(object): found = False for template in self.templates: if (re.search(template.match_uri, source.uri) and - re.match(template.match_name, source.dist) and - # deb is a valid fallback for deb-src (if that is not - # definied, see #760035 - (source.type == template.type or template.type == "deb")): + re.match(template.match_name, source.dist) and + # deb is a valid fallback for deb-src (if that is not + # definied, see #760035 + (source.type == template.type or template.type == "deb")): found = True source.template = template break elif (template.is_mirror(source.uri) and - re.match(template.match_name, source.dist)): + re.match(template.match_name, source.dist)): found = True source.template = template break diff --git a/doc/examples/all_deps.py b/doc/examples/all_deps.py index 179501f4..6ce264bb 100644 --- a/doc/examples/all_deps.py +++ b/doc/examples/all_deps.py @@ -14,8 +14,8 @@ def dependencies(cache, pkg, deps, key="Depends"): for depVerList in dependslist[key]: for dep in depVerList: if dep.target_pkg.name in cache: - if pkg.name != dep.target_pkg.name and \ - not dep.target_pkg.name in deps: + if (pkg.name != dep.target_pkg.name and + dep.target_pkg.name not in deps): deps.add(dep.target_pkg.name) dependencies( cache, cache[dep.target_pkg.name], deps, key) diff --git a/doc/source/examples/missing-deps.py b/doc/source/examples/missing-deps.py index 7af18128..b9ccdc19 100644 --- a/doc/source/examples/missing-deps.py +++ b/doc/source/examples/missing-deps.py @@ -43,7 +43,7 @@ def main(): # Check every version for pfile, _ in version.file_list: if (pfile.origin == "Debian" and pfile.component == "main" and - pfile.archive == "unstable"): + pfile.archive == "unstable"): # We only want packages from Debian unstable main. check_version(version) break diff --git a/tests/test_aptsources.py b/tests/test_aptsources.py index f955205f..f174bd41 100644 --- a/tests/test_aptsources.py +++ b/tests/test_aptsources.py @@ -77,9 +77,9 @@ class TestAptSources(unittest.TestCase): found = False for entry in sources: if (entry.type == "deb" and - entry.uri == "http://de.archive.ubuntu.com/ubuntu/" and - entry.dist == "edgy" and - "multiverse" in entry.comps): + entry.uri == "http://de.archive.ubuntu.com/ubuntu/" and + entry.dist == "edgy" and + "multiverse" in entry.comps): found = True self.assertTrue(found) @@ -90,10 +90,10 @@ class TestAptSources(unittest.TestCase): found = False for entry in sources: if (entry.type == "deb" and - entry.uri == "http://de.archive.ubuntu.com/ubuntu/" and - entry.dist == "natty" and - entry.architectures == [] and - "multiverse" in entry.comps): + entry.uri == "http://de.archive.ubuntu.com/ubuntu/" and + entry.dist == "natty" and + entry.architectures == [] and + "multiverse" in entry.comps): found = True self.assertTrue(found) @@ -104,10 +104,10 @@ class TestAptSources(unittest.TestCase): found = False for entry in sources: if (entry.type == "deb" and - entry.uri == "http://de.archive.ubuntu.com/ubuntu/" and - entry.dist == "natty" and - set(entry.architectures) == set(["amd64", "i386"]) and - set(entry.comps) == set(["main", "universe"])): + entry.uri == "http://de.archive.ubuntu.com/ubuntu/" and + entry.dist == "natty" and + set(entry.architectures) == set(["amd64", "i386"]) and + set(entry.comps) == set(["main", "universe"])): found = True self.assertTrue(found) # test to add something new: multiverse *and* @@ -120,8 +120,8 @@ class TestAptSources(unittest.TestCase): found_something = 0 for entry in sources: if (entry.type == "deb" and - entry.uri == "http://de.archive.ubuntu.com/ubuntu/" and - entry.dist == "edgy"): + entry.uri == "http://de.archive.ubuntu.com/ubuntu/" and + entry.dist == "edgy"): for c in entry.comps: if c == "universe": found_universe += 1 @@ -219,11 +219,11 @@ class TestAptSources(unittest.TestCase): found = {} for entry in sources: if (entry.type == "deb" and - entry.uri == "http://de.archive.ubuntu.com/ubuntu/" and - "edgy" in entry.dist): + entry.uri == "http://de.archive.ubuntu.com/ubuntu/" and + "edgy" in entry.dist): for c in entry.comps: if c == comp: - if not entry.dist in found: + if entry.dist not in found: found[entry.dist] = 0 found[entry.dist] += 1 #print "".join([s.str() for s in sources]) @@ -236,11 +236,11 @@ class TestAptSources(unittest.TestCase): found = {} for entry in sources: if (entry.type == "deb" and - entry.template and - entry.template.name == "edgy"): + entry.template and + entry.template.name == "edgy"): for c in entry.comps: if c == comp: - if not entry.dist in found.has_key: + if entry.dist not in found.has_key: found[entry.dist] = 0 found[entry.dist] += 1 #print "".join([s.str() for s in sources]) diff --git a/tests/test_debfile_multiarch.py b/tests/test_debfile_multiarch.py index 045daf72..f8847838 100644 --- a/tests/test_debfile_multiarch.py +++ b/tests/test_debfile_multiarch.py @@ -39,7 +39,7 @@ class TestDebfileMultiarch(unittest.TestCase): # WARNING: this assumes that lib3ds-1-3 is a non-multiarch lib # use "lib3ds-1-3" as a test to see if non-multiach lib conflicts work canary = "lib3ds-1-3" - if not canary in cache: + if canary not in cache: # TODO: use unittest.skip #logging.warning("skipping test because %s is missing" % canary) return diff --git a/tests/test_pep8.py b/tests/test_pep8.py index 2e1f43fc..b3ec2dba 100755 --- a/tests/test_pep8.py +++ b/tests/test_pep8.py @@ -16,7 +16,8 @@ class PackagePep8TestCase(unittest.TestCase): # E126 continuation line over-indented for hanging indent # E127 continuation line over-indented for visual indent # E128 continuation line under-indented for visual indent - "--ignore=E125,E126,E127,E128", + # E265 block comment should start with '# ' + "--ignore=E125,E126,E127,E128,E265", "--exclude", "build,tests/old", "--repeat", py_dir]) if res != 0: diff --git a/utils/get_debian_mirrors.py b/utils/get_debian_mirrors.py index 5f4d7ff0..de4ebb95 100755 --- a/utils/get_debian_mirrors.py +++ b/utils/get_debian_mirrors.py @@ -29,7 +29,7 @@ masterlist = urllib2.urlopen("http://anonscm.debian.org/viewvc/" "mirror/Mirrors.masterlist?revision=HEAD") for mirror in deb822.Deb822.iter_paragraphs(masterlist): - if not "Country" in mirror: + if "Country" not in mirror: continue country = mirror["Country"].split(None, 1)[0] site = mirror["Site"] diff --git a/utils/get_ubuntu_mirrors_from_lp.py b/utils/get_ubuntu_mirrors_from_lp.py index dd02b63d..41d37be9 100755 --- a/utils/get_ubuntu_mirrors_from_lp.py +++ b/utils/get_ubuntu_mirrors_from_lp.py @@ -34,7 +34,7 @@ countries = {} for entry in d.entries: countrycode = entry.mirror_countrycode - if not countrycode in countries: + if countrycode not in countries: countries[countrycode] = set() for link in entry.links: countries[countrycode].add(link.href) -- cgit v1.2.3 From cb31126aa0a0ac0e31220d95611deb18639d3c9b Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Mon, 30 Jun 2014 13:32:24 +0200 Subject: releasing package python-apt version 0.9.3.8 --- debian/changelog | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/debian/changelog b/debian/changelog index 60b5b859..c3bc8c22 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +python-apt (0.9.3.8) unstable; urgency=medium + + * pep8 fixes to fix autopkgtest failure with the most recent + pep8 package + + -- Michael Vogt Mon, 30 Jun 2014 13:31:29 +0200 + python-apt (0.9.3.7) unstable; urgency=medium * Include "Blankon" template (Closes: #747498) -- cgit v1.2.3 From e8d1333f428a3ba4984a040fb687ce835a05e48f Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Fri, 4 Jul 2014 16:42:23 +0200 Subject: fix another pep8 failure --- tests/old/test_enhances.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/old/test_enhances.py b/tests/old/test_enhances.py index 74614674..a86d57da 100644 --- a/tests/old/test_enhances.py +++ b/tests/old/test_enhances.py @@ -11,7 +11,7 @@ for pkg in cache: for enhances in or_list.or_dependencies: s += " %s" % enhances.name if (enhances.name in cache and - not cache[enhances.name].is_installed): + not cache[enhances.name].is_installed): s += "(*missing*) " s += "," print s[:-1] -- cgit v1.2.3 From 2884948fb3cb9ad0c660380ec07412086e164f31 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Tue, 8 Jul 2014 15:31:01 +0200 Subject: doc/source/tutorials/apt-get.rst: Remove -s from --print-uris invocation This is not needed with APT 1.0 and does not work anymore. LP: #1308670 Reported-by: Sean Payne --- doc/source/tutorials/apt-get.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/source/tutorials/apt-get.rst b/doc/source/tutorials/apt-get.rst index 3bac473b..f8dd0895 100644 --- a/doc/source/tutorials/apt-get.rst +++ b/doc/source/tutorials/apt-get.rst @@ -11,7 +11,7 @@ by the :command:`apt-get` command. Printing the URIs of all index files ------------------------------------ We all now that we can print the URIs of all our index files by running a -simple ``apt-get -s --print-uris update``. We can do the same. Responsible for +simple ``apt-get --print-uris update``. We can do the same. Responsible for the source entries is the class :class:`apt_pkg.SourceList`, which can be combined with an :class:`apt_pkg.Acquire` object using :meth:`get_indexes`. -- cgit v1.2.3 From 260597a6f29415ccacb5583381f9ba5bcb463e6f Mon Sep 17 00:00:00 2001 From: Mauricio Faria de Oliveira Date: Thu, 28 Aug 2014 14:35:08 -0700 Subject: tests/test_pep8.py: --ignore E129 too (fix FTBFS with pep8 >= 1.5) --- tests/test_pep8.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/test_pep8.py b/tests/test_pep8.py index b3ec2dba..eee7c7a6 100755 --- a/tests/test_pep8.py +++ b/tests/test_pep8.py @@ -16,8 +16,10 @@ class PackagePep8TestCase(unittest.TestCase): # E126 continuation line over-indented for hanging indent # E127 continuation line over-indented for visual indent # E128 continuation line under-indented for visual indent + # E129 continuation line does not distinguish itself from + # next logical line # E265 block comment should start with '# ' - "--ignore=E125,E126,E127,E128,E265", + "--ignore=E125,E126,E127,E128,E129,E265", "--exclude", "build,tests/old", "--repeat", py_dir]) if res != 0: -- cgit v1.2.3 From 470da5754d0c97a883b76a7e263a678df83156e0 Mon Sep 17 00:00:00 2001 From: Mauricio Faria de Oliveira Date: Thu, 28 Aug 2014 14:44:10 -0700 Subject: tests/test_auth.py: update for gnupg 1.4.18 The test 'test_add_key_from_server_mitm' needs updating for gnupg 1.4.18 which fail differently/earlier when 'fingerprints do not match' since commit 'Screen keyserver responses' (5230304349490f31aa64ee2b69a8a2bc06bf7816) With that change gnupg actually checks itself(!) if the key that the server send matches the key that the user asked for. Closes: #755342 --- apt/auth.py | 6 ++++++ tests/test_auth.py | 5 ++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/apt/auth.py b/apt/auth.py index 6fe7c01a..b8089d0c 100644 --- a/apt/auth.py +++ b/apt/auth.py @@ -154,6 +154,12 @@ def _add_key_from_keyserver(keyid, keyserver, tmp_keyring_dir): if res != 0: raise AptKeyError("recv from '%s' failed for '%s'" % ( keyserver, keyid)) + # FIXME: + # - with gnupg 1.4.18 the downloaded key is actually checked(!), + # i.e. gnupg will not import anything that the server sends + # into the keyring, so the below checks are now redundant *if* + # gnupg 1.4.18 is used + # now export again using the long key id (to ensure that there is # really only this one key in our keyring) and not someone MITM us tmp_export_keyring = os.path.join(tmp_keyring_dir, "export-keyring.gpg") diff --git a/tests/test_auth.py b/tests/test_auth.py index 790ed380..67377363 100644 --- a/tests/test_auth.py +++ b/tests/test_auth.py @@ -212,7 +212,10 @@ class TestAuthKeys(unittest.TestCase): "0101010178F7FE5C3E65D8AF8B48AD6246925553", "hkp://localhost:%d" % self.keyserver_port) self.assertTrue( - str(cm.exception).startswith("Fingerprints do not match"), + str(cm.exception).startswith( + "recv from 'hkp://localhost:%d' failed for '%s'" % ( + self.keyserver_port, + "0101010178F7FE5C3E65D8AF8B48AD6246925553")), cm.exception) def testAddKeyFromServer(self): -- cgit v1.2.3 From a34199684bb1e59e56c3bc5f30881a5402ebe7b9 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Thu, 28 Aug 2014 14:47:36 -0700 Subject: release 0.9.3.9 --- debian/changelog | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/debian/changelog b/debian/changelog index c3bc8c22..e0ae1a65 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,18 @@ +python-apt (0.9.3.9) unstable; urgency=medium + + [ Michael Vogt ] + * fix another pep8 failure + + [ Julian Andres Klode ] + * doc/source/tutorials/apt-get.rst: Remove -s from --print-uris invocation + (LP: #1308670) + + [ Mauricio Faria de Oliveira ] + * tests/test_pep8.py: --ignore E129 too (fix FTBFS with pep8 >= 1.5) + * tests/test_auth.py: update for gnupg 1.4.18 (Closes: #755342) + + -- Michael Vogt Thu, 28 Aug 2014 14:46:57 -0700 + python-apt (0.9.3.8) unstable; urgency=medium * pep8 fixes to fix autopkgtest failure with the most recent -- cgit v1.2.3 From 578b3317af12be7c5ecedd8240c09a3d513fa382 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Thu, 19 Jun 2014 07:43:56 +0200 Subject: python/tag.cc: ensure that the final \n is there when duplicating section data --- python/tag.cc | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/python/tag.cc b/python/tag.cc index 50786cee..8f483467 100644 --- a/python/tag.cc +++ b/python/tag.cc @@ -338,11 +338,14 @@ static PyObject *TagFileNext(PyObject *Self) const char *Start; const char *Stop; Obj.Section->Object.GetSection(Start,Stop); - // Duplicate the data - Obj.Section->Data = new char[Stop-Start]; - strncpy(Obj.Section->Data, Start, Stop-Start); + // Duplicate the data and + // append a \n because GetSection() will only give us a single \n + // but Scan() needs \n\n to work + Obj.Section->Data = new char[Stop-Start+2]; + snprintf(Obj.Section->Data, Stop-Start+2, "%s\n", Start); // Rescan it - Obj.Section->Object.Scan(Obj.Section->Data, Stop-Start); + if(Obj.Section->Object.Scan(Obj.Section->Data, Stop-Start) == false) + return HandleErrors(NULL); Py_INCREF(Obj.Section); return HandleErrors(Obj.Section); -- cgit v1.2.3 From cee43f7e7dfa588385deea06101e93e85886f1db Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Tue, 2 Sep 2014 18:09:02 +0200 Subject: Stop reading after the "Format" stanza in a .dsc file This makes the tagfile parser skip the last gpg signature part that also contains a "Version:" line. --- apt/debfile.py | 3 +++ tests/test_debfile.py | 1 + 2 files changed, 4 insertions(+) diff --git a/apt/debfile.py b/apt/debfile.py index 2c95bdf1..9d9b2695 100644 --- a/apt/debfile.py +++ b/apt/debfile.py @@ -726,6 +726,9 @@ class DscSrcPackage(DebPackage): self.binaries = sec['Binary'].split(', ') if 'Version' in sec: self._sections['Version'] = sec['Version'] + # we are done + if 'Format' in sec: + break finally: del tagfile fobj.close() diff --git a/tests/test_debfile.py b/tests/test_debfile.py index 21255517..b27e6567 100644 --- a/tests/test_debfile.py +++ b/tests/test_debfile.py @@ -73,6 +73,7 @@ class TestDebfile(unittest.TestCase): deb = apt.debfile.DscSrcPackage(cache=self.cache) deb.open(os.path.join("data", "test_debs", filename)) self.assertFalse(deb.check()) + self.assertEqual(deb["Version"], "2.5-1") def testDebFile(self): deb = apt.debfile.DebPackage(cache=self.cache) -- cgit v1.2.3 From ea440c589db54ac01e79ad8d09a9976e77f15f23 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Wed, 3 Sep 2014 09:00:53 +0200 Subject: add support for apt.debfile.DscSrcPackage.filelist --- apt/debfile.py | 15 ++++++++++++--- tests/test_debfile.py | 4 ++++ 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/apt/debfile.py b/apt/debfile.py index 9d9b2695..5c6de3c7 100644 --- a/apt/debfile.py +++ b/apt/debfile.py @@ -704,6 +704,12 @@ class DscSrcPackage(DebPackage): """Return the dependencies of the package""" return self._conflicts + @property + def filelist(self): + """Return the list of files associated with this dsc file""" + # Files stanza looks like (hash, size, filename, ...) + return self._sections['Files'].split()[2::3] + def open(self, file): """Open the package.""" depends_tags = ["Build-Depends", "Build-Depends-Indep"] @@ -724,9 +730,12 @@ class DscSrcPackage(DebPackage): self.pkgname = sec['Source'] if 'Binary' in sec: self.binaries = sec['Binary'].split(', ') - if 'Version' in sec: - self._sections['Version'] = sec['Version'] - # we are done + # read some more tags + for tag in ('Version', 'Files', 'Checksum-Sha1'): + if tag in sec: + self._sections[tag] = sec[tag] + # we only care about the stanza with the "Format:" tag, the + # rest is gpg signature noise if 'Format' in sec: break finally: diff --git a/tests/test_debfile.py b/tests/test_debfile.py index b27e6567..0c7028ab 100644 --- a/tests/test_debfile.py +++ b/tests/test_debfile.py @@ -75,6 +75,10 @@ class TestDebfile(unittest.TestCase): self.assertFalse(deb.check()) self.assertEqual(deb["Version"], "2.5-1") + self.maxDiff = None + self.assertEqual(deb.filelist, ["hello_2.5.orig.tar.gz", + "hello_2.5-1.diff.gz"]) + def testDebFile(self): deb = apt.debfile.DebPackage(cache=self.cache) for (filename, expected_res) in self.TEST_DEBS: -- cgit v1.2.3 From 5960003fc970480bd48b0cc1c0f8b5ed80af7dac Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Wed, 3 Sep 2014 09:16:56 +0200 Subject: read all tags from a dsc file and improve tests --- apt/debfile.py | 12 ++++++------ tests/test_debfile.py | 28 +++++++++++++++++++++------- 2 files changed, 27 insertions(+), 13 deletions(-) diff --git a/apt/debfile.py b/apt/debfile.py index 5c6de3c7..2528fd8a 100644 --- a/apt/debfile.py +++ b/apt/debfile.py @@ -718,6 +718,11 @@ class DscSrcPackage(DebPackage): tagfile = apt_pkg.TagFile(fobj) try: for sec in tagfile: + # we only care about the stanza with the "Format:" tag, the + # rest is gpg signature noise. we should probably have + # bindings for apts OpenMaybeClearsignedFile() + if not "Format" in sec: + continue for tag in depends_tags: if tag not in sec: continue @@ -730,14 +735,9 @@ class DscSrcPackage(DebPackage): self.pkgname = sec['Source'] if 'Binary' in sec: self.binaries = sec['Binary'].split(', ') - # read some more tags - for tag in ('Version', 'Files', 'Checksum-Sha1'): + for tag in sec.keys(): if tag in sec: self._sections[tag] = sec[tag] - # we only care about the stanza with the "Format:" tag, the - # rest is gpg signature noise - if 'Format' in sec: - break finally: del tagfile fobj.close() diff --git a/tests/test_debfile.py b/tests/test_debfile.py index 0c7028ab..b8418e78 100644 --- a/tests/test_debfile.py +++ b/tests/test_debfile.py @@ -62,24 +62,38 @@ class TestDebfile(unittest.TestCase): apt_pkg.init_system() self.cache = apt.Cache() - def testDscFile(self): + def test_dsc_file(self): filename = "hello_2.5-1.dsc" deb = apt.debfile.DscSrcPackage(cache=self.cache) deb.open(os.path.join("data", "test_debs", filename)) self.assertTrue(deb.check(), "got failure '%s'" % deb._failure_string) missing = set(['autotools-dev']) self.assertEqual(set(deb.missing_deps), missing) + # specialized properties + self.assertEqual(deb.pkgname, "hello") + self.assertEqual(deb.binaries, ["hello"]) + self.assertEqual(deb.filelist, ["hello_2.5.orig.tar.gz", + "hello_2.5-1.diff.gz"]) + self.assertEqual(deb.depends, [[("autotools-dev", "", "")]]) + # tag fields are available as a dict + self.assertEqual(deb["Format"], "1.0") + self.assertEqual(deb["Source"], "hello") + self.assertEqual(deb["Binary"], "hello") + self.assertEqual(deb["Architecture"], "any") + self.assertEqual(deb["Version"], "2.5-1") + self.assertEqual( + deb["Maintainer"], "Santiago Vila ") + self.assertEqual(deb["Homepage"], "http://www.gnu.org/software/hello") + self.assertEqual(deb["Standards-Version"], "3.8.4") + + def test_dsc_file_with_impossible_build_dep(self): filename = "impossible-build-depends_2.5-1.dsc" deb = apt.debfile.DscSrcPackage(cache=self.cache) deb.open(os.path.join("data", "test_debs", filename)) self.assertFalse(deb.check()) - self.assertEqual(deb["Version"], "2.5-1") - - self.maxDiff = None - self.assertEqual(deb.filelist, ["hello_2.5.orig.tar.gz", - "hello_2.5-1.diff.gz"]) + self.assertEqual(deb.depends, [[("debhelper", "101", ">")]]) - def testDebFile(self): + def test_deb_file(self): deb = apt.debfile.DebPackage(cache=self.cache) for (filename, expected_res) in self.TEST_DEBS: logging.debug("testing %s, expecting %s" % ( -- cgit v1.2.3 From 7262bab8e520db7e326c219c24e996e20f91e906 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Wed, 3 Sep 2014 10:25:26 +0200 Subject: fix tests --- apt/auth.py | 6 ++++-- apt/debfile.py | 2 +- python/tag.cc | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/apt/auth.py b/apt/auth.py index b8089d0c..74fea10b 100644 --- a/apt/auth.py +++ b/apt/auth.py @@ -192,9 +192,11 @@ def _add_key_from_keyserver(keyid, keyserver, tmp_keyring_dir): # what gnupg is using) signing_key_fingerprint = keyid.replace("0x", "").upper() if got_fingerprint != signing_key_fingerprint: + # make the error match what gnupg >= 1.4.18 will output when + # it checks the key itself before importing it raise AptKeyError( - "Fingerprints do not match, not importing: '%s' != '%s'" % ( - signing_key_fingerprint, got_fingerprint)) + "recv from '%s' failed for '%s'" % ( + keyserver, signing_key_fingerprint)) # finally add it add_key_from_file(tmp_export_keyring) diff --git a/apt/debfile.py b/apt/debfile.py index 2528fd8a..1f93b7bb 100644 --- a/apt/debfile.py +++ b/apt/debfile.py @@ -721,7 +721,7 @@ class DscSrcPackage(DebPackage): # we only care about the stanza with the "Format:" tag, the # rest is gpg signature noise. we should probably have # bindings for apts OpenMaybeClearsignedFile() - if not "Format" in sec: + if "Format" not in sec: continue for tag in depends_tags: if tag not in sec: diff --git a/python/tag.cc b/python/tag.cc index 8f483467..8fb0a78e 100644 --- a/python/tag.cc +++ b/python/tag.cc @@ -344,7 +344,7 @@ static PyObject *TagFileNext(PyObject *Self) Obj.Section->Data = new char[Stop-Start+2]; snprintf(Obj.Section->Data, Stop-Start+2, "%s\n", Start); // Rescan it - if(Obj.Section->Object.Scan(Obj.Section->Data, Stop-Start) == false) + if(Obj.Section->Object.Scan(Obj.Section->Data, Stop-Start+2) == false) return HandleErrors(NULL); Py_INCREF(Obj.Section); -- cgit v1.2.3 From b96c8552b5970c28e4af41d7bcf7e69624df4fe1 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Wed, 3 Sep 2014 10:25:39 +0200 Subject: update python-apt.pot --- po/python-apt.pot | 228 ++++++++++++++++++++++++++++-------------------------- 1 file changed, 119 insertions(+), 109 deletions(-) diff --git a/po/python-apt.pot b/po/python-apt.pot index 8d8b1261..969590aa 100644 --- a/po/python-apt.pot +++ b/po/python-apt.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2014-01-01 09:20+0100\n" +"POT-Creation-Date: 2014-09-03 10:25+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -30,366 +30,376 @@ msgstr "" #. Description #: ../data/templates/Ubuntu.info.in:140 -msgid "Ubuntu 14.04 'Trusty Tahr'" +msgid "Ubuntu 14.10 'Utopic Unicorn'" msgstr "" #. Description #: ../data/templates/Ubuntu.info.in:147 -msgid "Cdrom with Ubuntu 14.04 'Trusty Tahr'" +msgid "Cdrom with Ubuntu 14.10 'Utopic Unicorn'" msgstr "" #. Description #: ../data/templates/Ubuntu.info.in:259 -msgid "Ubuntu 13.10 'Saucy Salamander'" +msgid "Ubuntu 14.04 'Trusty Tahr'" msgstr "" #. Description #: ../data/templates/Ubuntu.info.in:266 -msgid "Cdrom with Ubuntu 13.10 'Saucy Salamander'" +msgid "Cdrom with Ubuntu 14.04 'Trusty Tahr'" msgstr "" #. Description #: ../data/templates/Ubuntu.info.in:378 -msgid "Ubuntu 13.04 'Raring Ringtail'" +msgid "Ubuntu 13.10 'Saucy Salamander'" msgstr "" #. Description #: ../data/templates/Ubuntu.info.in:385 -msgid "Cdrom with Ubuntu 13.04 'Raring Ringtail'" +msgid "Cdrom with Ubuntu 13.10 'Saucy Salamander'" msgstr "" #. Description #: ../data/templates/Ubuntu.info.in:497 -msgid "Ubuntu 12.10 'Quantal Quetzal'" +msgid "Ubuntu 13.04 'Raring Ringtail'" msgstr "" #. Description #: ../data/templates/Ubuntu.info.in:504 +msgid "Cdrom with Ubuntu 13.04 'Raring Ringtail'" +msgstr "" + +#. Description +#: ../data/templates/Ubuntu.info.in:616 +msgid "Ubuntu 12.10 'Quantal Quetzal'" +msgstr "" + +#. Description +#: ../data/templates/Ubuntu.info.in:623 msgid "Cdrom with Ubuntu 12.10 'Quantal Quetzal'" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:615 +#: ../data/templates/Ubuntu.info.in:734 msgid "Ubuntu 12.04 'Precise Pangolin'" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:622 +#: ../data/templates/Ubuntu.info.in:741 msgid "Cdrom with Ubuntu 12.04 'Precise Pangolin'" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:733 +#: ../data/templates/Ubuntu.info.in:852 msgid "Ubuntu 11.10 'Oneiric Ocelot'" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:740 +#: ../data/templates/Ubuntu.info.in:859 msgid "Cdrom with Ubuntu 11.10 'Oneiric Ocelot'" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:852 +#: ../data/templates/Ubuntu.info.in:971 msgid "Ubuntu 11.04 'Natty Narwhal'" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:859 +#: ../data/templates/Ubuntu.info.in:978 msgid "Cdrom with Ubuntu 11.04 'Natty Narwhal'" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:950 +#: ../data/templates/Ubuntu.info.in:1069 msgid "Ubuntu 10.10 'Maverick Meerkat'" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:970 +#: ../data/templates/Ubuntu.info.in:1089 msgid "Cdrom with Ubuntu 10.10 'Maverick Meerkat'" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:982 +#: ../data/templates/Ubuntu.info.in:1101 msgid "Canonical Partners" msgstr "" #. CompDescription -#: ../data/templates/Ubuntu.info.in:984 +#: ../data/templates/Ubuntu.info.in:1103 msgid "Software packaged by Canonical for their partners" msgstr "" #. CompDescriptionLong -#: ../data/templates/Ubuntu.info.in:985 +#: ../data/templates/Ubuntu.info.in:1104 msgid "This software is not part of Ubuntu." msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:992 +#: ../data/templates/Ubuntu.info.in:1111 msgid "Independent" msgstr "" #. CompDescription -#: ../data/templates/Ubuntu.info.in:994 +#: ../data/templates/Ubuntu.info.in:1113 msgid "Provided by third-party software developers" msgstr "" #. CompDescriptionLong -#: ../data/templates/Ubuntu.info.in:995 +#: ../data/templates/Ubuntu.info.in:1114 msgid "Software offered by third party developers." msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:1033 +#: ../data/templates/Ubuntu.info.in:1152 msgid "Ubuntu 10.04 'Lucid Lynx'" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:1053 +#: ../data/templates/Ubuntu.info.in:1172 msgid "Cdrom with Ubuntu 10.04 'Lucid Lynx'" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:1096 +#: ../data/templates/Ubuntu.info.in:1215 msgid "Ubuntu 9.10 'Karmic Koala'" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:1116 +#: ../data/templates/Ubuntu.info.in:1235 msgid "Cdrom with Ubuntu 9.10 'Karmic Koala'" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:1159 +#: ../data/templates/Ubuntu.info.in:1278 msgid "Ubuntu 9.04 'Jaunty Jackalope'" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:1178 +#: ../data/templates/Ubuntu.info.in:1297 msgid "Cdrom with Ubuntu 9.04 'Jaunty Jackalope'" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:1221 +#: ../data/templates/Ubuntu.info.in:1340 msgid "Ubuntu 8.10 'Intrepid Ibex'" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:1241 +#: ../data/templates/Ubuntu.info.in:1360 msgid "Cdrom with Ubuntu 8.10 'Intrepid Ibex'" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:1285 +#: ../data/templates/Ubuntu.info.in:1404 msgid "Ubuntu 8.04 'Hardy Heron'" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:1305 +#: ../data/templates/Ubuntu.info.in:1424 msgid "Cdrom with Ubuntu 8.04 'Hardy Heron'" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:1350 +#: ../data/templates/Ubuntu.info.in:1469 msgid "Ubuntu 7.10 'Gutsy Gibbon'" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:1369 +#: ../data/templates/Ubuntu.info.in:1488 msgid "Cdrom with Ubuntu 7.10 'Gutsy Gibbon'" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:1414 +#: ../data/templates/Ubuntu.info.in:1533 msgid "Ubuntu 7.04 'Feisty Fawn'" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:1433 +#: ../data/templates/Ubuntu.info.in:1552 msgid "Cdrom with Ubuntu 7.04 'Feisty Fawn'" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:1475 +#: ../data/templates/Ubuntu.info.in:1594 msgid "Ubuntu 6.10 'Edgy Eft'" msgstr "" #. CompDescription -#: ../data/templates/Ubuntu.info.in:1480 +#: ../data/templates/Ubuntu.info.in:1599 msgid "Community-maintained" msgstr "" #. CompDescription -#: ../data/templates/Ubuntu.info.in:1486 +#: ../data/templates/Ubuntu.info.in:1605 msgid "Restricted software" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:1494 +#: ../data/templates/Ubuntu.info.in:1613 msgid "Cdrom with Ubuntu 6.10 'Edgy Eft'" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:1536 +#: ../data/templates/Ubuntu.info.in:1655 msgid "Ubuntu 6.06 LTS 'Dapper Drake'" msgstr "" #. CompDescriptionLong -#: ../data/templates/Ubuntu.info.in:1539 +#: ../data/templates/Ubuntu.info.in:1658 msgid "Canonical-supported free and open-source software" msgstr "" #. CompDescription -#: ../data/templates/Ubuntu.info.in:1541 +#: ../data/templates/Ubuntu.info.in:1660 msgid "Community-maintained (universe)" msgstr "" #. CompDescriptionLong -#: ../data/templates/Ubuntu.info.in:1542 +#: ../data/templates/Ubuntu.info.in:1661 msgid "Community-maintained free and open-source software" msgstr "" #. CompDescription -#: ../data/templates/Ubuntu.info.in:1544 +#: ../data/templates/Ubuntu.info.in:1663 msgid "Non-free drivers" msgstr "" #. CompDescriptionLong -#: ../data/templates/Ubuntu.info.in:1545 +#: ../data/templates/Ubuntu.info.in:1664 msgid "Proprietary drivers for devices" msgstr "" #. CompDescription -#: ../data/templates/Ubuntu.info.in:1547 +#: ../data/templates/Ubuntu.info.in:1666 msgid "Restricted software (Multiverse)" msgstr "" #. CompDescriptionLong -#: ../data/templates/Ubuntu.info.in:1548 +#: ../data/templates/Ubuntu.info.in:1667 msgid "Software restricted by copyright or legal issues" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:1555 +#: ../data/templates/Ubuntu.info.in:1674 msgid "Cdrom with Ubuntu 6.06 LTS 'Dapper Drake'" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:1571 +#: ../data/templates/Ubuntu.info.in:1690 msgid "Important security updates" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:1576 ../data/templates/Debian.info.in:56 +#: ../data/templates/Ubuntu.info.in:1695 ../data/templates/Debian.info.in:56 msgid "Recommended updates" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:1581 +#: ../data/templates/Ubuntu.info.in:1700 msgid "Pre-released updates" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:1586 +#: ../data/templates/Ubuntu.info.in:1705 msgid "Unsupported updates" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:1597 +#: ../data/templates/Ubuntu.info.in:1716 msgid "Ubuntu 5.10 'Breezy Badger'" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:1612 +#: ../data/templates/Ubuntu.info.in:1731 msgid "Cdrom with Ubuntu 5.10 'Breezy Badger'" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:1628 +#: ../data/templates/Ubuntu.info.in:1747 msgid "Ubuntu 5.10 Security Updates" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:1633 +#: ../data/templates/Ubuntu.info.in:1752 msgid "Ubuntu 5.10 Updates" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:1638 +#: ../data/templates/Ubuntu.info.in:1757 msgid "Ubuntu 5.10 Backports" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:1649 +#: ../data/templates/Ubuntu.info.in:1768 msgid "Ubuntu 5.04 'Hoary Hedgehog'" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:1664 +#: ../data/templates/Ubuntu.info.in:1783 msgid "Cdrom with Ubuntu 5.04 'Hoary Hedgehog'" msgstr "" #. CompDescription -#: ../data/templates/Ubuntu.info.in:1667 ../data/templates/Debian.info.in:209 +#: ../data/templates/Ubuntu.info.in:1786 ../data/templates/Debian.info.in:209 msgid "Officially supported" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:1680 +#: ../data/templates/Ubuntu.info.in:1799 msgid "Ubuntu 5.04 Security Updates" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:1685 +#: ../data/templates/Ubuntu.info.in:1804 msgid "Ubuntu 5.04 Updates" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:1690 +#: ../data/templates/Ubuntu.info.in:1809 msgid "Ubuntu 5.04 Backports" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:1696 +#: ../data/templates/Ubuntu.info.in:1815 msgid "Ubuntu 4.10 'Warty Warthog'" msgstr "" #. CompDescription -#: ../data/templates/Ubuntu.info.in:1702 +#: ../data/templates/Ubuntu.info.in:1821 msgid "Community-maintained (Universe)" msgstr "" #. CompDescription -#: ../data/templates/Ubuntu.info.in:1704 +#: ../data/templates/Ubuntu.info.in:1823 msgid "Non-free (Multiverse)" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:1711 +#: ../data/templates/Ubuntu.info.in:1830 msgid "Cdrom with Ubuntu 4.10 'Warty Warthog'" msgstr "" #. CompDescription -#: ../data/templates/Ubuntu.info.in:1714 +#: ../data/templates/Ubuntu.info.in:1833 msgid "No longer officially supported" msgstr "" #. CompDescription -#: ../data/templates/Ubuntu.info.in:1716 +#: ../data/templates/Ubuntu.info.in:1835 msgid "Restricted copyright" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:1723 +#: ../data/templates/Ubuntu.info.in:1842 msgid "Ubuntu 4.10 Security Updates" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:1728 +#: ../data/templates/Ubuntu.info.in:1847 msgid "Ubuntu 4.10 Updates" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:1733 +#: ../data/templates/Ubuntu.info.in:1852 msgid "Ubuntu 4.10 Backports" msgstr "" @@ -482,39 +492,39 @@ msgstr "" msgid "Custom servers" msgstr "" -#: ../apt/progress/gtk2.py:243 +#: ../apt/progress/gtk2.py:245 #, python-format msgid "Downloading file %(current)li of %(total)li with %(speed)s/s" msgstr "" -#: ../apt/progress/gtk2.py:249 +#: ../apt/progress/gtk2.py:251 #, python-format msgid "Downloading file %(current)li of %(total)li" msgstr "" #. Setup some child widgets -#: ../apt/progress/gtk2.py:272 +#: ../apt/progress/gtk2.py:274 msgid "Details" msgstr "" -#: ../apt/progress/gtk2.py:345 +#: ../apt/progress/gtk2.py:347 msgid "Starting..." msgstr "" -#: ../apt/progress/gtk2.py:351 +#: ../apt/progress/gtk2.py:353 msgid "Complete" msgstr "" -#: ../apt/package.py:328 +#: ../apt/package.py:380 #, python-format msgid "Invalid unicode in description for '%s' (%s). Please report." msgstr "" -#: ../apt/package.py:901 ../apt/package.py:1007 +#: ../apt/package.py:950 ../apt/package.py:1056 msgid "The list of changes is not available" msgstr "" -#: ../apt/package.py:1013 +#: ../apt/package.py:1062 #, python-format msgid "" "The list of changes is not available yet.\n" @@ -523,120 +533,120 @@ msgid "" "until the changes become available or try again later." msgstr "" -#: ../apt/package.py:1020 +#: ../apt/package.py:1069 msgid "" "Failed to download the list of changes. \n" "Please check your Internet connection." msgstr "" -#: ../apt/debfile.py:87 +#: ../apt/debfile.py:89 #, python-format msgid "List of files for '%s' could not be read" msgstr "" -#: ../apt/debfile.py:99 +#: ../apt/debfile.py:101 #, python-format msgid "List of control files for '%s' could not be read" msgstr "" -#: ../apt/debfile.py:224 +#: ../apt/debfile.py:226 #, python-format msgid "Dependency is not satisfiable: %s\n" msgstr "" -#: ../apt/debfile.py:247 +#: ../apt/debfile.py:249 #, python-format msgid "Conflicts with the installed package '%s'" msgstr "" -#: ../apt/debfile.py:394 +#: ../apt/debfile.py:396 #, python-format msgid "" "Breaks existing package '%(pkgname)s' dependency %(depname)s " "(%(deprelation)s %(depversion)s)" msgstr "" -#: ../apt/debfile.py:421 +#: ../apt/debfile.py:423 #, python-format msgid "" "Breaks existing package '%(pkgname)s' conflict: %(targetpkg)s (%(comptype)s " "%(targetver)s)" msgstr "" -#: ../apt/debfile.py:435 +#: ../apt/debfile.py:437 #, python-format msgid "" "Breaks existing package '%(pkgname)s' that conflict: '%(targetpkg)s'. But " "the '%(debfile)s' provides it via: '%(provides)s'" msgstr "" -#: ../apt/debfile.py:486 +#: ../apt/debfile.py:488 msgid "No Architecture field in the package" msgstr "" -#: ../apt/debfile.py:496 +#: ../apt/debfile.py:498 #, python-format msgid "Wrong architecture '%s'" msgstr "" -#: ../apt/debfile.py:504 +#: ../apt/debfile.py:506 msgid "A later version is already installed" msgstr "" -#: ../apt/debfile.py:529 +#: ../apt/debfile.py:531 msgid "Failed to satisfy all dependencies (broken cache)" msgstr "" -#: ../apt/debfile.py:558 +#: ../apt/debfile.py:560 #, python-format msgid "Cannot install '%s'" msgstr "" -#: ../apt/debfile.py:634 +#: ../apt/debfile.py:636 msgid "" "Automatically decompressed:\n" "\n" msgstr "" -#: ../apt/debfile.py:640 +#: ../apt/debfile.py:642 msgid "Automatically converted to printable ascii:\n" msgstr "" -#: ../apt/debfile.py:731 +#: ../apt/debfile.py:745 #, python-format msgid "Install Build-Dependencies for source package '%s' that builds %s\n" msgstr "" -#: ../apt/debfile.py:742 +#: ../apt/debfile.py:756 msgid "An essential package would be removed" msgstr "" -#: ../apt/progress/text.py:82 +#: ../apt/progress/text.py:89 #, python-format msgid "%c%s... Done" msgstr "" -#: ../apt/progress/text.py:122 +#: ../apt/progress/text.py:129 msgid "Hit " msgstr "" -#: ../apt/progress/text.py:131 +#: ../apt/progress/text.py:138 msgid "Ign " msgstr "" -#: ../apt/progress/text.py:133 +#: ../apt/progress/text.py:140 msgid "Err " msgstr "" -#: ../apt/progress/text.py:144 +#: ../apt/progress/text.py:151 msgid "Get:" msgstr "" -#: ../apt/progress/text.py:204 +#: ../apt/progress/text.py:211 msgid " [Working]" msgstr "" -#: ../apt/progress/text.py:215 +#: ../apt/progress/text.py:222 #, python-format msgid "" "Media change: please insert the disc labeled\n" @@ -645,19 +655,19 @@ msgid "" msgstr "" #. Trick for getting a translation from apt -#: ../apt/progress/text.py:224 +#: ../apt/progress/text.py:231 #, python-format msgid "Fetched %sB in %s (%sB/s)\n" msgstr "" -#: ../apt/progress/text.py:240 +#: ../apt/progress/text.py:247 msgid "Please provide a name for this Disc, such as 'Debian 2.1r1 Disk 1'" msgstr "" -#: ../apt/progress/text.py:256 +#: ../apt/progress/text.py:263 msgid "Please insert a Disc in the drive and press enter" msgstr "" -#: ../apt/cache.py:164 +#: ../apt/cache.py:163 msgid "Building data structures" msgstr "" -- cgit v1.2.3 From 43f539bd0cd3d8fc00c865d1b7e818e0b77119be Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Thu, 4 Sep 2014 18:08:55 +0200 Subject: releasing package python-apt version 0.9.3.10 --- debian/changelog | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/debian/changelog b/debian/changelog index e0ae1a65..95852649 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,16 @@ +python-apt (0.9.3.10) unstable; urgency=medium + + * python/tag.cc: ensure that the final \n is there when + duplicating section data + * apt/debfile.py: + - Stop reading after the "Format" stanza in a .dsc file + - Add support for apt.debfile.DscSrcPackage.filelist + - Read all tags from a dsc file and improve tests + * fix tests when gnupg is < 1.4.18 + * update python-apt.pot + + -- Michael Vogt Thu, 04 Sep 2014 18:07:41 +0200 + python-apt (0.9.3.9) unstable; urgency=medium [ Michael Vogt ] -- cgit v1.2.3 From 515204913c9168e8db77c96fdd7c29feba5bb6f4 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Tue, 30 Sep 2014 15:32:08 +0200 Subject: Embed changelog entry date and time instead of build date and time This makes reproducible builds possible. For non-package builds, simply use the start of the Unix time. Also make sure that all time values are in the UTC timezone. Closes: #762674 --- debian/rules | 8 +++++++- python/apt_pkgmodule.cc | 9 +++++++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/debian/rules b/debian/rules index 3ceeb205..20a3fa25 100755 --- a/debian/rules +++ b/debian/rules @@ -1,7 +1,13 @@ #!/usr/bin/make -f # Should be include-links, but that somehow fails. export DEBVER=$(shell dpkg-parsechangelog | sed -n -e 's/^Version: //p') -export DEB_CFLAGS_MAINT_APPEND=-Wno-write-strings +export DATETIME:=$(shell dpkg-parsechangelog | sed -n -e 's/^Date: //p') +export DATE_CMD:=env TZ=UTC LC_ALL=C.UTF-8 date +export DATE:=$(shell $(DATE_CMD) --date="$(DATETIME)" "+%b %_d %Y") +export TIME:=$(shell $(DATE_CMD) --date="$(DATETIME)" "+%H:%M:%S") +export DEB_CFLAGS_MAINT_APPEND=-Wno-write-strings \ + -DDATE=\""$(DATE)"\" \ + -DTIME=\""$(TIME)"\" export PATH := $(CURDIR)/utils:$(PATH) export pyversions := $(CURDIR)/utils/pyversions diff --git a/python/apt_pkgmodule.cc b/python/apt_pkgmodule.cc index 5f211b3e..ca20ef18 100644 --- a/python/apt_pkgmodule.cc +++ b/python/apt_pkgmodule.cc @@ -880,8 +880,13 @@ extern "C" void initapt_pkg() // 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 DATE + PyModule_AddStringConstant(Module,"DATE",DATE); + PyModule_AddStringConstant(Module,"TIME",TIME); +#else + PyModule_AddStringConstant(Module,"DATE", "Jan 1 1970"); + PyModule_AddStringConstant(Module,"TIME", "00:00:00"); +#endif // My constants PyModule_AddIntConstant(Module,"PRI_IMPORTANT",pkgCache::State::Important); -- cgit v1.2.3 From dcf7f92994bf3b7bf08ecf1ac9c19c985a1d0f45 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Tue, 14 Oct 2014 21:20:06 +0200 Subject: python/tarfile.cc: use long long in Process() for APT >= 4.14 The pkgDirStream::Process() signature has changed in apt and is using a long long now for Size and Pos. --- po/python-apt.pot | 2 +- python/tarfile.cc | 11 ++++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/po/python-apt.pot b/po/python-apt.pot index 969590aa..7ff9675e 100644 --- a/po/python-apt.pot +++ b/po/python-apt.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2014-09-03 10:25+0200\n" +"POT-Creation-Date: 2014-10-14 21:31+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" diff --git a/python/tarfile.cc b/python/tarfile.cc index 7f65a5c7..adc8e819 100644 --- a/python/tarfile.cc +++ b/python/tarfile.cc @@ -52,9 +52,13 @@ public: virtual bool DoItem(Item &Itm,int &Fd); virtual bool FinishedFile(Item &Itm,int Fd); +#if (APT_PKG_MAJOR >= 4 && APT_PKG_MINOR >= 14) + virtual bool Process(Item &Itm,const unsigned char *Data, + unsigned long long Size,unsigned long long Pos); +#else virtual bool Process(Item &Itm,const unsigned char *Data, unsigned long Size,unsigned long Pos); - +#endif PyDirStream(PyObject *callback, const char *member=0) : callback(callback), py_data(0), member(member), error(false), copy(0), copy_size(0) { @@ -84,8 +88,13 @@ bool PyDirStream::DoItem(Item &Itm, int &Fd) return true; } +#if (APT_PKG_MAJOR >= 4 && APT_PKG_MINOR >= 14) +bool PyDirStream::Process(Item &Itm,const unsigned char *Data, + unsigned long long Size,unsigned long long Pos) +#else bool PyDirStream::Process(Item &Itm,const unsigned char *Data, unsigned long Size,unsigned long Pos) +#endif { memcpy(copy + Pos, Data,Size); return true; -- cgit v1.2.3 From d53b66524df74f7637fb34f0db4c66535ba64cd0 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Fri, 24 Oct 2014 10:10:05 -0400 Subject: Merged UbuntuRTMDistribution detection from ubuntu * Add template for the "Ubuntu-RTM" derived distribution. * Detect whether a system is running Ubuntu-RTM by way of "system-image-cli -i". Not perfect but close enough. --- aptsources/distro.py | 34 ++++++++++++++++++++++++++++++++++ debian/changelog | 9 +++++++++ 2 files changed, 43 insertions(+) diff --git a/aptsources/distro.py b/aptsources/distro.py index f75aa06b..e11f113c 100644 --- a/aptsources/distro.py +++ b/aptsources/distro.py @@ -457,6 +457,13 @@ class UbuntuDistribution(Distribution): self, mirror_template="http://%s.archive.ubuntu.com/ubuntu/") +class UbuntuRTMDistribution(UbuntuDistribution): + ''' Class to support specific Ubuntu RTM features ''' + + def get_mirrors(self): + self.main_server = self.source_template.base_uri + + def _lsb_release(): """Call lsb_release --idrc and return a mapping.""" from subprocess import Popen, PIPE @@ -475,6 +482,24 @@ def _lsb_release(): return result +def _system_image_channel(): + """Get the current channel from system-image-cli -i if possible.""" + from subprocess import Popen, PIPE + import errno + try: + out = Popen( + ['system-image-cli', '-i'], stdout=PIPE, + universal_newlines=True).communicate()[0] + for l in out.splitlines(): + if l.startswith('channel: '): + return l.split(': ', 1)[1] + except OSError as exc: + if exc.errno != errno.ENOENT: + logging.warning( + 'system-image-cli failed, using defaults: %s' % exc) + return None + + def get_distro(id=None, codename=None, description=None, release=None): """ Check the currently used distribution and return the corresponding @@ -490,8 +515,17 @@ def get_distro(id=None, codename=None, description=None, release=None): codename = result['Codename'] description = result['Description'] release = result['Release'] + if id == "Ubuntu": + channel = _system_image_channel() + if channel is not None and "ubuntu-rtm/" in channel: + id = "Ubuntu-RTM" + codename = channel.rsplit("/", 1)[1].split("-", 1)[0] + description = codename + release = codename if id == "Ubuntu": return UbuntuDistribution(id, codename, description, release) + if id == "Ubuntu-RTM": + return UbuntuRTMDistribution(id, codename, description, release) elif id == "Debian": return DebianDistribution(id, codename, description, release) else: diff --git a/debian/changelog b/debian/changelog index 95852649..672ab6e0 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,12 @@ +python-apt (0.9.3.11) UNRELEASED; urgency=low + + [ Colin Watson ] + * Add template for the "Ubuntu-RTM" derived distribution. + * Detect whether a system is running Ubuntu-RTM by way of + "system-image-cli -i". Not perfect but close enough. + + -- Michael Vogt Wed, 24 Sep 2014 11:36:00 +0200 + python-apt (0.9.3.10) unstable; urgency=medium * python/tag.cc: ensure that the final \n is there when -- cgit v1.2.3 From 3610c1ad57aa3d57b1d02fa0e42171c6ee3081a4 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Fri, 24 Oct 2014 10:15:02 -0400 Subject: Add Ubuntu 15.04 (Vivid Vervet) to the template --- data/templates/Ubuntu.info.in | 119 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 119 insertions(+) diff --git a/data/templates/Ubuntu.info.in b/data/templates/Ubuntu.info.in index 0d26c805..addb0647 100644 --- a/data/templates/Ubuntu.info.in +++ b/data/templates/Ubuntu.info.in @@ -107,6 +107,125 @@ MatchURI: archive.ubuntu.com/ubuntu|ports.ubuntu.com/ubuntu-ports _Description: Unsupported updates +Suite: vivid +RepositoryType: deb +BaseURI: http://ports.ubuntu.com/ubuntu-ports/ +MatchURI: ports.ubuntu.com/ubuntu-ports +BaseURI-amd64: http://archive.ubuntu.com/ubuntu +MatchURI-amd64: archive.ubuntu.com/ubuntu +BaseURI-i386: http://archive.ubuntu.com/ubuntu +MatchURI-i386: archive.ubuntu.com/ubuntu +MirrorsFile-amd64: Ubuntu.mirrors +MirrorsFile-i386: Ubuntu.mirrors +_Description: Ubuntu 15.04 'Vivid Vervet' +Component: main +_CompDescription: Officially supported +_CompDescriptionLong: Canonical-supported free and open-source software +Component: universe +_CompDescription: Community-maintained +_CompDescriptionLong: Community-maintained free and open-source software +Component: restricted +_CompDescription: Non-free drivers +_CompDescriptionLong: Proprietary drivers for devices +Component: multiverse +ParentComponent: universe +_CompDescription: Restricted software +_CompDescriptionLong: Software restricted by copyright or legal issues + +Suite: vivid +ParentSuite: vivid +RepositoryType: deb-src +BaseURI: http://archive.ubuntu.com/ubuntu/ +MatchURI: archive.ubuntu.com/ubuntu|ports.ubuntu.com/ubuntu-ports +_Description: Ubuntu 15.04 'Vivid Vervet' + +Suite: vivid +RepositoryType: deb +MatchName: .* +BaseURI: cdrom:\[Ubuntu.*15.04 +MatchURI: cdrom:\[Ubuntu.*15.04 +_Description: Cdrom with Ubuntu 15.04 'Vivid Vervet' +Available: False +Component: main +_CompDescription: Officially supported +Component: restricted +_CompDescription: Restricted copyright + +Suite: vivid +Official: false +RepositoryType: deb +BaseURI: http://archive.canonical.com +MatchURI: archive.canonical.com +_Description: Canonical Partners +Component: partner +_CompDescription: Software packaged by Canonical for their partners +_CompDescriptionLong: This software is not part of Ubuntu. + +Suite: vivid +Official: false +RepositoryType: deb +BaseURI: http://extras.ubuntu.com +MatchURI: extras.ubuntu.com +_Description: Independent +Component: main +_CompDescription: Provided by third-party software developers +_CompDescriptionLong: Software offered by third party developers. + +Suite: vivid-security +ParentSuite: vivid +RepositoryType: deb +BaseURI: http://ports.ubuntu.com/ubuntu-ports/ +MatchURI: ports.ubuntu.com/ubuntu-ports +BaseURI-amd64: http://security.ubuntu.com/ubuntu/ +MatchURI-amd64: archive.ubuntu.com/ubuntu|security.ubuntu.com +BaseURI-i386: http://security.ubuntu.com/ubuntu/ +MatchURI-i386: archive.ubuntu.com/ubuntu|security.ubuntu.com +_Description: Important security updates + +Suite: vivid-security +ParentSuite: vivid +RepositoryType: deb-src +BaseURI: http://archive.ubuntu.com/ubuntu/ +MatchURI: archive.ubuntu.com/ubuntu|ports.ubuntu.com/ubuntu-ports|security.ubuntu.com +_Description: Important security updates + +Suite: vivid-updates +ParentSuite: vivid +RepositoryType: deb +_Description: Recommended updates + +Suite: vivid-updates +ParentSuite: vivid +RepositoryType: deb-src +BaseURI: http://archive.ubuntu.com/ubuntu/ +MatchURI: archive.ubuntu.com/ubuntu|ports.ubuntu.com/ubuntu-ports +_Description: Recommended updates + +Suite: vivid-proposed +ParentSuite: vivid +RepositoryType: deb +_Description: Pre-released updates + +Suite: vivid-proposed +ParentSuite: vivid +RepositoryType: deb-src +BaseURI: http://archive.ubuntu.com/ubuntu/ +MatchURI: archive.ubuntu.com/ubuntu|ports.ubuntu.com/ubuntu-ports +_Description: Pre-released updates + +Suite: vivid-backports +ParentSuite: vivid +RepositoryType: deb +_Description: Unsupported updates + +Suite: vivid-backports +ParentSuite: vivid +RepositoryType: deb-src +BaseURI: http://archive.ubuntu.com/ubuntu/ +MatchURI: archive.ubuntu.com/ubuntu|ports.ubuntu.com/ubuntu-ports +_Description: Unsupported updates + + Suite: utopic RepositoryType: deb BaseURI: http://ports.ubuntu.com/ubuntu-ports/ -- cgit v1.2.3 From f619b8891b5ee052cc15913729ef081cf0e2f913 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Fri, 24 Oct 2014 10:16:15 -0400 Subject: releasing package python-apt version 0.9.3.11 --- debian/changelog | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/debian/changelog b/debian/changelog index 672ab6e0..f7228a50 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,11 +1,20 @@ -python-apt (0.9.3.11) UNRELEASED; urgency=low +python-apt (0.9.3.11) unstable; urgency=low [ Colin Watson ] * Add template for the "Ubuntu-RTM" derived distribution. * Detect whether a system is running Ubuntu-RTM by way of "system-image-cli -i". Not perfect but close enough. - -- Michael Vogt Wed, 24 Sep 2014 11:36:00 +0200 + [ Julian Andres Klode ] + * Embed changelog entry date and time instead of build date and time + (Closes: #762674) + + [ Michael Vogt ] + * python/tarfile.cc: use long long in Process() for APT >= 4.14 + * Merged UbuntuRTMDistribution detection from ubuntu + * Add Ubuntu 15.04 (Vivid Vervet) to the template + + -- Michael Vogt Fri, 24 Oct 2014 10:16:01 -0400 python-apt (0.9.3.10) unstable; urgency=medium -- cgit v1.2.3 From b066cf677e2cbd480bd2e74b48147bfd226ae463 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Thu, 6 Nov 2014 21:21:44 +0100 Subject: add apt_pkg.sha512sum() --- python/apt_pkgmodule.cc | 50 +++++++++++++++++++++++++++++++++++++++++++++++-- tests/test_hashsums.py | 25 +++++++++++++++++++++++++ 2 files changed, 73 insertions(+), 2 deletions(-) diff --git a/python/apt_pkgmodule.cc b/python/apt_pkgmodule.cc index ca20ef18..e00ce0ca 100644 --- a/python/apt_pkgmodule.cc +++ b/python/apt_pkgmodule.cc @@ -311,7 +311,7 @@ static PyObject *sha1sum(PyObject *Self,PyObject *Args) return 0; } /*}}}*/ -// sha256sum - Compute the sha1sum of a file or string /*{{{*/ +// sha256sum - Compute the sha256sum of a file or string /*{{{*/ // --------------------------------------------------------------------- static const char *doc_sha256sum = "sha256sum(object) -> str\n\n" @@ -352,6 +352,51 @@ static PyObject *sha256sum(PyObject *Self,PyObject *Args) return CppPyString(Sum.Result().Value()); } + PyErr_SetString(PyExc_TypeError,"Only understand strings and files"); + return 0; +} + /*}}}*/ +// sha512sum - Compute the sha512sum of a file or string /*{{{*/ +// --------------------------------------------------------------------- +static const char *doc_sha512sum = + "sha512sum(object) -> str\n\n" + "Return the sha512sum of the object. 'object' may either be a string, in\n" + "which case the sha512sum of the string is returned, or a file() object\n" + "(or file descriptor), in which case the sha512sum of its contents is\n" + "returned.";; +static PyObject *sha512sum(PyObject *Self,PyObject *Args) +{ + PyObject *Obj; + if (PyArg_ParseTuple(Args,"O",&Obj) == 0) + return 0; + + // Digest of a string. + if (PyBytes_Check(Obj) != 0) + { + char *s; + Py_ssize_t len; + SHA512Summation Sum; + PyBytes_AsStringAndSize(Obj, &s, &len); + Sum.Add((const unsigned char*)s, len); + return CppPyString(Sum.Result().Value()); + } + + // Digest of a file + int Fd = PyObject_AsFileDescriptor(Obj); + if (Fd != -1) + { + SHA512Summation Sum; + struct stat St; + if (fstat(Fd,&St) != 0 || + Sum.AddFD(Fd,St.st_size) == false) + { + PyErr_SetFromErrno(PyExc_SystemError); + return 0; + } + + return CppPyString(Sum.Result().Value()); + } + PyErr_SetString(PyExc_TypeError,"Only understand strings and files"); return 0; } @@ -521,10 +566,11 @@ static PyMethodDef methods[] = {"parse_depends",ParseDepends,METH_VARARGS,doc_ParseDepends}, {"parse_src_depends",ParseSrcDepends,METH_VARARGS,parse_src_depends_doc}, - // Stuff + // Hashes {"md5sum",md5sum,METH_VARARGS,doc_md5sum}, {"sha1sum",sha1sum,METH_VARARGS,doc_sha1sum}, {"sha256sum",sha256sum,METH_VARARGS,doc_sha256sum}, + {"sha512sum",sha512sum,METH_VARARGS,doc_sha512sum}, // multiarch {"get_architectures", GetArchitectures, METH_VARARGS, doc_GetArchitectures}, diff --git a/tests/test_hashsums.py b/tests/test_hashsums.py index 1819e343..bd2dba91 100644 --- a/tests/test_hashsums.py +++ b/tests/test_hashsums.py @@ -66,5 +66,30 @@ class testHashes(unittest.TestCase): with open(self.DATA_WITH_ZERO_PATH) as fobj: self.assertEqual(apt_pkg.sha256sum(fobj), s_hash) + def testSHA512(self): + # simple + s = b"foo" + s_hash = \ + "f7fbba6e0636f890e56fbbf3283e524c6fa3204ae298382d624741d" \ + "0dc6638326e282c41be5e4254d8820772c5518a2c5a8c0c7f7eda19" \ + "594a7eb539453e1ed7" + res = apt_pkg.sha512sum(s) + self.assertEqual(res, s_hash) + # file + with open(self.DATA_PATH) as fobj: + self.assertEqual(apt_pkg.sha512sum(fobj), s_hash) + # with zero (\0) in the string + s = b"foo\0bar" + s_hash = \ + "8c5e791db8f6bfb40eba884f70c9ac52231f01a393e4e55b4576d45" \ + "9a827f34f77e41e7fac806724517b9e96bb42387c5f9bbf325d2f99" \ + "ed52a4aa6abebc3350" + res = apt_pkg.sha512sum(s) + self.assertEqual(res, s_hash) + # file + with open(self.DATA_WITH_ZERO_PATH) as fobj: + self.assertEqual(apt_pkg.sha512sum(fobj), s_hash) + + if __name__ == "__main__": unittest.main() -- cgit v1.2.3 From d92026e96db4a4d03cec9f135b5407804892c55f Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Thu, 6 Nov 2014 21:59:18 +0100 Subject: Add binding for apt_pkg.maybe_open_clear_signed_file() --- python/apt_pkgmodule.cc | 23 +++++++++++++++++++++++ tests/test_tagfile.py | 23 +++++++++++++++++++++++ 2 files changed, 46 insertions(+) diff --git a/python/apt_pkgmodule.cc b/python/apt_pkgmodule.cc index e00ce0ca..0d84f468 100644 --- a/python/apt_pkgmodule.cc +++ b/python/apt_pkgmodule.cc @@ -27,6 +27,7 @@ #include #include #include +#include #include #include @@ -472,6 +473,25 @@ static PyObject *InitSystem(PyObject *Self,PyObject *Args) return HandleErrors(Py_None); } /*}}}*/ +// gpgv.cc:OpenMaybeClearSignedFile /*{{{*/ +// --------------------------------------------------------------------- +static char *doc_OpenMaybeClearSignedFile = +"open_maybe_clear_signed_file(file: str) -> int\n\n" +"Open a file and ignore a PGP clear signature.\n" +"Return a open file descriptor or a error."; +static PyObject *PyOpenMaybeClearSignedFile(PyObject *Self,PyObject *Args) +{ + PyApt_Filename file; + char errors = false; + if (PyArg_ParseTuple(Args,"O&",PyApt_Filename::Converter, &file,&errors) == 0) + return 0; + + FileFd Fd; + if (OpenMaybeClearSignedFile(file, Fd) == false) + return HandleErrors(MkPyNumber(-1)); + + return HandleErrors(MkPyNumber(dup(Fd.Fd()))); +} // fileutils.cc: GetLock /*{{{*/ // --------------------------------------------------------------------- @@ -546,6 +566,9 @@ static PyMethodDef methods[] = // Tag File {"rewrite_section",RewriteSection,METH_VARARGS,doc_RewriteSection}, + {"open_maybe_clear_signed_file",PyOpenMaybeClearSignedFile,METH_VARARGS, + doc_OpenMaybeClearSignedFile}, + // Locking {"get_lock",GetLock,METH_VARARGS,doc_GetLock}, {"pkgsystem_lock",PkgSystemLock,METH_VARARGS,doc_PkgSystemLock}, diff --git a/tests/test_tagfile.py b/tests/test_tagfile.py index 6ff6a32a..986ddfbc 100644 --- a/tests/test_tagfile.py +++ b/tests/test_tagfile.py @@ -28,6 +28,29 @@ if libdir: import apt_pkg +class TestOpenMaybeClearSigned(unittest.TestCase): + + def test_open_trivial(self): + basepath = os.path.dirname(__file__) + fd = apt_pkg.open_maybe_clear_signed_file( + os.path.join(basepath, "./data/test_debs/hello_2.5-1.dsc")) + f = os.fdopen(fd) + data = f.read().encode("utf-8") + self.assertTrue(data.startswith("Format: 1.0\n")) + + def test_open_normal(self): + basepath = os.path.dirname(__file__) + fd = apt_pkg.open_maybe_clear_signed_file( + os.path.join(basepath, "./data/misc/foo_Release")) + f = os.fdopen(fd) + data = f.read().encode("utf-8") + self.assertTrue(data.startswith("Origin: Ubuntu\n")) + + def xtest_open_does_not_exit(self): + with self.assertRaises(SystemError): + apt_pkg.open_maybe_clear_signed_file("does-not-exists") + + class TestTagFile(unittest.TestCase): """ test the apt_pkg.TagFile """ -- cgit v1.2.3 From 570564c21558620f474666ab3dc18e10c0818c40 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Thu, 6 Nov 2014 22:05:59 +0100 Subject: apt/debfile.py: use apt_pkg.open_maybe_clear_signed_file() when opening a .dsc file --- apt/debfile.py | 3 ++- tests/test_tagfile.py | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/apt/debfile.py b/apt/debfile.py index 1f93b7bb..20cf563c 100644 --- a/apt/debfile.py +++ b/apt/debfile.py @@ -714,7 +714,8 @@ class DscSrcPackage(DebPackage): """Open the package.""" depends_tags = ["Build-Depends", "Build-Depends-Indep"] conflicts_tags = ["Build-Conflicts", "Build-Conflicts-Indep"] - fobj = open(file) + fd = apt_pkg.open_maybe_clear_signed_file(file) + fobj = os.fdopen(fd) tagfile = apt_pkg.TagFile(fobj) try: for sec in tagfile: diff --git a/tests/test_tagfile.py b/tests/test_tagfile.py index 986ddfbc..1ac20624 100644 --- a/tests/test_tagfile.py +++ b/tests/test_tagfile.py @@ -35,7 +35,7 @@ class TestOpenMaybeClearSigned(unittest.TestCase): fd = apt_pkg.open_maybe_clear_signed_file( os.path.join(basepath, "./data/test_debs/hello_2.5-1.dsc")) f = os.fdopen(fd) - data = f.read().encode("utf-8") + data = f.read() self.assertTrue(data.startswith("Format: 1.0\n")) def test_open_normal(self): @@ -43,7 +43,7 @@ class TestOpenMaybeClearSigned(unittest.TestCase): fd = apt_pkg.open_maybe_clear_signed_file( os.path.join(basepath, "./data/misc/foo_Release")) f = os.fdopen(fd) - data = f.read().encode("utf-8") + data = f.read() self.assertTrue(data.startswith("Origin: Ubuntu\n")) def xtest_open_does_not_exit(self): -- cgit v1.2.3 From 4a692f21968a2817f9a5d7962a2a0d03f3b119e0 Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Thu, 7 May 2015 16:43:37 +0200 Subject: add Wily template --- data/templates/Ubuntu.info.in | 109 ++++++++++++++++++++++++++++++++++++++++++ debian/changelog | 8 ++++ 2 files changed, 117 insertions(+) diff --git a/data/templates/Ubuntu.info.in b/data/templates/Ubuntu.info.in index addb0647..41ae5c82 100644 --- a/data/templates/Ubuntu.info.in +++ b/data/templates/Ubuntu.info.in @@ -107,6 +107,115 @@ MatchURI: archive.ubuntu.com/ubuntu|ports.ubuntu.com/ubuntu-ports _Description: Unsupported updates +Suite: wily +RepositoryType: deb +BaseURI: http://ports.ubuntu.com/ubuntu-ports/ +MatchURI: ports.ubuntu.com/ubuntu-ports +BaseURI-amd64: http://archive.ubuntu.com/ubuntu +MatchURI-amd64: archive.ubuntu.com/ubuntu +BaseURI-i386: http://archive.ubuntu.com/ubuntu +MatchURI-i386: archive.ubuntu.com/ubuntu +MirrorsFile-amd64: Ubuntu.mirrors +MirrorsFile-i386: Ubuntu.mirrors +_Description: Ubuntu 15.10 'Wily Werewolf' +Component: main +_CompDescription: Officially supported +_CompDescriptionLong: Canonical-supported free and open-source software +Component: universe +_CompDescription: Community-maintained +_CompDescriptionLong: Community-maintained free and open-source software +Component: restricted +_CompDescription: Non-free drivers +_CompDescriptionLong: Proprietary drivers for devices +Component: multiverse +ParentComponent: universe +_CompDescription: Restricted software +_CompDescriptionLong: Software restricted by copyright or legal issues + +Suite: wily +ParentSuite: wily +RepositoryType: deb-src +BaseURI: http://archive.ubuntu.com/ubuntu/ +MatchURI: archive.ubuntu.com/ubuntu|ports.ubuntu.com/ubuntu-ports +_Description: Ubuntu 15.10 'Wily Werewolf' + +Suite: wily +RepositoryType: deb +MatchName: .* +BaseURI: cdrom:\[Ubuntu.*15.10 +MatchURI: cdrom:\[Ubuntu.*15.10 +_Description: Cdrom with Ubuntu 15.10 'Wily Werewolf' +Available: False +Component: main +_CompDescription: Officially supported +Component: restricted +_CompDescription: Restricted copyright + +Suite: wily +Official: false +RepositoryType: deb +BaseURI: http://archive.canonical.com +MatchURI: archive.canonical.com +_Description: Canonical Partners +Component: partner +_CompDescription: Software packaged by Canonical for their partners +_CompDescriptionLong: This software is not part of Ubuntu. + +Suite: wily-security +ParentSuite: wily +RepositoryType: deb +BaseURI: http://ports.ubuntu.com/ubuntu-ports/ +MatchURI: ports.ubuntu.com/ubuntu-ports +BaseURI-amd64: http://security.ubuntu.com/ubuntu/ +MatchURI-amd64: archive.ubuntu.com/ubuntu|security.ubuntu.com +BaseURI-i386: http://security.ubuntu.com/ubuntu/ +MatchURI-i386: archive.ubuntu.com/ubuntu|security.ubuntu.com +_Description: Important security updates + +Suite: wily-security +ParentSuite: wily +RepositoryType: deb-src +BaseURI: http://archive.ubuntu.com/ubuntu/ +MatchURI: archive.ubuntu.com/ubuntu|ports.ubuntu.com/ubuntu-ports|security.ubuntu.com +_Description: Important security updates + +Suite: wily-updates +ParentSuite: wily +RepositoryType: deb +_Description: Recommended updates + +Suite: wily-updates +ParentSuite: wily +RepositoryType: deb-src +BaseURI: http://archive.ubuntu.com/ubuntu/ +MatchURI: archive.ubuntu.com/ubuntu|ports.ubuntu.com/ubuntu-ports +_Description: Recommended updates + +Suite: wily-proposed +ParentSuite: wily +RepositoryType: deb +_Description: Pre-released updates + +Suite: wily-proposed +ParentSuite: wily +RepositoryType: deb-src +BaseURI: http://archive.ubuntu.com/ubuntu/ +MatchURI: archive.ubuntu.com/ubuntu|ports.ubuntu.com/ubuntu-ports +_Description: Pre-released updates + +Suite: wily-backports +ParentSuite: wily +RepositoryType: deb +_Description: Unsupported updates + +Suite: wily-backports +ParentSuite: wily +RepositoryType: deb-src +BaseURI: http://archive.ubuntu.com/ubuntu/ +MatchURI: archive.ubuntu.com/ubuntu|ports.ubuntu.com/ubuntu-ports +_Description: Unsupported updates + + Suite: vivid RepositoryType: deb BaseURI: http://ports.ubuntu.com/ubuntu-ports/ diff --git a/debian/changelog b/debian/changelog index f7228a50..f431871d 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,11 @@ +python-apt (0.9.3.12) UNRELEASED; urgency=medium + + [ Martin Pitt ] + * ./data/templates/Ubuntu.info.in: Add Wily template. Don't copy extras.u.c. + stanza as that's gone since 15.04. + + -- Michael Vogt Thu, 07 May 2015 16:42:53 +0200 + python-apt (0.9.3.11) unstable; urgency=low [ Colin Watson ] -- cgit v1.2.3 From 778954e0e051aaf1c263a2418156a6f82213386a Mon Sep 17 00:00:00 2001 From: von Date: Sat, 28 Feb 2015 17:00:04 +0100 Subject: Update the print_uris.py example to use the new API Closes: #779217 --- doc/examples/print_uris.py | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/doc/examples/print_uris.py b/doc/examples/print_uris.py index 06043e4a..27e49d1f 100755 --- a/doc/examples/print_uris.py +++ b/doc/examples/print_uris.py @@ -4,19 +4,7 @@ # import apt -import apt_pkg - -cache = apt.Cache() -upgradable = filter(lambda p: p.is_upgradable, cache) - - -for pkg in upgradable: - pkg._lookupRecord(True) - path = apt_pkg.TagSection(pkg._records.record)["Filename"] - cand = pkg._depcache.get_candidate_ver(pkg._pkg) - for (packagefile, i) in cand.file_list: - indexfile = cache._list.find_index(packagefile) - if indexfile: - uri = indexfile.archive_uri(path) - print uri +for pkg in apt.Cache(): + if pkg.is_upgradable: + print pkg.candidate.uri -- cgit v1.2.3 From e03ec63ce07e597c6f29edc5121a24f874cf6aaa Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Thu, 7 May 2015 17:20:13 +0200 Subject: Update doc/example/action.py for py3 and latest API closes: #782335 --- doc/examples/action.py | 118 ++++++++++++++++++++++++----------------------- doc/examples/progress.py | 30 ++++++------ 2 files changed, 75 insertions(+), 73 deletions(-) diff --git a/doc/examples/action.py b/doc/examples/action.py index 41b55144..b395adc6 100644 --- a/doc/examples/action.py +++ b/doc/examples/action.py @@ -1,8 +1,12 @@ #!/usr/bin/python -# example how to deal with the depcache +# +# LOW LEVEL example how to deal with the depcache +# +# you probably do not want to use this low level code and use +# the high level "apt" interface instead that can do all this +# but with a nicer API import apt_pkg -import sys from apt.progress.text import OpProgress from progress import TextFetchProgress @@ -11,100 +15,98 @@ apt_pkg.init() progress = OpProgress() cache = apt_pkg.Cache(progress) -print "Available packages: %s " % cache.package_count +print("Available packages: %s " % cache.package_count) -print "Fetching" +print("Fetching") progress = TextFetchProgress() -cache.update(progress) - -print "Exiting" -sys.exit(0) +source = apt_pkg.SourceList() +cache.update(progress, source) iter = cache["base-config"] -print "example package iter: %s" % iter +print("example package iter: %s" % iter) # get depcache -print "\n\n depcache" -depcache = apt_pkg.DepCache(cache, progress) -depcache.read_pin_file() -print "got a depcache: %s " % depcache -print "Marked for install: %s " % depcache.inst_count +print("\n\n depcache") +depcache = apt_pkg.DepCache(cache) +depcache.read_pinfile() +print("got a depcache: %s " % depcache) +print("Marked for install: %s " % depcache.inst_count) -print "\n\n Reinit" +print("\n\n Reinit") depcache.init(progress) #sys.exit() # get a canidate version ver = depcache.get_candidate_ver(iter) -print "Candidate version: %s " % ver +print("Candidate version: %s " % ver) -print "\n\nQuerry interface" -print "%s.is_upgradable(): %s" % (iter.name, depcache.is_upgradable(iter)) +print("\n\nQuerry interface") +print("%s.is_upgradable(): %s" % (iter.name, depcache.is_upgradable(iter))) -print "\nMarking interface" -print "Marking '%s' for install" % iter.name +print("\nMarking interface") +print("Marking '%s' for install" % iter.name) depcache.mark_install(iter) -print "Install count: %s " % depcache.inst_count -print "%s.marked_install(): %s" % (iter.name, depcache.marked_install(iter)) -print "%s.marked_upgrade(): %s" % (iter.name, depcache.marked_upgrade(iter)) -print "%s.marked_delete(): %s" % (iter.name, depcache.marked_delete(iter)) +print("Install count: %s " % depcache.inst_count) +print("%s.marked_install(): %s" % (iter.name, depcache.marked_install(iter))) +print("%s.marked_upgrade(): %s" % (iter.name, depcache.marked_upgrade(iter))) +print("%s.marked_delete(): %s" % (iter.name, depcache.marked_delete(iter))) -print "Marking %s for delete" % iter.name +print("Marking %s for delete" % iter.name) depcache.mark_delete(iter) -print "del_count: %s " % depcache.del_count -print "%s.marked_delete(): %s" % (iter.name, depcache.marked_delete(iter)) +print("del_count: %s " % depcache.del_count) +print("%s.marked_delete(): %s" % (iter.name, depcache.marked_delete(iter))) -iter = cache["3dchess"] -print "\nMarking '%s' for install" % iter.name +iter = cache["apt"] +print("\nMarking '%s' for install" % iter.name) depcache.mark_install(iter) -print "Install count: %s " % depcache.inst_count -print "%s.marked_install(): %s" % (iter.name, depcache.marked_install(iter)) -print "%s.marked_upgrade(): %s" % (iter.name, depcache.marked_upgrade(iter)) -print "%s.marked_delete(): %s" % (iter.name, depcache.marked_delete(iter)) +print("Install count: %s " % depcache.inst_count) +print("%s.marked_install(): %s" % (iter.name, depcache.marked_install(iter))) +print("%s.marked_upgrade(): %s" % (iter.name, depcache.marked_upgrade(iter))) +print("%s.marked_delete(): %s" % (iter.name, depcache.marked_delete(iter))) -print "Marking %s for keep" % iter.name +print("Marking %s for keep" % iter.name) depcache.mark_keep(iter) -print "Install: %s " % depcache.inst_count +print("Install: %s " % depcache.inst_count) -iter = cache["3dwm-server"] -print "\nMarking '%s' for install" % iter.name +iter = cache["python-apt"] +print("\nMarking '%s' for install" % iter.name) depcache.mark_install(iter) -print "Install: %s " % depcache.inst_count -print "Broken count: %s" % depcache.broken_count -print "fix_broken() " +print("Install: %s " % depcache.inst_count) +print("Broken count: %s" % depcache.broken_count) +print("fix_broken() ") depcache.fix_broken() -print "Broken count: %s" % depcache.broken_count +print("Broken count: %s" % depcache.broken_count) -print "\nPerforming upgrade" +print("\nPerforming upgrade") depcache.upgrade() -print "Keep: %s " % depcache.keep_count -print "Install: %s " % depcache.inst_count -print "Delete: %s " % depcache.del_count -print "usr_size: %s " % apt_pkg.size_to_str(depcache.usr_size) -print "deb_size: %s " % apt_pkg.size_to_str(depcache.deb_size) +print("Keep: %s " % depcache.keep_count) +print("Install: %s " % depcache.inst_count) +print("Delete: %s " % depcache.del_count) +print("usr_size: %s " % apt_pkg.size_to_str(depcache.usr_size)) +print("deb_size: %s " % apt_pkg.size_to_str(depcache.deb_size)) for pkg in cache.packages: if pkg.current_ver is not None and not depcache.marked_install(pkg) \ and depcache.is_upgradable(pkg): - print "upgrade didn't upgrade (kept): %s" % pkg.name + print("upgrade didn't upgrade (kept): %s" % pkg.name) -print "\nPerforming Distupgrade" +print("\nPerforming Distupgrade") depcache.upgrade(True) -print "Keep: %s " % depcache.keep_count -print "Install: %s " % depcache.inst_count -print "Delete: %s " % depcache.del_count -print "usr_size: %s " % apt_pkg.size_to_str(depcache.usr_size) -print "deb_size: %s " % apt_pkg.size_to_str(depcache.deb_size) +print("Keep: %s " % depcache.keep_count) +print("Install: %s " % depcache.inst_count) +print("Delete: %s " % depcache.del_count) +print("usr_size: %s " % apt_pkg.size_to_str(depcache.usr_size)) +print("deb_size: %s " % apt_pkg.size_to_str(depcache.deb_size)) # overview about what would happen for pkg in cache.packages: if depcache.marked_install(pkg): if pkg.current_ver is not None: - print "Marked upgrade: %s " % pkg.name + print("Marked upgrade: %s " % pkg.name) else: - print "Marked install: %s" % pkg.name + print("Marked install: %s" % pkg.name) elif depcache.marked_delete(pkg): - print "Marked delete: %s" % pkg.name + print("Marked delete: %s" % pkg.name) elif depcache.marked_keep(pkg): - print "Marked keep: %s" % pkg.name + print("Marked keep: %s" % pkg.name) diff --git a/doc/examples/progress.py b/doc/examples/progress.py index 32dac330..a273eb24 100644 --- a/doc/examples/progress.py +++ b/doc/examples/progress.py @@ -22,7 +22,7 @@ class TextProgress(apt.progress.base.OpProgress): def done(self): self.last = 0.0 - print "\rDone " + print("\rDone ") class TextFetchProgress(apt.progress.base.AcquireProgress): @@ -37,25 +37,25 @@ class TextFetchProgress(apt.progress.base.AcquireProgress): pass def fail(self, item): - print 'fail', item + print('fail', item) def fetch(self, item): - print 'fetch', item + print('fetch', item) def ims_hit(self, item): - print 'ims_hit', item + print('ims_hit', item) def pulse(self, owner): - print "pulse: CPS: %s/s; Bytes: %s/%s; Item: %s/%s" % ( + print("pulse: CPS: %s/s; Bytes: %s/%s; Item: %s/%s" % ( apt_pkg.size_to_str(self.current_cps), apt_pkg.size_to_str(self.current_bytes), apt_pkg.size_to_str(self.total_bytes), self.current_items, - self.total_items) + self.total_items)) return True def media_change(self, medium, drive): - print "Please insert medium %s in drive %s" % (medium, drive) + print("Please insert medium %s in drive %s" % (medium, drive)) sys.stdin.readline() #return False @@ -67,13 +67,13 @@ class TextInstallProgress(apt.progress.base.InstallProgress): pass def start_update(self): - print "start_update" + print("start_update") def finish_update(self): - print "finish_update" + print("finish_update") def status_change(self, pkg, percent, status): - print "[%s] %s: %s" % (percent, pkg, status) + print("[%s] %s: %s" % (percent, pkg, status)) def update_interface(self): apt.progress.base.InstallProgress.update_interface(self) @@ -91,17 +91,17 @@ class TextCdromProgress(apt.progress.base.CdromProgress): def update(self, text, step): # check if we actually have some text to display if text != "": - print "Update: %s %s" % (text.strip(), step) + print("Update: %s %s" % (text.strip(), step)) def ask_cdrom_name(self): - print "Please enter cd-name: ", + sys.stdout.write("Please enter cd-name: ") cd_name = sys.stdin.readline() return (True, cd_name.strip()) def change_cdrom(self): - print "Please insert cdrom and press " + print("Please insert cdrom and press ") answer = sys.stdin.readline() - print answer + print(answer) return True @@ -115,4 +115,4 @@ if __name__ == "__main__": res = c.commit(TextFetchProgress(), TextInstallProgress()) - print res + print(res) -- cgit v1.2.3 From 196cbd31da61751edbf7a55f4fc0e900a7b51bd6 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Thu, 7 May 2015 17:28:07 +0200 Subject: Add MULTI_ARCH_NO constant and deprecate MULTI_ARCH_NONE Thanks to Johannes Schauer closes: #782802 --- doc/source/library/apt_pkg.rst | 2 +- python/apt_pkgmodule.cc | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/doc/source/library/apt_pkg.rst b/doc/source/library/apt_pkg.rst index d6ffaf4c..c5e58b38 100644 --- a/doc/source/library/apt_pkg.rst +++ b/doc/source/library/apt_pkg.rst @@ -916,7 +916,7 @@ Example: The multi-arch state of the package. Can be one of the following attributes. - .. attribute:: MULTI_ARCH_NONE + .. attribute:: MULTI_ARCH_NO No multi-arch diff --git a/python/apt_pkgmodule.cc b/python/apt_pkgmodule.cc index 0d84f468..32bc440a 100644 --- a/python/apt_pkgmodule.cc +++ b/python/apt_pkgmodule.cc @@ -910,7 +910,9 @@ extern "C" void initapt_pkg() PyDict_SetItemString(PyPackageManager_Type.tp_dict, "RESULT_INCOMPLETE", MkPyNumber(pkgPackageManager::Incomplete)); - + PyDict_SetItemString(PyVersion_Type.tp_dict, "MULTI_ARCH_NO", + MkPyNumber(pkgCache::Version::None)); + // NONE is deprecated (#782802) PyDict_SetItemString(PyVersion_Type.tp_dict, "MULTI_ARCH_NONE", MkPyNumber(pkgCache::Version::None)); PyDict_SetItemString(PyVersion_Type.tp_dict, "MULTI_ARCH_ALL", -- cgit v1.2.3 From 169ec1d077596d64c79be29359fe10d8126b2e81 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Thu, 7 May 2015 17:43:03 +0200 Subject: Fix dead links in python-apt documentation Closes: #779426 --- doc/source/contents.rst | 1 - doc/source/whatsnew/0.9.3.rst | 10 ++++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 doc/source/whatsnew/0.9.3.rst diff --git a/doc/source/contents.rst b/doc/source/contents.rst index 3c9fb511..6c4e161d 100644 --- a/doc/source/contents.rst +++ b/doc/source/contents.rst @@ -16,5 +16,4 @@ Indices and tables ================== * :ref:`genindex` -* :ref:`modindex` * :ref:`search` diff --git a/doc/source/whatsnew/0.9.3.rst b/doc/source/whatsnew/0.9.3.rst new file mode 100644 index 00000000..529b34c1 --- /dev/null +++ b/doc/source/whatsnew/0.9.3.rst @@ -0,0 +1,10 @@ +What's New In python-apt 0.9.3 +============================ +Python-apt 0.9.3 is a maintenance update. + +Maintenance +----------- + + * Support for python2.6 got dropped + * Documentation improvements + * Lots of bugfixes -- cgit v1.2.3 From e0345407d2f4ce18efde3e5a935a44668a203024 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Thu, 7 May 2015 18:11:34 +0200 Subject: Fix pep8 error --- doc/examples/print_uris.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/examples/print_uris.py b/doc/examples/print_uris.py index 27e49d1f..e5f69ff3 100755 --- a/doc/examples/print_uris.py +++ b/doc/examples/print_uris.py @@ -6,5 +6,5 @@ import apt for pkg in apt.Cache(): - if pkg.is_upgradable: - print pkg.candidate.uri + if pkg.is_upgradable: + print pkg.candidate.uri -- cgit v1.2.3 From e6cea6d7d03b696460cf324aab9841a7433856fb Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Thu, 7 May 2015 18:21:35 +0200 Subject: update whatsnew --- doc/source/whatsnew/0.9.3.rst | 10 ---------- doc/source/whatsnew/0.9.4.rst | 17 +++++++++++++++++ 2 files changed, 17 insertions(+), 10 deletions(-) delete mode 100644 doc/source/whatsnew/0.9.3.rst create mode 100644 doc/source/whatsnew/0.9.4.rst diff --git a/doc/source/whatsnew/0.9.3.rst b/doc/source/whatsnew/0.9.3.rst deleted file mode 100644 index 529b34c1..00000000 --- a/doc/source/whatsnew/0.9.3.rst +++ /dev/null @@ -1,10 +0,0 @@ -What's New In python-apt 0.9.3 -============================ -Python-apt 0.9.3 is a maintenance update. - -Maintenance ------------ - - * Support for python2.6 got dropped - * Documentation improvements - * Lots of bugfixes diff --git a/doc/source/whatsnew/0.9.4.rst b/doc/source/whatsnew/0.9.4.rst new file mode 100644 index 00000000..617ef08f --- /dev/null +++ b/doc/source/whatsnew/0.9.4.rst @@ -0,0 +1,17 @@ +What's New In python-apt 0.9.4 +============================== +Python-apt 0.9.4 is a maintenance update. + +New features +------------ + + * Support for apt_pkg.sha512sum() + * Support for apt_pkg.maybe_open_clear_signed_file() + * Use apt_pkg.open_maybe_clear_signed_file() when opening a .dsc file + * add MULTI_ARCH_NO constant (MULTI_ARCH_NONE is deprecated) + +Maintenance +----------- + + * Add Ubuntu Wily + * Update examples -- cgit v1.2.3 From abd58af3ef23df25870945192bfd3835c09ed87b Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Thu, 7 May 2015 18:12:37 +0200 Subject: releasing package python-apt version 0.9.4 --- debian/changelog | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/debian/changelog b/debian/changelog index f431871d..f28a8b40 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,10 +1,21 @@ -python-apt (0.9.3.12) UNRELEASED; urgency=medium +python-apt (0.9.4) unstable; urgency=medium + + [ Michael Vogt ] + * add apt_pkg.sha512sum() + * Add binding for apt_pkg.maybe_open_clear_signed_file() + * apt/debfile.py: use apt_pkg.open_maybe_clear_signed_file() when opening a .dsc file + * Update doc/example/action.py for py3 and latest API (closes: #782335) + * Add MULTI_ARCH_NO constant and deprecate MULTI_ARCH_NONE (closes: #782802) + * Fix dead links in python-apt documentation (Closes: #779426) [ Martin Pitt ] * ./data/templates/Ubuntu.info.in: Add Wily template. Don't copy extras.u.c. stanza as that's gone since 15.04. - -- Michael Vogt Thu, 07 May 2015 16:42:53 +0200 + [ von ] + * Update the print_uris.py example to use the new API (Closes: #779217) + + -- Michael Vogt Thu, 07 May 2015 18:18:29 +0200 python-apt (0.9.3.11) unstable; urgency=low -- cgit v1.2.3 From bdbbe156c7aabe231343c909d4bfc5b5ac4c54ce Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Fri, 15 May 2015 12:28:58 +0200 Subject: tests/test_tagfile.py: Close files we opened to prevent leakage This bug was initially experienced in the Ubuntu automatic package testing environment, and they fixed it in 0.9.4ubuntu1 with the same (obvious) patch. The bug was reported in Debian as #785337 with a different patch. Compared to the patch suggested in the bug tracker, this version is more idiomatic Python. Closes: #785337 --- tests/test_tagfile.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/test_tagfile.py b/tests/test_tagfile.py index 1ac20624..029e2946 100644 --- a/tests/test_tagfile.py +++ b/tests/test_tagfile.py @@ -34,16 +34,16 @@ class TestOpenMaybeClearSigned(unittest.TestCase): basepath = os.path.dirname(__file__) fd = apt_pkg.open_maybe_clear_signed_file( os.path.join(basepath, "./data/test_debs/hello_2.5-1.dsc")) - f = os.fdopen(fd) - data = f.read() + with os.fdopen(fd) as f: + data = f.read() self.assertTrue(data.startswith("Format: 1.0\n")) def test_open_normal(self): basepath = os.path.dirname(__file__) fd = apt_pkg.open_maybe_clear_signed_file( os.path.join(basepath, "./data/misc/foo_Release")) - f = os.fdopen(fd) - data = f.read() + with os.fdopen(fd) as f: + data = f.read() self.assertTrue(data.startswith("Origin: Ubuntu\n")) def xtest_open_does_not_exit(self): -- cgit v1.2.3 From 39e58a1efcf45fa06e9cc87790f5c8883f157039 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Fri, 22 May 2015 11:03:51 +0200 Subject: apt_pkg.rst: improve documentation for AcquireFile() hash and add sha512 to the documentation --- doc/source/library/apt_pkg.rst | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/doc/source/library/apt_pkg.rst b/doc/source/library/apt_pkg.rst index c5e58b38..8faca4a4 100644 --- a/doc/source/library/apt_pkg.rst +++ b/doc/source/library/apt_pkg.rst @@ -1704,7 +1704,7 @@ installation. There was a network error. -.. class:: AcquireFile(owner, uri[, md5, size, descr, short_descr, destdir, destfile]) +.. class:: AcquireFile(owner, uri[, hash, size, descr, short_descr, destdir, destfile]) Create a new :class:`AcquireFile()` object and register it with *acquire*, so it will be fetched. You must always keep around a reference to the @@ -1717,8 +1717,9 @@ installation. The parameter *uri* refers to the location of the file, any protocol of apt is supported. - The parameter *md5* refers to the md5sum of the file. This can be used - for checking the file. + The parameter *hash* refers to the hash of the file. If this is set + libapt will check the file after downloading. See :class:`HashString` + for the combined form string format description. The parameter *size* can be used to specify the size of the package, which can then be used to calculate the progress and validate the download. @@ -1850,8 +1851,8 @@ generic hash support: .. attribute:: hashtype - The type of the hash, as a string. This may be "MD5Sum", "SHA1" - or "SHA256". + The type of the hash, as a string. This may be "MD5Sum", "SHA1", + "SHA256" or "SHA512". .. method:: verify_file(filename: str) -> bool -- cgit v1.2.3 From 83d876034f5bd74f007376f2cefc98cae77a5a94 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Fri, 22 May 2015 12:12:47 +0200 Subject: rename "md5" keyword argument in AcquireFile() to "hash" and add backward compatiblity --- python/acquire-item.cc | 35 ++++++++++++++++++++++++++--------- tests/test_paths.py | 14 ++++++++++++++ 2 files changed, 40 insertions(+), 9 deletions(-) diff --git a/python/acquire-item.cc b/python/acquire-item.cc index 5589a1f2..d07f4c82 100644 --- a/python/acquire-item.cc +++ b/python/acquire-item.cc @@ -224,26 +224,43 @@ PyTypeObject PyAcquireItem_Type = { static PyObject *acquirefile_new(PyTypeObject *type, PyObject *Args, PyObject * kwds) { PyObject *pyfetcher; - const char *uri, *md5, *descr, *shortDescr; + const char *uri, *hash, *md5, *descr, *shortDescr; PyApt_Filename destDir, destFile; int size = 0; - uri = md5 = descr = shortDescr = destDir = destFile = ""; + uri = hash = md5 = descr = shortDescr = destDir = destFile = ""; - char *kwlist[] = {"owner","uri", "md5", "size", "descr", "short_descr", - "destdir", "destfile", NULL + // "md5" is only in this list for backward compatiblity, everyone should + // use "hash" + char *kwlist[] = {"owner", "uri", "hash", "size", "descr", "short_descr", + "destdir", "destfile", "md5", NULL }; - - if (PyArg_ParseTupleAndKeywords(Args, kwds, "O!s|sissO&O&", kwlist, - &PyAcquire_Type, &pyfetcher, &uri, &md5, +#if PY_MAJOR_VERSION >= 3 + const char *fmt = "O!s|sissO&O&$s"; +#else + // no "$" support to indicate that the remaining args are keyword only + // in py2.x :/ + const char *fmt = "O!s|sissO&O&s"; +#endif + if (PyArg_ParseTupleAndKeywords(Args, kwds, fmt, kwlist, + &PyAcquire_Type, &pyfetcher, &uri, &hash, &size, &descr, &shortDescr, PyApt_Filename::Converter, &destDir, - PyApt_Filename::Converter, &destFile) == 0) + PyApt_Filename::Converter, &destFile, + &md5) == 0) return 0; + // issue deprecation warning for md5 + if (strlen(md5) > 0) { + PyErr_Warn(PyExc_DeprecationWarning, + "Using the md5 keyword is deprecated, please use 'hash' instead"); + } + // support "md5" keyword for backward compatiblity + if (strlen(hash) == 0 && strlen(md5) != 0) + hash = md5; pkgAcquire *fetcher = GetCpp(pyfetcher); pkgAcqFile *af = new pkgAcqFile(fetcher, // owner uri, // uri - md5, // md5 + hash, // hash size, // size descr, // descr shortDescr, diff --git a/tests/test_paths.py b/tests/test_paths.py index 51d22f49..993ad02b 100644 --- a/tests/test_paths.py +++ b/tests/test_paths.py @@ -35,6 +35,20 @@ class TestPath(unittest.TestCase): destdir=self.file_unicode, destfile=self.file_unicode) + def test_acquire_file_md5_keyword_backward_compat(self): + """ + Ensure that both "md5" and "hash" is supported as keyword for + AcquireFile + """ + apt_pkg.AcquireFile( + apt_pkg.Acquire(), "http://example.com", + destfile=self.file_bytes, + md5="abcdef") + apt_pkg.AcquireFile( + apt_pkg.Acquire(), "http://example.com", + destfile=self.file_bytes, + hash="sha1:41050ed528554fdd6c6c9a086ddd6bdba5857b21") + def test_ararchive(self): archive = apt_inst.ArArchive(u"data/test_debs/data-tar-xz.deb") -- cgit v1.2.3 From 1dabbd8dda5ce7d41b68e5150db4a5fd2877fa18 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Fri, 22 May 2015 12:46:15 +0200 Subject: Fix apt.Package.installed_files for multi-arch packages Thanks to Michael Schaller LP: #1313699 --- apt/package.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apt/package.py b/apt/package.py index c67540e6..810d9dcc 100644 --- a/apt/package.py +++ b/apt/package.py @@ -904,7 +904,7 @@ class Package(object): Return a list of unicode names of the files which have been installed by this package """ - for name in self.shortname, self.fullname: + for name in self.name, self.fullname: path = "/var/lib/dpkg/info/%s.list" % name try: with open(path, "rb") as file_list: -- cgit v1.2.3 From 1546cdfe105754af2bc685f40bfe985bae3d72e1 Mon Sep 17 00:00:00 2001 From: von Date: Thu, 14 May 2015 00:19:10 +0200 Subject: Remove the "-Wstrict-prototypes" compiler option It isn't valid for C++. See: http://bugs.python.org/issue9031, http://bugs.python.org/issue1222585 [jak@debian.org: Reworded commit message] --- setup.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/setup.py b/setup.py index 56f5c530..f9d56386 100644 --- a/setup.py +++ b/setup.py @@ -6,6 +6,7 @@ import os import sys from distutils.core import setup, Extension +from distutils import sysconfig cmdclass = {} try: @@ -54,6 +55,12 @@ if len(sys.argv) > 1 and sys.argv[1] == "build": import shutil shutil.copy(template, os.path.join("build", template)) +# Remove the "-Wstrict-prototypes" compiler option, which isn't valid for C++. +# See http://bugs.python.org/issue9031 and http://bugs.python.org/issue1222585 +cfg_vars = sysconfig.get_config_vars() +for key, value in cfg_vars.items(): + if type(value) == str: + cfg_vars[key] = value.replace("-Wstrict-prototypes", "") setup(name="python-apt", description="Python bindings for APT", -- cgit v1.2.3 From 0123aee9d24556b1515a48c8c666e6f23162cb17 Mon Sep 17 00:00:00 2001 From: von Date: Sat, 16 May 2015 00:52:49 +0200 Subject: Set Standards-Version to 3.9.6 --- debian/control | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/control b/debian/control index 9d112644..38065c21 100644 --- a/debian/control +++ b/debian/control @@ -3,7 +3,7 @@ Section: python Priority: standard Maintainer: APT Development Team Uploaders: Michael Vogt , Julian Andres Klode -Standards-Version: 3.9.5 +Standards-Version: 3.9.6 X-Python-Version: >= 2.7 X-Python3-Version: >= 3.3 Build-Depends: apt (>= 0.9.6), -- cgit v1.2.3 From 8f31026d3a1d5b097f60fdd14247d483945985d3 Mon Sep 17 00:00:00 2001 From: von Date: Sun, 10 May 2015 16:38:02 +0200 Subject: Fix indentation and docstring problems Closes: #784910 --- apt/cache.py | 12 ++++++------ apt/package.py | 1 + aptsources/sourceslist.py | 8 ++++---- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/apt/cache.py b/apt/cache.py index 69ee3693..f94f2146 100644 --- a/apt/cache.py +++ b/apt/cache.py @@ -59,11 +59,11 @@ class Cache(object): objects (although only getting items is supported). Keyword arguments: - progress -- a OpProgress object - rootdir -- a alternative root directory. if that is given - the system sources.list and system lists/ files are - not read, only files relative to the given rootdir - memonly -- build the cache in memory only + progress -- a OpProgress object, + rootdir -- an alternative root directory. if that is given the system + sources.list and system lists/files are not read, only file relative + to the given rootdir, + memonly -- build the cache in memory only. """ def __init__(self, progress=None, rootdir=None, memonly=False): @@ -409,7 +409,7 @@ class Cache(object): apt.progress.FetchProgress, the default is apt.progress.FetchProgress() . sources_list -- Update a alternative sources.list than the default. - Note that the sources.list.d directory is ignored in this case + Note that the sources.list.d directory is ignored in this case """ lockfile = apt_pkg.config.find_dir("Dir::State::Lists") + "lock" lock = apt_pkg.get_lock(lockfile) diff --git a/apt/package.py b/apt/package.py index 810d9dcc..8561d3c4 100644 --- a/apt/package.py +++ b/apt/package.py @@ -785,6 +785,7 @@ class Package(object): as :attr:`shortname` .. versionchanged:: 0.7.100.3 + As part of multi-arch, this field now may include architecture information. """ diff --git a/aptsources/sourceslist.py b/aptsources/sourceslist.py index 842b1451..f4903523 100644 --- a/aptsources/sourceslist.py +++ b/aptsources/sourceslist.py @@ -44,10 +44,10 @@ __all__ = ['is_mirror', 'SourceEntry', 'NullMatcher', 'SourcesList', def is_mirror(master_uri, compare_uri): - """ check if the given add_url is idential or a mirror of orig_uri - e.g. master_uri = archive.ubuntu.com - compare_uri = de.archive.ubuntu.com - -> True + """ check if the given add_url is idential or a mirror of orig_uri e.g.: + master_uri = archive.ubuntu.com + compare_uri = de.archive.ubuntu.com + -> True """ # remove traling spaces and "/" compare_uri = compare_uri.rstrip("/ ") -- cgit v1.2.3 From be66a39aaeb00cb8c66564cecefb95c9e5a2cc45 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Wed, 10 Jun 2015 10:44:23 +0200 Subject: doc/source/c++/api.rst: Upgrade syntax to use the new domain stuff Makes sphinx stop complaining during the build --- doc/source/c++/api.rst | 436 ++++++++++++++++++++++++------------------------- 1 file changed, 218 insertions(+), 218 deletions(-) diff --git a/doc/source/c++/api.rst b/doc/source/c++/api.rst index 63ed1599..632966bb 100644 --- a/doc/source/c++/api.rst +++ b/doc/source/c++/api.rst @@ -14,379 +14,379 @@ a _CheckExact() function, a _FromCpp() and a _ToCpp() function. Acquire (pkgAcquire) -------------------- -.. cvar:: PyTypeObject PyAcquire_Type +.. c:var:: PyTypeObject PyAcquire_Type The type object for :class:`apt_pkg.Acquire` objects. -.. cfunction:: int PyAcquire_Check(PyObject *object) +.. c:function:: int PyAcquire_Check(PyObject *object) Check that the object *object* is an :class:`apt_pkg.Acquire` object, or a subclass thereof. -.. cfunction:: int PyAcquire_CheckExact(PyObject *object) +.. c:function:: int PyAcquire_CheckExact(PyObject *object) Check that the object *object* is an :class:`apt_pkg.Acquire` object and no subclass thereof. -.. cfunction:: PyObject* PyAcquire_FromCpp(pkgAcquire *acquire, bool delete, PyObject *owner) +.. c:function:: PyObject* PyAcquire_FromCpp(pkgAcquire *acquire, bool delete, PyObject *owner) - Create a new :class:`apt_pkg.Acquire` object from the :ctype:`pkgAcquire` + Create a new :class:`apt_pkg.Acquire` object from the :c:type:`pkgAcquire` pointer given by the parameter *acquire*. If the parameter *delete* is true, the object pointed to by *acquire* will be deleted when the refcount of the return value reaches 0. -.. cfunction:: pkgAcquire* PyAcquire_ToCpp(PyObject *acquire) +.. c:function:: pkgAcquire* PyAcquire_ToCpp(PyObject *acquire) - Return the :ctype:`pkgAcquire` pointer contained in the Python object + Return the :c:type:`pkgAcquire` pointer contained in the Python object *acquire*. AcquireFile (pkgAcqFile) ------------------------ -.. cvar:: PyTypeObject PyAcquireFile_Type +.. c:var:: PyTypeObject PyAcquireFile_Type The type object for :class:`apt_pkg.AcquireFile` objects. -.. cfunction:: int PyAcquireFile_Check(PyObject *object) +.. c:function:: int PyAcquireFile_Check(PyObject *object) Check that the object *object* is an :class:`apt_pkg.AcquireFile` object, or a subclass thereof. -.. cfunction:: int PyAcquireFile_CheckExact(PyObject *object) +.. c:function:: int PyAcquireFile_CheckExact(PyObject *object) Check that the object *object* is an :class:`apt_pkg.AcquireFile` object and no subclass thereof. -.. cfunction:: PyObject* PyAcquireFile_FromCpp(pkgAcqFile *file, bool delete, PyObject *owner) +.. c:function:: PyObject* PyAcquireFile_FromCpp(pkgAcqFile *file, bool delete, PyObject *owner) - Create a new :class:`apt_pkg.AcquireFile` object from the :ctype:`pkgAcqFile` + Create a new :class:`apt_pkg.AcquireFile` object from the :c:type:`pkgAcqFile` pointer given by the parameter *file*. If the parameter *delete* is true, the object pointed to by *file* will be deleted when the reference count of the returned object reaches 0. The parameter *owner* should point to a :class:`apt_pkg.Acquire` object. -.. cfunction:: pkgAcqFile* PyAcquireFile_ToCpp(PyObject *acquire) +.. c:function:: pkgAcqFile* PyAcquireFile_ToCpp(PyObject *acquire) - Return the :ctype:`pkgAcqFile` pointer contained in the Python object + Return the :c:type:`pkgAcqFile` pointer contained in the Python object *acquire*. AcquireItem (pkgAcquire::Item) ------------------------------ -.. cvar:: PyTypeObject PyAcquireItem_Type +.. c:var:: PyTypeObject PyAcquireItem_Type The type object for :class:`apt_pkg.AcquireItem` objects. -.. cfunction:: int PyAcquireItem_Check(PyObject *object) +.. c:function:: int PyAcquireItem_Check(PyObject *object) Check that the object *object* is an :class:`apt_pkg.AcquireItem` object, or a subclass thereof. -.. cfunction:: int PyAcquireItem_CheckExact(PyObject *object) +.. c:function:: int PyAcquireItem_CheckExact(PyObject *object) Check that the object *object* is an :class:`apt_pkg.AcquireItem` object and no subclass thereof. -.. cfunction:: PyObject* PyAcquireItem_FromCpp(pkgAcquire::Item *item, bool delete, PyObject *owner) +.. c:function:: PyObject* PyAcquireItem_FromCpp(pkgAcquire::Item *item, bool delete, PyObject *owner) - Create a new :class:`apt_pkg.AcquireItem` object from the :ctype:`pkgAcquire::Item` + Create a new :class:`apt_pkg.AcquireItem` object from the :c:type:`pkgAcquire::Item` pointer given by the parameter *item*. If the parameter *delete* is true, the object pointed to by *item* will be deleted when the reference count of the returned object reaches 0. The parameter *owner* should point to a :class:`apt_pkg.Acquire` object. -.. cfunction:: pkgAcquire::Item* PyAcquireItem_ToCpp(PyObject *object) +.. c:function:: pkgAcquire::Item* PyAcquireItem_ToCpp(PyObject *object) - Return the :ctype:`pkgAcquire::Item` pointer contained in the Python object + Return the :c:type:`pkgAcquire::Item` pointer contained in the Python object *object*. AcquireItemDesc (pkgAcquire::ItemDesc) -------------------------------------- -.. cvar:: PyTypeObject PyAcquireItemDesc_Type +.. c:var:: PyTypeObject PyAcquireItemDesc_Type The type object for :class:`apt_pkg.AcquireItemDesc` objects. -.. cfunction:: int PyAcquireItemDesc_Check(PyObject *object) +.. c:function:: int PyAcquireItemDesc_Check(PyObject *object) Check that the object *object* is an :class:`apt_pkg.AcquireItemDesc` object, or a subclass thereof. -.. cfunction:: int PyAcquireItemDesc_CheckExact(PyObject *object) +.. c:function:: int PyAcquireItemDesc_CheckExact(PyObject *object) Check that the object *object* is an :class:`apt_pkg.AcquireItemDesc` object and no subclass thereof. -.. cfunction:: PyObject* PyAcquireItemDesc_FromCpp(pkgAcquire::ItemDesc *desc, bool delete, PyObject *owner) +.. c:function:: PyObject* PyAcquireItemDesc_FromCpp(pkgAcquire::ItemDesc *desc, bool delete, PyObject *owner) - Create a new :class:`apt_pkg.AcquireItemDesc` object from the :ctype:`pkgAcquire::ItemDesc` + Create a new :class:`apt_pkg.AcquireItemDesc` object from the :c:type:`pkgAcquire::ItemDesc` pointer given by the parameter *desc*. If the parameter *delete* is true, the object pointed to by *desc* will be deleted when the reference count of the returned object reaches 0. The parameter *owner* should point to a :class:`apt_pkg.AcquireItem` object. -.. cfunction:: pkgAcquire::ItemDesc* PyAcquireItemDesc_ToCpp(PyObject *object) +.. c:function:: pkgAcquire::ItemDesc* PyAcquireItemDesc_ToCpp(PyObject *object) - Return the :ctype:`pkgAcquire::ItemDesc` pointer contained in the Python object + Return the :c:type:`pkgAcquire::ItemDesc` pointer contained in the Python object *object*. AcquireWorker (pkgAcquire::Worker) ---------------------------------- -.. cvar:: PyTypeObject PyAcquireWorker_Type +.. c:var:: PyTypeObject PyAcquireWorker_Type The type object for :class:`apt_pkg.AcquireWorker` objects. -.. cfunction:: int PyAcquireWorker_Check(PyObject *object) +.. c:function:: int PyAcquireWorker_Check(PyObject *object) Check that the object *object* is an :class:`apt_pkg.AcquireWorker` object, or a subclass thereof. -.. cfunction:: int PyAcquireWorker_CheckExact(PyObject *object) +.. c:function:: int PyAcquireWorker_CheckExact(PyObject *object) Check that the object *object* is an :class:`apt_pkg.AcquireWorker` object and no subclass thereof. -.. cfunction:: PyObject* PyAcquireWorker_FromCpp(pkgAcquire::Worker *worker, bool delete, PyObject *owner) +.. c:function:: PyObject* PyAcquireWorker_FromCpp(pkgAcquire::Worker *worker, bool delete, PyObject *owner) - Create a new :class:`apt_pkg.AcquireWorker` object from the :ctype:`pkgAcquire::Worker` + Create a new :class:`apt_pkg.AcquireWorker` object from the :c:type:`pkgAcquire::Worker` pointer given by the parameter *worker*. If the parameter *delete* is true, the object pointed to by *worker* will be deleted when the reference count of the returned object reaches 0. The parameter *owner* should point to a :class:`apt_pkg.Acquire` object. -.. cfunction:: pkgAcquire::Worker* PyAcquireWorker_ToCpp(PyObject *object) +.. c:function:: pkgAcquire::Worker* PyAcquireWorker_ToCpp(PyObject *object) - Return the :ctype:`pkgAcquire::Worker` pointer contained in the Python object + Return the :c:type:`pkgAcquire::Worker` pointer contained in the Python object *object*. ActionGroup (pkgDepCache::ActionGroup) -------------------------------------- -.. cvar:: PyTypeObject PyActionGroup_Type +.. c:var:: PyTypeObject PyActionGroup_Type The type object for :class:`apt_pkg.ActionGroup` objects. -.. cfunction:: int PyActionGroup_Check(PyObject *object) +.. c:function:: int PyActionGroup_Check(PyObject *object) Check that the object *object* is an :class:`apt_pkg.ActionGroup` object, or a subclass thereof. -.. cfunction:: int PyActionGroup_CheckExact(PyObject *object) +.. c:function:: int PyActionGroup_CheckExact(PyObject *object) Check that the object *object* is an :class:`apt_pkg.ActionGroup` object and no subclass thereof. -.. cfunction:: PyObject* PyActionGroup_FromCpp(pkgDepCache::ActionGroup *agroup, bool delete, PyObject *owner) +.. c:function:: PyObject* PyActionGroup_FromCpp(pkgDepCache::ActionGroup *agroup, bool delete, PyObject *owner) - Create a new :class:`apt_pkg.ActionGroup` object from the :ctype:`pkgDepCache::ActionGroup` + Create a new :class:`apt_pkg.ActionGroup` object from the :c:type:`pkgDepCache::ActionGroup` pointer given by the parameter *agroup*. If the parameter *delete* is true, the object pointed to by *agroup* will be deleted when the reference count of the returned object reaches 0. The parameter *owner* should point to a :class:`apt_pkg.DepCache` object. -.. cfunction:: pkgDepCache::ActionGroup* PyActionGroup_ToCpp(PyObject *object) +.. c:function:: pkgDepCache::ActionGroup* PyActionGroup_ToCpp(PyObject *object) - Return the :ctype:`pkgDepCache::ActionGroup` pointer contained in the + Return the :c:type:`pkgDepCache::ActionGroup` pointer contained in the Python object *object*. Cache (pkgCache) ------------------------ -.. cvar:: PyTypeObject PyCache_Type +.. c:var:: PyTypeObject PyCache_Type The type object for :class:`apt_pkg.Cache` objects. -.. cfunction:: int PyCache_Check(PyObject *object) +.. c:function:: int PyCache_Check(PyObject *object) Check that the object *object* is an :class:`apt_pkg.Cache` object, or a subclass thereof. -.. cfunction:: int PyCache_CheckExact(PyObject *object) +.. c:function:: int PyCache_CheckExact(PyObject *object) Check that the object *object* is an :class:`apt_pkg.Cache` object and no subclass thereof. -.. cfunction:: PyObject* PyCache_FromCpp(pkgCache *cache, bool delete, PyObject *owner) +.. c:function:: PyObject* PyCache_FromCpp(pkgCache *cache, bool delete, PyObject *owner) - Create a new :class:`apt_pkg.Cache` object from the :ctype:`pkgCache` + Create a new :class:`apt_pkg.Cache` object from the :c:type:`pkgCache` pointer given by the parameter *cache*. If the parameter *delete* is true, the object pointed to by *cache* will be deleted when the reference count of the returned object reaches 0. The parameter *owner* shall point - to a object of the type :cdata:`PyCacheFile_Type`. + to a object of the type :c:data:`PyCacheFile_Type`. -.. cfunction:: pkgCache* PyCache_ToCpp(PyObject *object) +.. c:function:: pkgCache* PyCache_ToCpp(PyObject *object) - Return the :ctype:`pkgCache` pointer contained in the Python object + Return the :c:type:`pkgCache` pointer contained in the Python object *object*. CacheFile (pkgCacheFile) ------------------------ -.. cvar:: PyTypeObject PyCacheFile_Type +.. c:var:: PyTypeObject PyCacheFile_Type The type object for CacheFile. This type is internal and not exported to Python anywhere. -.. cfunction:: int PyCacheFile_Check(PyObject *object) +.. c:function:: int PyCacheFile_Check(PyObject *object) - Check that the object *object* is of the type :cdata:`PyCacheFile_Type` or + Check that the object *object* is of the type :c:data:`PyCacheFile_Type` or a subclass thereof. -.. cfunction:: int PyCacheFile_CheckExact(PyObject *object) +.. c:function:: int PyCacheFile_CheckExact(PyObject *object) - Check that the object *object* is of the type :cdata:`PyCacheFile_Type` and + Check that the object *object* is of the type :c:data:`PyCacheFile_Type` and no subclass thereof. -.. cfunction:: PyObject* PyCacheFile_FromCpp(pkgCacheFile *file, bool delete, PyObject *owner) +.. c:function:: PyObject* PyCacheFile_FromCpp(pkgCacheFile *file, bool delete, PyObject *owner) - Create a new :class:`apt_pkg.CacheFile` object from the :ctype:`pkgCacheFile` + Create a new :class:`apt_pkg.CacheFile` object from the :c:type:`pkgCacheFile` pointer given by the parameter *file* If the parameter *delete* is true, the object pointed to by *file* will be deleted when the reference count of the returned object reaches 0. -.. cfunction:: pkgCacheFile* PyCacheFile_ToCpp(PyObject *object) +.. c:function:: pkgCacheFile* PyCacheFile_ToCpp(PyObject *object) - Return the :ctype:`pkgCacheFile` pointer contained in the Python object + Return the :c:type:`pkgCacheFile` pointer contained in the Python object *object*. Cdrom (pkgCdrom) ------------------------ -.. cvar:: PyTypeObject PyCdrom_Type +.. c:var:: PyTypeObject PyCdrom_Type The type object for :class:`apt_pkg.Cdrom` objects. -.. cfunction:: int PyCdrom_Check(PyObject *object) +.. c:function:: int PyCdrom_Check(PyObject *object) Check that the object *object* is an :class:`apt_pkg.Cdrom` object, or a subclass thereof. -.. cfunction:: int PyCdrom_CheckExact(PyObject *object) +.. c:function:: int PyCdrom_CheckExact(PyObject *object) Check that the object *object* is an :class:`apt_pkg.Cdrom` object and no subclass thereof. -.. cfunction:: PyObject* PyCdrom_FromCpp(pkgCdrom &cdrom, bool delete, PyObject *owner) +.. c:function:: PyObject* PyCdrom_FromCpp(pkgCdrom &cdrom, bool delete, PyObject *owner) - Create a new :class:`apt_pkg.Cdrom` object from the :ctype:`pkgCdrom` + Create a new :class:`apt_pkg.Cdrom` object from the :c:type:`pkgCdrom` reference given by the parameter *cdrom*. If the parameter *delete* is true, *cdrom* will be deleted when the reference count of the returned object reaches 0. -.. cfunction:: pkgCdrom& PyCdrom_ToCpp(PyObject *object) +.. c:function:: pkgCdrom& PyCdrom_ToCpp(PyObject *object) - Return the :ctype:`pkgCdrom` reference contained in the Python object + Return the :c:type:`pkgCdrom` reference contained in the Python object *object*. Configuration (Configuration) ------------------------------- -.. cvar:: PyTypeObject PyConfiguration_Type +.. c:var:: PyTypeObject PyConfiguration_Type The type object for :class:`apt_pkg.Configuration` objects. -.. cfunction:: int PyConfiguration_Check(PyObject *object) +.. c:function:: int PyConfiguration_Check(PyObject *object) Check that the object *object* is an :class:`apt_pkg.Configuration` object, or a subclass thereof. -.. cfunction:: int PyConfiguration_CheckExact(PyObject *object) +.. c:function:: int PyConfiguration_CheckExact(PyObject *object) Check that the object *object* is an :class:`apt_pkg.Configuration` object and no subclass thereof. -.. cfunction:: PyObject* PyConfiguration_FromCpp(Configuration *cpp, bool delete, PyObject *owner) +.. c:function:: PyObject* PyConfiguration_FromCpp(Configuration *cpp, bool delete, PyObject *owner) - Create a new :class:`apt_pkg.Configuration` object from the :ctype:`Configuration` + Create a new :class:`apt_pkg.Configuration` object from the :c:type:`Configuration` pointer given by the parameter *cpp*. If the parameter *delete* is true, the object pointed to by *cpp* will be deleted when the reference count of the returned object reaches 0. The parameter *owner* may refer to a parent object (e.g. when exposing a sub tree of a configuration object). -.. cfunction:: Configuration* PyConfiguration_ToCpp(PyObject *object) +.. c:function:: Configuration* PyConfiguration_ToCpp(PyObject *object) - Return the :ctype:`Configuration` pointer contained in the Python object + Return the :c:type:`Configuration` pointer contained in the Python object *object*. DepCache (pkgDepCache) ------------------------ -.. cvar:: PyTypeObject PyDepCache_Type +.. c:var:: PyTypeObject PyDepCache_Type The type object for :class:`apt_pkg.DepCache` objects. -.. cfunction:: int PyDepCache_Check(PyObject *object) +.. c:function:: int PyDepCache_Check(PyObject *object) Check that the object *object* is an :class:`apt_pkg.DepCache` object, or a subclass thereof. -.. cfunction:: int PyDepCache_CheckExact(PyObject *object) +.. c:function:: int PyDepCache_CheckExact(PyObject *object) Check that the object *object* is an :class:`apt_pkg.DepCache` object and no subclass thereof. -.. cfunction:: PyObject* PyDepCache_FromCpp(pkgDepCache *cpp, bool delete, PyObject *owner) +.. c:function:: PyObject* PyDepCache_FromCpp(pkgDepCache *cpp, bool delete, PyObject *owner) - Create a new :class:`apt_pkg.DepCache` object from the :ctype:`pkgDepCache` + Create a new :class:`apt_pkg.DepCache` object from the :c:type:`pkgDepCache` pointer given by the parameter *cpp*. If the parameter *delete* is true, the object pointed to by *cpp* will be deleted when the reference count of the returned object reaches 0. The parameter *owner* must be - a PyObject of the type :cdata:`PyCache_Type`. + a PyObject of the type :c:data:`PyCache_Type`. -.. cfunction:: pkgDepCache* PyDepCache_ToCpp(PyObject *object) +.. c:function:: pkgDepCache* PyDepCache_ToCpp(PyObject *object) - Return the :ctype:`pkgDepCache` pointer contained in the Python object + Return the :c:type:`pkgDepCache` pointer contained in the Python object *object*. Dependency (pkgCache::DepIterator) ---------------------------------- -.. cvar:: PyTypeObject PyDependency_Type +.. c:var:: PyTypeObject PyDependency_Type The type object for :class:`apt_pkg.Dependency` objects. -.. cfunction:: int PyDependency_Check(PyObject *object) +.. c:function:: int PyDependency_Check(PyObject *object) Check that the object *object* is an :class:`apt_pkg.Dependency` object, or a subclass thereof. -.. cfunction:: int PyDependency_CheckExact(PyObject *object) +.. c:function:: int PyDependency_CheckExact(PyObject *object) Check that the object *object* is an :class:`apt_pkg.Dependency` object and no subclass thereof. -.. cfunction:: PyObject* PyDependency_FromCpp(pkgCache::DepIterator &cpp, bool delete, PyObject *owner) +.. c:function:: PyObject* PyDependency_FromCpp(pkgCache::DepIterator &cpp, bool delete, PyObject *owner) - Create a new :class:`apt_pkg.Dependency` object from the :ctype:`pkgCache::DepIterator` + Create a new :class:`apt_pkg.Dependency` object from the :c:type:`pkgCache::DepIterator` reference given by the parameter *cpp*. If the parameter *delete* is true, *cpp* will be deleted when the reference count of the returned object reaches 0. The parameter *owner* must be - a PyObject of the type :cdata:`PyPackage_Type`. + a PyObject of the type :c:data:`PyPackage_Type`. -.. cfunction:: pkgCache::DepIterator& PyDependency_ToCpp(PyObject *object) +.. c:function:: pkgCache::DepIterator& PyDependency_ToCpp(PyObject *object) - Return the :ctype:`pkgCache::DepIterator` reference contained in the + Return the :c:type:`pkgCache::DepIterator` reference contained in the Python object *object*. Description (pkgCache::DescIterator) ------------------------------------ -.. cvar:: PyTypeObject PyDescription_Type +.. c:var:: PyTypeObject PyDescription_Type The type object for :class:`apt_pkg.Description` objects. -.. cfunction:: int PyDescription_Check(PyObject *object) +.. c:function:: int PyDescription_Check(PyObject *object) Check that the object *object* is an :class:`apt_pkg.Description` object, or a subclass thereof. -.. cfunction:: int PyDescription_CheckExact(PyObject *object) +.. c:function:: int PyDescription_CheckExact(PyObject *object) Check that the object *object* is an :class:`apt_pkg.Description` object and no subclass thereof. -.. cfunction:: PyObject* PyDescription_FromCpp(pkgCache::DescIterator &cpp, bool delete, PyObject *owner) +.. c:function:: PyObject* PyDescription_FromCpp(pkgCache::DescIterator &cpp, bool delete, PyObject *owner) - Create a new :class:`apt_pkg.Description` object from the :ctype:`pkgCache::DescIterator` + Create a new :class:`apt_pkg.Description` object from the :c:type:`pkgCache::DescIterator` reference given by the parameter *cpp*. If the parameter *delete* is true, *cpp* will be deleted when the reference count of the returned object reaches 0. The parameter *owner* must be - a PyObject of the type :cdata:`PyPackage_Type`. + a PyObject of the type :c:data:`PyPackage_Type`. -.. cfunction:: pkgCache::DescIterator& PyDescription_ToCpp(PyObject *object) +.. c:function:: pkgCache::DescIterator& PyDescription_ToCpp(PyObject *object) - Return the :ctype:`pkgCache::DescIterator` reference contained in the + Return the :c:type:`pkgCache::DescIterator` reference contained in the Python object *object*. @@ -394,465 +394,465 @@ Group (pkgCache::GrpIterator) ---------------------------------- .. versionadded:: 0.8.0 -.. cvar:: PyTypeObject PyGroup_Type +.. c:var:: PyTypeObject PyGroup_Type The type object for :class:`apt_pkg.Group` objects. -.. cfunction:: int PyGroup_Check(PyObject *object) +.. c:function:: int PyGroup_Check(PyObject *object) Check that the object *object* is an :class:`apt_pkg.Group` object, or a subclass thereof. -.. cfunction:: int PyGroup_CheckExact(PyObject *object) +.. c:function:: int PyGroup_CheckExact(PyObject *object) Check that the object *object* is an :class:`apt_pkg.Group` object and no subclass thereof. -.. cfunction:: PyObject* PyGroup_FromCpp(pkgCache::GrpIterator &cpp, bool delete, PyObject *owner) +.. c:function:: PyObject* PyGroup_FromCpp(pkgCache::GrpIterator &cpp, bool delete, PyObject *owner) - Create a new :class:`apt_pkg.Group` object from the :ctype:`pkgCache::GrpIterator` + Create a new :class:`apt_pkg.Group` object from the :c:type:`pkgCache::GrpIterator` reference given by the parameter *cpp*. If the parameter *delete* is true, *cpp* will be deleted when the reference count of the returned object reaches 0. The parameter *owner* should be - a PyObject of the type :cdata:`PyCache_Type`. + a PyObject of the type :c:data:`PyCache_Type`. -.. cfunction:: pkgCache::GrpIterator& PyGroup_ToCpp(PyObject *object) +.. c:function:: pkgCache::GrpIterator& PyGroup_ToCpp(PyObject *object) - Return the :ctype:`pkgCache::GrpIterator` reference contained in the + Return the :c:type:`pkgCache::GrpIterator` reference contained in the Python object *object*. Hashes (Hashes) ---------------------------------- -.. cvar:: PyTypeObject PyHashes_Type +.. c:var:: PyTypeObject PyHashes_Type The type object for :class:`apt_pkg.Hashes` objects. -.. cfunction:: int PyHashes_Check(PyObject *object) +.. c:function:: int PyHashes_Check(PyObject *object) Check that the object *object* is an :class:`apt_pkg.Hashes` object, or a subclass thereof. -.. cfunction:: int PyHashes_CheckExact(PyObject *object) +.. c:function:: int PyHashes_CheckExact(PyObject *object) Check that the object *object* is an :class:`apt_pkg.Hashes` object and no subclass thereof. -.. cfunction:: PyObject* PyHashes_FromCpp(Hashes &cpp, bool delete, PyObject *owner) +.. c:function:: PyObject* PyHashes_FromCpp(Hashes &cpp, bool delete, PyObject *owner) - Create a new :class:`apt_pkg.Hashes` object from the :ctype:`Hashes` + Create a new :class:`apt_pkg.Hashes` object from the :c:type:`Hashes` reference given by the parameter *cpp*. If the parameter *delete* is true, *cpp* will be deleted when the reference count of the returned object reaches 0. -.. cfunction:: Hashes& PyHashes_ToCpp(PyObject *object) +.. c:function:: Hashes& PyHashes_ToCpp(PyObject *object) - Return the :ctype:`Hashes` reference contained in the + Return the :c:type:`Hashes` reference contained in the Python object *object*. HashString (HashString) ------------------------ -.. cvar:: PyTypeObject PyHashString_Type +.. c:var:: PyTypeObject PyHashString_Type The type object for :class:`apt_pkg.HashString` objects. -.. cfunction:: int PyHashString_Check(PyObject *object) +.. c:function:: int PyHashString_Check(PyObject *object) Check that the object *object* is an :class:`apt_pkg.HashString` object, or a subclass thereof. -.. cfunction:: int PyHashString_CheckExact(PyObject *object) +.. c:function:: int PyHashString_CheckExact(PyObject *object) Check that the object *object* is an :class:`apt_pkg.HashString` object and no subclass thereof. -.. cfunction:: PyObject* PyHashString_FromCpp(HashString *cpp, bool delete, PyObject *owner) +.. c:function:: PyObject* PyHashString_FromCpp(HashString *cpp, bool delete, PyObject *owner) - Create a new :class:`apt_pkg.HashString` object from the :ctype:`HashString` + Create a new :class:`apt_pkg.HashString` object from the :c:type:`HashString` pointer given by the parameter *cpp*. If the parameter *delete* is true, the object pointed to by *cpp* will be deleted when the reference count of the returned object reaches 0. -.. cfunction:: HashString* PyHashString_ToCpp(PyObject *object) +.. c:function:: HashString* PyHashString_ToCpp(PyObject *object) - Return the :ctype:`HashString` pointer contained in the Python object + Return the :c:type:`HashString` pointer contained in the Python object *object*. IndexRecords (indexRecords) ---------------------------- -.. cvar:: PyTypeObject PyIndexRecords_Type +.. c:var:: PyTypeObject PyIndexRecords_Type The type object for :class:`apt_pkg.IndexRecords` objects. -.. cfunction:: int PyIndexRecords_Check(PyObject *object) +.. c:function:: int PyIndexRecords_Check(PyObject *object) Check that the object *object* is an :class:`apt_pkg.IndexRecords` object, or a subclass thereof. -.. cfunction:: int PyIndexRecords_CheckExact(PyObject *object) +.. c:function:: int PyIndexRecords_CheckExact(PyObject *object) Check that the object *object* is an :class:`apt_pkg.IndexRecords` object and no subclass thereof. -.. cfunction:: PyObject* PyIndexRecords_FromCpp(indexRecords *cpp, bool delete, PyObject *owner) +.. c:function:: PyObject* PyIndexRecords_FromCpp(indexRecords *cpp, bool delete, PyObject *owner) - Create a new :class:`apt_pkg.IndexRecords` object from the :ctype:`indexRecords` + Create a new :class:`apt_pkg.IndexRecords` object from the :c:type:`indexRecords` pointer given by the parameter *cpp*. If the parameter *delete* is true, the object pointed to by *cpp* will be deleted when the reference count of the returned object reaches 0. -.. cfunction:: indexRecords* PyIndexRecords_ToCpp(PyObject *object) +.. c:function:: indexRecords* PyIndexRecords_ToCpp(PyObject *object) - Return the :ctype:`indexRecords` pointer contained in the Python object + Return the :c:type:`indexRecords` pointer contained in the Python object *object*. MetaIndex (metaIndex) ------------------------ -.. cvar:: PyTypeObject PyMetaIndex_Type +.. c:var:: PyTypeObject PyMetaIndex_Type The type object for :class:`apt_pkg.MetaIndex` objects. -.. cfunction:: int PyMetaIndex_Check(PyObject *object) +.. c:function:: int PyMetaIndex_Check(PyObject *object) Check that the object *object* is an :class:`apt_pkg.MetaIndex` object, or a subclass thereof. -.. cfunction:: int PyMetaIndex_CheckExact(PyObject *object) +.. c:function:: int PyMetaIndex_CheckExact(PyObject *object) Check that the object *object* is an :class:`apt_pkg.MetaIndex` object and no subclass thereof. -.. cfunction:: PyObject* PyMetaIndex_FromCpp(metaIndex *cpp, bool delete, PyObject *owner) +.. c:function:: PyObject* PyMetaIndex_FromCpp(metaIndex *cpp, bool delete, PyObject *owner) - Create a new :class:`apt_pkg.MetaIndex` object from the :ctype:`metaIndex` + Create a new :class:`apt_pkg.MetaIndex` object from the :c:type:`metaIndex` pointer given by the parameter *cpp*. If the parameter *delete* is true, the object pointed to by *cpp* will be deleted when the reference count of the returned object reaches 0. The parameter *owner* should be - a PyObject of the type :cdata:`PySourceList_Type`. + a PyObject of the type :c:data:`PySourceList_Type`. -.. cfunction:: metaIndex* PyMetaIndex_ToCpp(PyObject *object) +.. c:function:: metaIndex* PyMetaIndex_ToCpp(PyObject *object) - Return the :ctype:`metaIndex` pointer contained in the Python object + Return the :c:type:`metaIndex` pointer contained in the Python object *object*. Package (pkgCache::PkgIterator) ---------------------------------- -.. cvar:: PyTypeObject PyPackage_Type +.. c:var:: PyTypeObject PyPackage_Type The type object for :class:`apt_pkg.Package` objects. -.. cfunction:: int PyPackage_Check(PyObject *object) +.. c:function:: int PyPackage_Check(PyObject *object) Check that the object *object* is an :class:`apt_pkg.Package` object, or a subclass thereof. -.. cfunction:: int PyPackage_CheckExact(PyObject *object) +.. c:function:: int PyPackage_CheckExact(PyObject *object) Check that the object *object* is an :class:`apt_pkg.Package` object and no subclass thereof. -.. cfunction:: PyObject* PyPackage_FromCpp(pkgCache::PkgIterator &cpp, bool delete, PyObject *owner) +.. c:function:: PyObject* PyPackage_FromCpp(pkgCache::PkgIterator &cpp, bool delete, PyObject *owner) - Create a new :class:`apt_pkg.Package` object from the :ctype:`pkgCache::PkgIterator` + Create a new :class:`apt_pkg.Package` object from the :c:type:`pkgCache::PkgIterator` reference given by the parameter *cpp*. If the parameter *delete* is true, *cpp* will be deleted when the reference count of the returned object reaches 0. The parameter *owner* should be - a PyObject of the type :cdata:`PyCache_Type`. + a PyObject of the type :c:data:`PyCache_Type`. -.. cfunction:: pkgCache::PkgIterator& PyPackage_ToCpp(PyObject *object) +.. c:function:: pkgCache::PkgIterator& PyPackage_ToCpp(PyObject *object) - Return the :ctype:`pkgCache::PkgIterator` reference contained in the + Return the :c:type:`pkgCache::PkgIterator` reference contained in the Python object *object*. PackageFile (pkgCache::PkgFileIterator) ---------------------------------------- -.. cvar:: PyTypeObject PyPackageFile_Type +.. c:var:: PyTypeObject PyPackageFile_Type The type object for :class:`apt_pkg.PackageFile` objects. -.. cfunction:: int PyPackageFile_Check(PyObject *object) +.. c:function:: int PyPackageFile_Check(PyObject *object) Check that the object *object* is an :class:`apt_pkg.PackageFile` object, or a subclass thereof. -.. cfunction:: int PyPackageFile_CheckExact(PyObject *object) +.. c:function:: int PyPackageFile_CheckExact(PyObject *object) Check that the object *object* is an :class:`apt_pkg.PackageFile` object and no subclass thereof. -.. cfunction:: PyObject* PyPackageFile_FromCpp(pkgCache::PkgFileIterator &cpp, bool delete, PyObject *owner) +.. c:function:: PyObject* PyPackageFile_FromCpp(pkgCache::PkgFileIterator &cpp, bool delete, PyObject *owner) - Create a new :class:`apt_pkg.PackageFile` object from the :ctype:`pkgCache::PkgFileIterator` + Create a new :class:`apt_pkg.PackageFile` object from the :c:type:`pkgCache::PkgFileIterator` reference given by the parameter *cpp*. If the parameter *delete* is true, *cpp* will be deleted when the reference count of the returned object reaches 0. The parameter *owner* should be - a PyObject of the type :cdata:`PyCache_Type`. + a PyObject of the type :c:data:`PyCache_Type`. -.. cfunction:: pkgCache::PkgFileIterator& PyPackageFile_ToCpp(PyObject *object) +.. c:function:: pkgCache::PkgFileIterator& PyPackageFile_ToCpp(PyObject *object) - Return the :ctype:`pkgCache::PkgFileIterator` reference contained in the + Return the :c:type:`pkgCache::PkgFileIterator` reference contained in the Python object *object*. IndexFile (pkgIndexFile) -------------------------------------- -.. cvar:: PyTypeObject PyIndexFile_Type +.. c:var:: PyTypeObject PyIndexFile_Type The type object for :class:`apt_pkg.IndexFile` objects. -.. cfunction:: int PyIndexFile_Check(PyObject *object) +.. c:function:: int PyIndexFile_Check(PyObject *object) Check that the object *object* is an :class:`apt_pkg.IndexFile` object, or a subclass thereof. -.. cfunction:: int PyIndexFile_CheckExact(PyObject *object) +.. c:function:: int PyIndexFile_CheckExact(PyObject *object) Check that the object *object* is an :class:`apt_pkg.IndexFile` object and no subclass thereof. -.. cfunction:: PyObject* PyIndexFile_FromCpp(pkgIndexFile *cpp, bool delete, PyObject *owner) +.. c:function:: PyObject* PyIndexFile_FromCpp(pkgIndexFile *cpp, bool delete, PyObject *owner) - Create a new :class:`apt_pkg.IndexFile` object from the :ctype:`pkgIndexFile` + Create a new :class:`apt_pkg.IndexFile` object from the :c:type:`pkgIndexFile` pointer given by the parameter *cpp*. If the parameter *delete* is true, the object pointed to by *cpp* will be deleted when the reference count of the returned object reaches 0. The parameter *owner* should be - a PyObject of the type :cdata:`PyMetaIndex_Type`. + a PyObject of the type :c:data:`PyMetaIndex_Type`. -.. cfunction:: pkgIndexFile* PyIndexFile_ToCpp(PyObject *object) +.. c:function:: pkgIndexFile* PyIndexFile_ToCpp(PyObject *object) - Return the :ctype:`pkgIndexFile` pointer contained in the Python object + Return the :c:type:`pkgIndexFile` pointer contained in the Python object *object*. OrderList (pkgOrderList) --------------------------- -.. cvar:: PyTypeObject PyOrderList_Type +.. c:var:: PyTypeObject PyOrderList_Type The type object for :class:`apt_pkg.OrderList` objects. -.. cfunction:: int PyOrderList_Check(PyObject *object) +.. c:function:: int PyOrderList_Check(PyObject *object) Check that the object *object* is an :class:`apt_pkg.OrderList` object, or a subclass thereof. -.. cfunction:: int PyOrderList_CheckExact(PyObject *object) +.. c:function:: int PyOrderList_CheckExact(PyObject *object) Check that the object *object* is an :class:`apt_pkg.OrderList` object and no subclass thereof. -.. cfunction:: PyObject* PyOrderList_FromCpp(pkgOrderList *cpp, bool delete, PyObject *owner) +.. c:function:: PyObject* PyOrderList_FromCpp(pkgOrderList *cpp, bool delete, PyObject *owner) - Create a new :class:`apt_pkg.OrderList` object from the :ctype:`pkgOrderList` + Create a new :class:`apt_pkg.OrderList` object from the :c:type:`pkgOrderList` pointer given by the parameter *cpp*. If the parameter *delete* is true, the object pointed to by *cpp* will be deleted when the reference count of the returned object reaches 0. The owner must be a :class:`apt_pkg.DepCache` object. -.. cfunction:: pkgOrderList* PyOrderList_ToCpp(PyObject *object) +.. c:function:: pkgOrderList* PyOrderList_ToCpp(PyObject *object) - Return the :ctype:`pkgOrderList` pointer contained in the Python object + Return the :c:type:`pkgOrderList` pointer contained in the Python object *object*. PackageManager (pkgPackageManager) ---------------------------------- -.. cvar:: PyTypeObject PyPackageManager_Type +.. c:var:: PyTypeObject PyPackageManager_Type The type object for :class:`apt_pkg.PackageManager` objects. -.. cfunction:: int PyPackageManager_Check(PyObject *object) +.. c:function:: int PyPackageManager_Check(PyObject *object) Check that the object *object* is an :class:`apt_pkg.PackageManager` object, or a subclass thereof. -.. cfunction:: int PyPackageManager_CheckExact(PyObject *object) +.. c:function:: int PyPackageManager_CheckExact(PyObject *object) Check that the object *object* is an :class:`apt_pkg.PackageManager` object and no subclass thereof. -.. cfunction:: PyObject* PyPackageManager_FromCpp(pkgPackageManager *cpp, bool delete, PyObject *owner) +.. c:function:: PyObject* PyPackageManager_FromCpp(pkgPackageManager *cpp, bool delete, PyObject *owner) - Create a new :class:`apt_pkg.PackageManager` object from the :ctype:`pkgPackageManager` + Create a new :class:`apt_pkg.PackageManager` object from the :c:type:`pkgPackageManager` pointer given by the parameter *cpp*. If the parameter *delete* is true, the object pointed to by *cpp* will be deleted when the reference count of the returned object reaches 0. -.. cfunction:: pkgPackageManager* PyPackageManager_ToCpp(PyObject *object) +.. c:function:: pkgPackageManager* PyPackageManager_ToCpp(PyObject *object) - Return the :ctype:`pkgPackageManager` pointer contained in the Python object + Return the :c:type:`pkgPackageManager` pointer contained in the Python object *object*. Policy (pkgPolicy) ------------------ -.. cvar:: PyTypeObject PyPolicy_Type +.. c:var:: PyTypeObject PyPolicy_Type The type object for :class:`apt_pkg.Policy` objects. -.. cfunction:: int PyPolicy_Check(PyObject *object) +.. c:function:: int PyPolicy_Check(PyObject *object) Check that the object *object* is an :class:`apt_pkg.Policy` object, or a subclass thereof. -.. cfunction:: int PyPolicy_CheckExact(PyObject *object) +.. c:function:: int PyPolicy_CheckExact(PyObject *object) Check that the object *object* is an :class:`apt_pkg.Policy` object and no subclass thereof. -.. cfunction:: PyObject* PyPolicy_FromCpp(pkgPolicy *cpp, bool delete, PyObject *owner) +.. c:function:: PyObject* PyPolicy_FromCpp(pkgPolicy *cpp, bool delete, PyObject *owner) - Create a new :class:`apt_pkg.Policy` object from the :ctype:`pkgPolicy` + Create a new :class:`apt_pkg.Policy` object from the :c:type:`pkgPolicy` pointer given by the parameter *cpp*. If the parameter *delete* is true, the object pointed to by *cpp* will be deleted when the reference count of the returned object reaches 0. The parameter *owner* must be - a PyObject of the type :cdata:`PyCache_Type`. + a PyObject of the type :c:data:`PyCache_Type`. -.. cfunction:: pkgPolicy* PyPolicy_ToCpp(PyObject *object) +.. c:function:: pkgPolicy* PyPolicy_ToCpp(PyObject *object) - Return the :ctype:`pkgPolicy` pointer contained in the Python object + Return the :c:type:`pkgPolicy` pointer contained in the Python object *object*. ProblemResolver (pkgProblemResolver) -------------------------------------- -.. cvar:: PyTypeObject PyProblemResolver_Type +.. c:var:: PyTypeObject PyProblemResolver_Type The type object for :class:`apt_pkg.ProblemResolver` objects. -.. cfunction:: int PyProblemResolver_Check(PyObject *object) +.. c:function:: int PyProblemResolver_Check(PyObject *object) Check that the object *object* is an :class:`apt_pkg.ProblemResolver` object, or a subclass thereof. -.. cfunction:: int PyProblemResolver_CheckExact(PyObject *object) +.. c:function:: int PyProblemResolver_CheckExact(PyObject *object) Check that the object *object* is an :class:`apt_pkg.ProblemResolver` object and no subclass thereof. -.. cfunction:: PyObject* PyProblemResolver_FromCpp(pkgProblemResolver *cpp, bool delete, PyObject *owner) +.. c:function:: PyObject* PyProblemResolver_FromCpp(pkgProblemResolver *cpp, bool delete, PyObject *owner) - Create a new :class:`apt_pkg.ProblemResolver` object from the :ctype:`pkgProblemResolver` + Create a new :class:`apt_pkg.ProblemResolver` object from the :c:type:`pkgProblemResolver` pointer given by the parameter *cpp*. If the parameter *delete* is true, the object pointed to by *cpp* will be deleted when the reference count of the returned object reaches 0. The parameter *owner* must be - a PyObject of the type :cdata:`PyDepCache_Type`. + a PyObject of the type :c:data:`PyDepCache_Type`. -.. cfunction:: pkgProblemResolver* PyProblemResolver_ToCpp(PyObject *object) +.. c:function:: pkgProblemResolver* PyProblemResolver_ToCpp(PyObject *object) - Return the :ctype:`pkgProblemResolver` pointer contained in the Python object + Return the :c:type:`pkgProblemResolver` pointer contained in the Python object *object*. SourceList (pkgSourceList) --------------------------- -.. cvar:: PyTypeObject PySourceList_Type +.. c:var:: PyTypeObject PySourceList_Type The type object for :class:`apt_pkg.SourceList` objects. -.. cfunction:: int PySourceList_Check(PyObject *object) +.. c:function:: int PySourceList_Check(PyObject *object) Check that the object *object* is an :class:`apt_pkg.SourceList` object, or a subclass thereof. -.. cfunction:: int PySourceList_CheckExact(PyObject *object) +.. c:function:: int PySourceList_CheckExact(PyObject *object) Check that the object *object* is an :class:`apt_pkg.SourceList` object and no subclass thereof. -.. cfunction:: PyObject* PySourceList_FromCpp(pkgSourceList *cpp, bool delete, PyObject *owner) +.. c:function:: PyObject* PySourceList_FromCpp(pkgSourceList *cpp, bool delete, PyObject *owner) - Create a new :class:`apt_pkg.SourceList` object from the :ctype:`pkgSourceList` + Create a new :class:`apt_pkg.SourceList` object from the :c:type:`pkgSourceList` pointer given by the parameter *cpp*. If the parameter *delete* is true, the object pointed to by *cpp* will be deleted when the reference count of the returned object reaches 0. -.. cfunction:: pkgSourceList* PySourceList_ToCpp(PyObject *object) +.. c:function:: pkgSourceList* PySourceList_ToCpp(PyObject *object) - Return the :ctype:`pkgSourceList` pointer contained in the Python object + Return the :c:type:`pkgSourceList` pointer contained in the Python object *object*. TagFile (pkgTagFile) ---------------------------------- -.. cvar:: PyTypeObject PyTagFile_Type +.. c:var:: PyTypeObject PyTagFile_Type The type object for :class:`apt_pkg.TagFile` objects. -.. cfunction:: int PyTagFile_Check(PyObject *object) +.. c:function:: int PyTagFile_Check(PyObject *object) Check that the object *object* is an :class:`apt_pkg.TagFile` object, or a subclass thereof. -.. cfunction:: int PyTagFile_CheckExact(PyObject *object) +.. c:function:: int PyTagFile_CheckExact(PyObject *object) Check that the object *object* is an :class:`apt_pkg.TagFile` object and no subclass thereof. -.. cfunction:: PyObject* PyTagFile_FromCpp(pkgTagFile &cpp, bool delete, PyObject *owner) +.. c:function:: PyObject* PyTagFile_FromCpp(pkgTagFile &cpp, bool delete, PyObject *owner) - Create a new :class:`apt_pkg.TagFile` object from the :ctype:`pkgTagFile` + Create a new :class:`apt_pkg.TagFile` object from the :c:type:`pkgTagFile` reference given by the parameter *cpp*. If the parameter *delete* is true, *cpp* will be deleted when the reference count of the returned object reaches 0. The parameter *owner* may be any Python object. -.. cfunction:: pkgTagFile& PyTagFile_ToCpp(PyObject *object) +.. c:function:: pkgTagFile& PyTagFile_ToCpp(PyObject *object) - Return the :ctype:`pkgTagFile` reference contained in the + Return the :c:type:`pkgTagFile` reference contained in the Python object *object*. TagSection (pkgTagSection) ---------------------------------- -.. cvar:: PyTypeObject PyTagSection_Type +.. c:var:: PyTypeObject PyTagSection_Type The type object for :class:`apt_pkg.TagSection` objects. -.. cfunction:: int PyTagSection_Check(PyObject *object) +.. c:function:: int PyTagSection_Check(PyObject *object) Check that the object *object* is an :class:`apt_pkg.TagSection` object, or a subclass thereof. -.. cfunction:: int PyTagSection_CheckExact(PyObject *object) +.. c:function:: int PyTagSection_CheckExact(PyObject *object) Check that the object *object* is an :class:`apt_pkg.TagSection` object and no subclass thereof. -.. cfunction:: PyObject* PyTagSection_FromCpp(pkgTagSection &cpp, bool delete, PyObject *owner) +.. c:function:: PyObject* PyTagSection_FromCpp(pkgTagSection &cpp, bool delete, PyObject *owner) - Create a new :class:`apt_pkg.TagSection` object from the :ctype:`pkgTagSection` + Create a new :class:`apt_pkg.TagSection` object from the :c:type:`pkgTagSection` reference given by the parameter *cpp*. If the parameter *delete* is true, *cpp* will be deleted when the reference count of the returned object reaches 0. The parameter *owner* may be - a PyObject of the type :cdata:`PyTagFile_Type`. + a PyObject of the type :c:data:`PyTagFile_Type`. -.. cfunction:: pkgTagSection& PyTagSection_ToCpp(PyObject *object) +.. c:function:: pkgTagSection& PyTagSection_ToCpp(PyObject *object) - Return the :ctype:`pkgTagSection` reference contained in the + Return the :c:type:`pkgTagSection` reference contained in the Python object *object*. Version (pkgCache::VerIterator) ---------------------------------- -.. cvar:: PyTypeObject PyVersion_Type +.. c:var:: PyTypeObject PyVersion_Type The type object for :class:`apt_pkg.Version` objects. -.. cfunction:: int PyVersion_Check(PyObject *object) +.. c:function:: int PyVersion_Check(PyObject *object) Check that the object *object* is an :class:`apt_pkg.Version` object, or a subclass thereof. -.. cfunction:: int PyVersion_CheckExact(PyObject *object) +.. c:function:: int PyVersion_CheckExact(PyObject *object) Check that the object *object* is an :class:`apt_pkg.Version` object and no subclass thereof. -.. cfunction:: PyObject* PyVersion_FromCpp(pkgCache::VerIterator &cpp, bool delete, PyObject *owner) +.. c:function:: PyObject* PyVersion_FromCpp(pkgCache::VerIterator &cpp, bool delete, PyObject *owner) - Create a new :class:`apt_pkg.Version` object from the :ctype:`pkgCache::VerIterator` + Create a new :class:`apt_pkg.Version` object from the :c:type:`pkgCache::VerIterator` reference given by the parameter *cpp*. If the parameter *delete* is true, *cpp* will be deleted when the reference count of the returned object reaches 0. The parameter *owner* must be - a PyObject of the type :cdata:`PyPackage_Type`. + a PyObject of the type :c:data:`PyPackage_Type`. -.. cfunction:: pkgCache::VerIterator& PyVersion_ToCpp(PyObject *object) +.. c:function:: pkgCache::VerIterator& PyVersion_ToCpp(PyObject *object) - Return the :ctype:`pkgCache::VerIterator` reference contained in the + Return the :c:type:`pkgCache::VerIterator` reference contained in the Python object *object*. -- cgit v1.2.3 From 6e87927c689ae6d61d1658ab60d9bc67c4c44d05 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Wed, 10 Jun 2015 10:50:42 +0200 Subject: doc/source/library/apt_pkg.rst: Fix indentation Closes: #736119 --- doc/source/library/apt_pkg.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/source/library/apt_pkg.rst b/doc/source/library/apt_pkg.rst index 8faca4a4..4fc875c5 100644 --- a/doc/source/library/apt_pkg.rst +++ b/doc/source/library/apt_pkg.rst @@ -715,7 +715,7 @@ Resolving Dependencies with :class:`ProblemResolver` The version currently installed as a :class:`Version` object, or None if the package is not installed. - .. method:: get_fullname([pretty: bool = False]) -> str + .. method:: get_fullname([pretty: bool = False]) -> str Get the full name of the package, including the architecture. If *pretty* is ``True``, the architecture is omitted for native packages, @@ -723,7 +723,7 @@ Resolving Dependencies with :class:`ProblemResolver` .. versionadded:: 0.7.100.3 - .. attribute:: has_provides + .. attribute:: has_provides A boolean value determining whether the list available via the attribute :attr:`provides_list` has at least one element. This @@ -733,7 +733,7 @@ Resolving Dependencies with :class:`ProblemResolver` pkg.has_provides and not pkg.has_versions - .. attribute:: has_versions + .. attribute:: has_versions A boolean value determining whether the list available via the attribute :attr:`version_list` has at least one element. This -- cgit v1.2.3 From 47bbca79a52b04a6fed39c53b9e6a98350e95695 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Wed, 10 Jun 2015 10:52:12 +0200 Subject: sphinx docs: Fix remaining instances of old C syntax to use domains Now it really stopped complaining --- doc/source/c++/embedding.rst | 2 +- doc/source/library/apt_pkg.rst | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/source/c++/embedding.rst b/doc/source/c++/embedding.rst index 754ad398..445e9c6f 100644 --- a/doc/source/c++/embedding.rst +++ b/doc/source/c++/embedding.rst @@ -12,7 +12,7 @@ To use the python-apt C++ bindings, first include the #include Now, the module needs to be initialized. This is done by calling the function -:cfunc:`import_apt_pkg`. This function returns 0 on success and a negative +:c:func:`import_apt_pkg`. This function returns 0 on success and a negative value in case of failure:: if (import_apt_pkg() < 0) diff --git a/doc/source/library/apt_pkg.rst b/doc/source/library/apt_pkg.rst index 4fc875c5..f8ba186a 100644 --- a/doc/source/library/apt_pkg.rst +++ b/doc/source/library/apt_pkg.rst @@ -487,7 +487,7 @@ Installation ordering with :class:`OrderList` .. class:: OrderList(depcache: DepCache) - Represent a :ctype:`pkgOrderList`, used for installation + Represent a :c:type:`pkgOrderList`, used for installation ordering. This class provides several methods and attributes, is complicated and should not be used by normal programs. -- cgit v1.2.3 From 71e5ac2cc7d08de11e4adddd4f8fbd26a04cfd73 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Wed, 10 Jun 2015 11:26:51 +0200 Subject: python/cache.cc: Handle deprecation of pkgCache::PkgIterator::Section() Ignore the deprecation from the C++ compiler and generate a warning for the Python interpreter. Also, remove the section from the representation of the package. --- python/cache.cc | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/python/cache.cc b/python/cache.cc index c0f1eded..17ccc252 100644 --- a/python/cache.cc +++ b/python/cache.cc @@ -596,7 +596,16 @@ PyTypeObject PyGroupList_Type = MkGet(PackageGetName,PyString_FromString(Pkg.Name())) MkGet(PackageGetArch,PyString_FromString(Pkg.Arch())) -MkGet(PackageGetSection,Safe_FromString(Pkg.Section())) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" +static PyObject *PackageGetSection(PyObject *Self,void*) +{ + pkgCache::PkgIterator &Pkg = GetCpp(Self); + if (PyErr_WarnEx(PyExc_DeprecationWarning, "Package.section is deprecated, use Version.section instead", 1) == -1) + return NULL; + return Safe_FromString(Pkg.Section()); +} +#pragma GCC diagnostic pop MkGet(PackageGetRevDependsList,CppPyObject_NEW(Owner, &PyDependencyList_Type, Pkg.RevDependsList())) MkGet(PackageGetProvidesList,CreateProvides(Owner,Pkg.ProvidesList())) @@ -728,11 +737,8 @@ static PyGetSetDef PackageGetSet[] = { static PyObject *PackageRepr(PyObject *Self) { pkgCache::PkgIterator &Pkg = GetCpp(Self); - - return PyString_FromFormat("<%s object: name:'%s' section: " - "'%s' id:%u>", Self->ob_type->tp_name, - Pkg.Name(), (Pkg.Section() ? Pkg.Section() : ""), - Pkg->ID); + return PyString_FromFormat("<%s object: name:'%s' id:%u>", Self->ob_type->tp_name, + Pkg.Name(), Pkg->ID); } static const char *package_doc = -- cgit v1.2.3 From ab39c5fd9906b72e86b1b3dd82b7b5a476e3c4f5 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Wed, 10 Jun 2015 12:02:41 +0200 Subject: doc: Prepare for 1.0 release Change the whatsnew page to a two-component variant (1.0, so we do not get bug fix releases mixed in there, and update the pages for the changes planned for 1.0. Not all have been committed yet, though. --- doc/source/conf.py | 2 +- doc/source/library/apt_pkg.rst | 7 +++++++ doc/source/whatsnew/1.0.rst | 26 ++++++++++++++++++++++++++ 3 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 doc/source/whatsnew/1.0.rst diff --git a/doc/source/conf.py b/doc/source/conf.py index 6775269f..36d89c06 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -95,7 +95,7 @@ if int(release_raw) >= 90: version = '.'.join(version_s) del version_s else: - version = '.'.join(release.split("~")[0].split('.')[:3]) + version = '.'.join(release.split("~")[0].split('.')[:2]) del release_raw # The language for content autogenerated by Sphinx. Refer to documentation diff --git a/doc/source/library/apt_pkg.rst b/doc/source/library/apt_pkg.rst index f8ba186a..fd505b20 100644 --- a/doc/source/library/apt_pkg.rst +++ b/doc/source/library/apt_pkg.rst @@ -787,6 +787,11 @@ Resolving Dependencies with :class:`ProblemResolver` The section of the package, as specified in the record. The list of possible sections is defined in the Policy. This is a string. + .. deprecated:: 1.0 + + A package can have multiple versions with different sections, so + the section information should be accessed from the version class. + .. attribute:: version_list A list of :class:`Version` objects for all versions of this package @@ -1481,6 +1486,8 @@ Records (Release files, Packages, Sources) ``(str: md5, int: size, str: path, str:type)``, where 'type' can be 'diff' (includes .debian.tar.gz), 'dsc', 'tar'. + .. deprecated: 1.0 + .. attribute:: index A list of :class:`IndexFile` objects associated with this diff --git a/doc/source/whatsnew/1.0.rst b/doc/source/whatsnew/1.0.rst new file mode 100644 index 00000000..317410f9 --- /dev/null +++ b/doc/source/whatsnew/1.0.rst @@ -0,0 +1,26 @@ +What's New In python-apt 1.0 +============================== +Python-Apt 1.0 fixes several issues and use of deprecated methods. Most +importantly, it introduces large file support + +New features +------------ +* :class:`apt_pkg.AcquireFile` can now take a hash string that is not an + md5 value, using the new `hash` argument. + + + +Deprecated +---------- +The following features are deprecated, starting with this release: + +* The `section` member of :class:`apt_pkg.Package` +* The `files` member of of :class:`apt_pkg.SourceRecords` +* The `md5` argument to :class:`apt_pkg.AcquireFile`, it is replaced by + the `hash` argument. + +Maintenance +----------- + +* :mod:`apt_inst` now supports ar and tar archives that are larger than 4 GiB +* Various smaller bug fixes -- cgit v1.2.3 From 09a64ad2b63e5a8af386327ff741fddfb65b7f92 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Wed, 10 Jun 2015 12:50:39 +0200 Subject: TagFile: Provide close() and context manager This is mostly meant to be used with tag files that are opened with a path, rather than a file object. Closes: #748922 --- python/tag.cc | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) diff --git a/python/tag.cc b/python/tag.cc index 8fb0a78e..967eaa19 100644 --- a/python/tag.cc +++ b/python/tag.cc @@ -384,6 +384,61 @@ static PyObject *TagFileJump(PyObject *Self,PyObject *Args) return HandleErrors(PyBool_FromLong(1)); } + +static char *doc_Close = + "close()\n\n" + "Close the file."; +static PyObject *TagFileClose(PyObject *self, PyObject *args) +{ + if (args != NULL && !PyArg_ParseTuple(args, "")) + return NULL; + + TagFileData &Obj = *(TagFileData *) self; + + Obj.Fd.Close(); + + Py_INCREF(Py_None); + return HandleErrors(Py_None); +} + +static PyObject *TagFileExit(PyObject *self, PyObject *args) +{ + + PyObject *exc_type = 0; + PyObject *exc_value = 0; + PyObject *traceback = 0; + if (!PyArg_UnpackTuple(args, "__exit__", 3, 3, &exc_type, &exc_value, + &traceback)) { + return 0; + } + + PyObject *res = TagFileClose(self, NULL); + + if (res == NULL) { + // The close failed. If no exception happened within the suite, we + // will raise an error here. Otherwise, we just display the error, so + // Python can handle the original exception instead. + if (exc_type == Py_None) + return NULL; + + PyErr_WriteUnraisable(self); + } else { + Py_DECREF(res); + } + // Return False, as required by the context manager protocol. + Py_RETURN_FALSE; +} + +static PyObject *TagFileEnter(PyObject *self, PyObject *args) +{ + if (!PyArg_ParseTuple(args, "")) + return NULL; + + Py_INCREF(self); + + return self; +} + /*}}}*/ // ParseSection - Parse a single section from a tag file /*{{{*/ // --------------------------------------------------------------------- @@ -656,6 +711,9 @@ static PyMethodDef TagFileMethods[] = {"step",TagFileStep,METH_VARARGS,doc_Step}, {"offset",TagFileOffset,METH_VARARGS,doc_Offset}, {"jump",TagFileJump,METH_VARARGS,doc_Jump}, + {"close",TagFileClose,METH_VARARGS,doc_Close}, + {"__enter__",TagFileEnter,METH_VARARGS,"Context manager entry, return self."}, + {"__exit__",TagFileExit,METH_VARARGS,"Context manager exit, calls close."}, {} }; -- cgit v1.2.3 From ce554fabc7ff4dc5690cfc475dbe80882ba195ec Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Wed, 10 Jun 2015 13:13:51 +0200 Subject: doc: Document apt_pkg.TagFile additions --- doc/source/library/apt_pkg.rst | 38 ++++++++++++++++++++++++++++++-------- doc/source/whatsnew/1.0.rst | 3 ++- 2 files changed, 32 insertions(+), 9 deletions(-) diff --git a/doc/source/library/apt_pkg.rst b/doc/source/library/apt_pkg.rst index fd505b20..15316eea 100644 --- a/doc/source/library/apt_pkg.rst +++ b/doc/source/library/apt_pkg.rst @@ -1916,16 +1916,38 @@ section as a string. .. class:: TagFile(file, bytes: bool = False) An object which represents a typical debian control file. Can be used for - Packages, Sources, control, Release, etc. Such an object provides two - kinds of API which should not be used together: + Packages, Sources, control, Release, etc. + + The *file* argument shall be a path name or an open file object. The + argument *bytes* specifies whether the file shall be represented using + bytes (``True``) or unicode (``False``) strings. + + It is a context manager that can be used with a with statement or the + :meth:`close` method. + + .. describe:: with TagFile(...) as ...: + + Use the :class:`TagFile` as a context manager. This will automatically + close the file after the body finished execution. + + .. versionadded:: 1.0 + + .. method:: close() + + Close the file. It's recommended to use the context manager + instead (that is, the `with` statement). + + .. versionadded:: 1.0 + + It provides two kinds of API which should not be used together: The first API implements the iterator protocol and should be used whenever possible because it has less side effects than the other one. It may be used e.g. with a for loop:: - tagf = apt_pkg.TagFile(open('/var/lib/dpkg/status')) - for section in tagfile: - print section['Package'] + with apt_pkg.TagFile('/var/lib/dpkg/status') as tagfile: + for section in tagfile: + print section['Package'] .. versionchanged:: 0.7.100 Added support for using gzip files, via :class:`gzip.GzipFile` or any @@ -1951,9 +1973,9 @@ section as a string. use less memory, but is not recommended because it works by modifying one object. It can be used like this:: - tagf = apt_pkg.TagFile(open('/var/lib/dpkg/status')) - tagf.step() - print tagf.section['Package'] + with apt_pkg.TagFile('/var/lib/dpkg/status') as tagf: + tagf.step() + print tagf.section['Package'] .. method:: step() -> bool diff --git a/doc/source/whatsnew/1.0.rst b/doc/source/whatsnew/1.0.rst index 317410f9..7c5951fe 100644 --- a/doc/source/whatsnew/1.0.rst +++ b/doc/source/whatsnew/1.0.rst @@ -7,7 +7,8 @@ New features ------------ * :class:`apt_pkg.AcquireFile` can now take a hash string that is not an md5 value, using the new `hash` argument. - +* A new a :meth:`apt_pkg.TagFile.close` method was added +* :class:`apt_pkg.TagFile` is now a context manager Deprecated -- cgit v1.2.3 From bcdfdaca4e1e14fec5130ed1ef671e93d89cf624 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Wed, 10 Jun 2015 13:54:46 +0200 Subject: doc: templates: layout: Remove invalid icon links Those came from the (public-domain) Python documentation source code. Git-dch: ignore --- doc/source/templates/layout.html | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/doc/source/templates/layout.html b/doc/source/templates/layout.html index 60298719..cf8748a3 100644 --- a/doc/source/templates/layout.html +++ b/doc/source/templates/layout.html @@ -1,10 +1,4 @@ {% extends "!layout.html" %} {% block rootrellink %} -
  • -
  • {{ shorttitle }}{{ reldelim1 }}
  • -{% endblock %} -{% block extrahead %} - -{{ super() }} +
  • {{ shorttitle }}XX{{ reldelim1 }}
  • {% endblock %} -- cgit v1.2.3 From 412b43e873346292543b6401664f4923220f07c1 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Wed, 10 Jun 2015 13:56:12 +0200 Subject: doc: templates: layout: Fixup last commit Gbp-Dch: ignore --- doc/source/templates/layout.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/source/templates/layout.html b/doc/source/templates/layout.html index cf8748a3..04a3e0d4 100644 --- a/doc/source/templates/layout.html +++ b/doc/source/templates/layout.html @@ -1,4 +1,4 @@ {% extends "!layout.html" %} {% block rootrellink %} -
  • {{ shorttitle }}XX{{ reldelim1 }}
  • +
  • {{ shorttitle }}{{ reldelim1 }}
  • {% endblock %} -- cgit v1.2.3 From 3ee219a9e8937bdc382be5493cd9a53df0142005 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Wed, 10 Jun 2015 13:57:38 +0200 Subject: doc: templates: indexcontent: Fix link from modindex to py-modindex This seems to have changed in recent sphinx versions. Gbp-Dch: ignore --- doc/source/templates/indexcontent.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/source/templates/indexcontent.html b/doc/source/templates/indexcontent.html index 394b46d5..b1395816 100644 --- a/doc/source/templates/indexcontent.html +++ b/doc/source/templates/indexcontent.html @@ -35,7 +35,7 @@

    Indices and tables:

    - -- cgit v1.2.3 From 5ffc7aaf787c74aaa193139e0efcf2a8856bdf98 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Wed, 10 Jun 2015 14:01:47 +0200 Subject: debian/control: Build-Depend on dh-python dh_python2 complained about it --- debian/control | 1 + 1 file changed, 1 insertion(+) diff --git a/debian/control b/debian/control index 38065c21..b65078a2 100644 --- a/debian/control +++ b/debian/control @@ -9,6 +9,7 @@ X-Python3-Version: >= 3.3 Build-Depends: apt (>= 0.9.6), apt-utils, debhelper (>= 9), + dh-python, fakeroot, libapt-pkg-dev (>= 1.0.4~), python-all-dev (>= 2.7), -- cgit v1.2.3 From 91e4be065371c1fb6aa224eb180155e312cb1750 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Wed, 10 Jun 2015 14:18:19 +0200 Subject: Do not link documentation from Architecture: all to Architecture: any This was breaking binNMUs. --- debian/rules | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/debian/rules b/debian/rules index 20a3fa25..abf92519 100755 --- a/debian/rules +++ b/debian/rules @@ -32,9 +32,9 @@ override_dh_installdocs: dh_installdirs -ppython-apt-doc usr/share/doc/python-apt; \ fi dh_installdirs -ppython-apt-dev usr/share/doc/python-apt - dh_installdocs -Npython-apt-common -Npython3-apt -Npython3-apt-dbg --link-doc=python-apt + dh_installdocs -p python-apt -p python-apt-dbg --link-doc=python-apt dh_installdocs -p python3-apt -p python3-apt-dbg --link-doc=python3-apt - dh_installdocs -p python-apt-common + dh_installdocs --remaining-packages override_dh_strip: dh_strip -p python-apt --dbg-package=python-apt-dbg -- cgit v1.2.3 From 6b404429b1a194acac8627294e5cc5bd826d6167 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Wed, 10 Jun 2015 14:31:01 +0200 Subject: Use ${python:Depends} and friends for the debug packages dpkg-gencontrol was unhappy. Now he's only unhappy about ${python:Versions} and ${python3:Versions}, but I do not think they should be used anymore. --- debian/control | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/debian/control b/debian/control index b65078a2..6d8a71ac 100644 --- a/debian/control +++ b/debian/control @@ -91,8 +91,9 @@ Priority: extra Architecture: any Multi-Arch: allowed Section: debug -Depends: python-dbg, python-apt (= ${binary:Version}), ${shlibs:Depends}, +Depends: ${python:Depends}, python-apt (= ${binary:Version}), ${shlibs:Depends}, ${misc:Depends} +Provides: ${python:Provides} Description: Python interface to libapt-pkg (debug extension) The apt_pkg Python interface will provide full access to the internal libapt-pkg structures allowing Python programs to easily perform a @@ -158,8 +159,9 @@ Multi-Arch: allowed Section: debug Breaks: python-apt (<< 0.7.98+nmu1) Replaces: python-apt (<< 0.7.98+nmu1) -Depends: python3-dbg, python3-apt (= ${binary:Version}), ${shlibs:Depends}, +Depends: ${python3:Depends}, python3-apt (= ${binary:Version}), ${shlibs:Depends}, ${misc:Depends} +Provides: ${python3:Provides} Description: Python 3 interface to libapt-pkg (debug extension) The apt_pkg Python 3 interface will provide full access to the internal libapt-pkg structures allowing Python 3 programs to easily perform a -- cgit v1.2.3 From 54fb38040f5f314cac9f075685f7e3d77423b7e6 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Wed, 10 Jun 2015 14:47:15 +0200 Subject: python-apt-doc: Remove the old examples and html directory before upgrade This somehow has to be done here, otherwise dpkg complains. Gbp-Dch: ignore --- debian/python-apt-doc.preinst | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100755 debian/python-apt-doc.preinst diff --git a/debian/python-apt-doc.preinst b/debian/python-apt-doc.preinst new file mode 100755 index 00000000..2c467dd2 --- /dev/null +++ b/debian/python-apt-doc.preinst @@ -0,0 +1,16 @@ +#!/bin/sh + +set -e + +# Remove files that remained +if [ "$1" = "upgrade" ]; then + if test -d /usr/share/doc/python-apt/html; then + rm -r /usr/share/doc/python-apt/html + fi + + if test -d /usr/share/doc/python-apt/examples; then + rm -r /usr/share/doc/python-apt/examples + fi +fi + +#DEBHELPER# -- cgit v1.2.3 From 4f34ca7de1defc09b119565a35b71e4cca919346 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Wed, 10 Jun 2015 15:23:14 +0200 Subject: apt.debfile: Fix splitting of multi-lines Binary fields in dsc files In a multi-line field, a comma might be followed by a newline instead of a space. Closes: #751770 --- apt/debfile.py | 2 +- tests/data/test_debs/hello_2.5-1.dsc | 3 ++- tests/test_debfile.py | 4 ++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/apt/debfile.py b/apt/debfile.py index 20cf563c..440f9532 100644 --- a/apt/debfile.py +++ b/apt/debfile.py @@ -735,7 +735,7 @@ class DscSrcPackage(DebPackage): if 'Source' in sec: self.pkgname = sec['Source'] if 'Binary' in sec: - self.binaries = sec['Binary'].split(', ') + self.binaries = [b.strip() for b in sec['Binary'].split(',')] for tag in sec.keys(): if tag in sec: self._sections[tag] = sec[tag] diff --git a/tests/data/test_debs/hello_2.5-1.dsc b/tests/data/test_debs/hello_2.5-1.dsc index c079f2d3..d00db522 100644 --- a/tests/data/test_debs/hello_2.5-1.dsc +++ b/tests/data/test_debs/hello_2.5-1.dsc @@ -3,7 +3,8 @@ Hash: SHA256 Format: 1.0 Source: hello -Binary: hello +Binary: hello, bello, + cello Architecture: any Version: 2.5-1 Maintainer: Santiago Vila diff --git a/tests/test_debfile.py b/tests/test_debfile.py index b8418e78..eae8038f 100644 --- a/tests/test_debfile.py +++ b/tests/test_debfile.py @@ -71,14 +71,14 @@ class TestDebfile(unittest.TestCase): self.assertEqual(set(deb.missing_deps), missing) # specialized properties self.assertEqual(deb.pkgname, "hello") - self.assertEqual(deb.binaries, ["hello"]) + self.assertEqual(deb.binaries, ["hello", "bello", "cello"]) self.assertEqual(deb.filelist, ["hello_2.5.orig.tar.gz", "hello_2.5-1.diff.gz"]) self.assertEqual(deb.depends, [[("autotools-dev", "", "")]]) # tag fields are available as a dict self.assertEqual(deb["Format"], "1.0") self.assertEqual(deb["Source"], "hello") - self.assertEqual(deb["Binary"], "hello") + self.assertEqual(deb["Binary"], "hello, bello,\n cello") self.assertEqual(deb["Architecture"], "any") self.assertEqual(deb["Version"], "2.5-1") self.assertEqual( -- cgit v1.2.3 From b263b8d1a6a84bd34290a1ae52d3c1ee33124d1b Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Wed, 10 Jun 2015 15:34:56 +0200 Subject: Remove apt.progress.gtk2 --- apt/progress/__init__.py | 4 +- apt/progress/gtk2.py | 438 ------------------------------- debian/control | 2 +- doc/examples/gui-inst.py | 27 -- doc/source/examples/apt-gtk.py | 29 -- doc/source/library/apt.progress.gtk2.rst | 131 --------- doc/source/library/apt_pkg.rst | 3 +- doc/source/library/index.rst | 3 +- doc/source/whatsnew/1.0.rst | 10 + 9 files changed, 15 insertions(+), 632 deletions(-) delete mode 100644 apt/progress/gtk2.py delete mode 100755 doc/examples/gui-inst.py delete mode 100644 doc/source/examples/apt-gtk.py delete mode 100644 doc/source/library/apt.progress.gtk2.rst diff --git a/apt/progress/__init__.py b/apt/progress/__init__.py index c689de5c..1ae94d06 100644 --- a/apt/progress/__init__.py +++ b/apt/progress/__init__.py @@ -19,8 +19,8 @@ """Progress reporting. This package provides progress reporting for the python-apt package. The module -'base' provides classes with no output, the module 'gtk2' provides classes for -GTK+ applications, and the module 'text' provides classes for terminals, etc. +'base' provides classes with no output, and the module 'text' provides classes +for terminals, etc. """ from __future__ import print_function diff --git a/apt/progress/gtk2.py b/apt/progress/gtk2.py deleted file mode 100644 index 7d142399..00000000 --- a/apt/progress/gtk2.py +++ /dev/null @@ -1,438 +0,0 @@ -#!/usr/bin/env python -# -# Copyright (c) 2004-2009 Canonical -# -# Authors: Michael Vogt -# Sebastian Heinlein -# Julian Andres Klode -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -# USA -"""GObject-powered progress classes and a GTK+ status widget.""" - -from __future__ import print_function - -import pygtk -pygtk.require('2.0') -import gtk -try: - import glib - glib # pyflakes -except ImportError: - import gobject as glib -import gobject -import pango -import time -import vte - -import apt_pkg -from apt_pkg import gettext as _ -from apt.progress import base - - -__all__ = ['GAcquireProgress', 'GInstallProgress', 'GOpProgress', - 'GtkAptProgress'] - - -def mksig(params=(), run=gobject.SIGNAL_RUN_FIRST, rettype=gobject.TYPE_NONE): - """Simplified Create a gobject signal. - - This allows us to write signals easier, because we just need to define the - type of the parameters (in most cases). - - ``params`` is a tuple which defines the types of the arguments. - """ - return (run, rettype, params) - - -class GOpProgress(gobject.GObject, base.OpProgress): - """Operation progress with GObject signals. - - Signals: - - * status-changed(str: operation, int: percent) - * status-started() - Not Implemented yet - * status-finished() - - """ - - __gsignals__ = {"status-changed": mksig((str, int)), - "status-started": mksig(), - "status-finished": mksig()} - - def __init__(self): - base.OpProgress.__init__(self) - gobject.GObject.__init__(self) - self._context = glib.main_context_default() - - def update(self, percent=None): - """Called to update the percentage done""" - base.OpProgress.update(self, percent) - self.emit("status-changed", self.op, self.percent) - while self._context.pending(): - self._context.iteration() - - def done(self): - """Called when all operation have finished.""" - base.OpProgress.done(self) - self.emit("status-finished") - - -class GInstallProgress(gobject.GObject, base.InstallProgress): - """Installation progress with GObject signals. - - Signals: - - * status-changed(str: status, int: percent) - * status-started() - * status-finished() - * status-timeout() - * status-error() - * status-conffile() - - """ - # Seconds until a maintainer script will be regarded as hanging - INSTALL_TIMEOUT = 5 * 60 - - __gsignals__ = {"status-changed": mksig((str, int)), - "status-started": mksig(), - "status-timeout": mksig(), - "status-error": mksig(), - "status-conffile": mksig(), - "status-finished": mksig()} - - def __init__(self, term): - base.InstallProgress.__init__(self) - gobject.GObject.__init__(self) - self.finished = False - self.apt_status = -1 - self.time_last_update = time.time() - self.term = term - self.term.connect("child-exited", self.child_exited) - self.env = ["VTE_PTY_KEEP_FD=%s" % self.writefd, - "DEBIAN_FRONTEND=gnome", - "APT_LISTCHANGES_FRONTEND=gtk"] - self._context = glib.main_context_default() - - def child_exited(self, term): - """Called when a child process exits""" - self.apt_status = term.get_child_exit_status() - self.finished = True - - def error(self, pkg, errormsg): - """Called when an error happens. - - Emits: status-error() - """ - self.emit("status-error") - - def conffile(self, current, new): - """Called during conffile. - - Emits: status-conffile() - """ - self.emit("status-conffile") - - def start_update(self): - """Called when the update starts. - - Emits: status-started() - """ - self.emit("status-started") - - def run(self, obj): - """Run.""" - self.finished = False - return base.InstallProgress.run(self, obj) - - def finish_update(self): - """Called when the update finished. - - Emits: status-finished() - """ - self.emit("status-finished") - - def processing(self, pkg, stage): - """Called when entering a new stage in dpkg.""" - # We have no percentage or alike, send -1 to let the bar pulse. - self.emit("status-changed", ("Installing %s...") % pkg, -1) - - def status_change(self, pkg, percent, status): - """Called when the status changed. - - Emits: status-changed(status, percent) - """ - self.time_last_update = time.time() - self.emit("status-changed", status, percent) - - def update_interface(self): - """Called periodically to update the interface. - - Emits: status-timeout() [When a timeout happens] - """ - base.InstallProgress.update_interface(self) - while self._context.pending(): - self._context.iteration() - if self.time_last_update + self.INSTALL_TIMEOUT < time.time(): - self.emit("status-timeout") - - def fork(self): - """Fork the process.""" - return self.term.forkpty(envv=self.env) - - def wait_child(self): - """Wait for the child process to exit.""" - while not self.finished: - self.update_interface() - time.sleep(0.02) - return self.apt_status - - -GDpkgInstallProgress = GInstallProgress - - -class GAcquireProgress(gobject.GObject, base.AcquireProgress): - """A Fetch Progress with GObject signals. - - Signals: - - * status-changed(str: description, int: percent) - * status-started() - * status-finished() - - DEPRECATED. - """ - - __gsignals__ = {"status-changed": mksig((str, int)), - "status-started": mksig(), - "status-finished": mksig()} - - def __init__(self): - base.AcquireProgress.__init__(self) - gobject.GObject.__init__(self) - self._continue = True - self._context = glib.main_context_default() - - def start(self): - base.AcquireProgress.start(self) - self.emit("status-started") - - def stop(self): - base.AcquireProgress.stop(self) - self.emit("status-finished") - - def cancel(self): - self._continue = False - - def pulse(self, owner): - base.AcquireProgress.pulse(self, owner) - current_item = self.current_items + 1 - if current_item > self.total_items: - current_item = self.total_items - if self.current_cps > 0: - text = (_("Downloading file %(current)li of %(total)li with " - "%(speed)s/s") % - {"current": current_item, - "total": self.total_items, - "speed": apt_pkg.size_to_str(self.current_cps)}) - else: - text = (_("Downloading file %(current)li of %(total)li") % - {"current": current_item, - "total": self.total_items}) - - percent = (((self.current_bytes + self.current_items) * 100.0) / - float(self.total_bytes + self.total_items)) - self.emit("status-changed", text, percent) - while self._context.pending(): - self._context.iteration() - return self._continue - - -class GtkAptProgress(gtk.VBox): - """Graphical progress for installation/fetch/operations. - - This widget provides a progress bar, a terminal and a status bar for - showing the progress of package manipulation tasks. - """ - - def __init__(self): - gtk.VBox.__init__(self) - self.set_spacing(6) - # Setup some child widgets - self._expander = gtk.Expander(_("Details")) - self._terminal = vte.Terminal() - #self._terminal.set_font_from_string("monospace 10") - self._expander.add(self._terminal) - self._progressbar = gtk.ProgressBar() - # Setup the always italic status label - self._label = gtk.Label() - attr_list = pango.AttrList() - attr_list.insert(pango.AttrStyle(pango.STYLE_ITALIC, 0, -1)) - self._label.set_attributes(attr_list) - self._label.set_ellipsize(pango.ELLIPSIZE_END) - self._label.set_alignment(0, 0) - # add child widgets - self.pack_start(self._progressbar, False) - self.pack_start(self._label, False) - self.pack_start(self._expander, False) - # Setup the internal progress handlers - self._progress_open = GOpProgress() - self._progress_open.connect("status-changed", self._on_status_changed) - self._progress_open.connect("status-started", self._on_status_started) - self._progress_open.connect("status-finished", - self._on_status_finished) - self._progress_acquire = GAcquireProgress() - self._progress_acquire.connect("status-changed", - self._on_status_changed) - self._progress_acquire.connect("status-started", - self._on_status_started) - self._progress_acquire.connect("status-finished", - self._on_status_finished) - - self._progress_fetch = None - self._progress_install = GInstallProgress(self._terminal) - self._progress_install.connect("status-changed", - self._on_status_changed) - self._progress_install.connect("status-started", - self._on_status_started) - self._progress_install.connect("status-finished", - self._on_status_finished) - self._progress_install.connect("status-timeout", - self._on_status_timeout) - self._progress_install.connect("status-error", - self._on_status_timeout) - self._progress_install.connect("status-conffile", - self._on_status_timeout) - - def clear(self): - """Reset all status information.""" - self._label.set_label("") - self._progressbar.set_fraction(0) - self._expander.set_expanded(False) - - @property - def open(self): - """Return the cache opening progress handler.""" - return self._progress_open - - @property - def install(self): - """Return the install progress handler.""" - return self._progress_install - - @property - def dpkg_install(self): - """Return the install progress handler for dpkg.""" - return self._progress_install - - @property - def acquire(self): - """Return the acquire progress handler.""" - return self._progress_acquire - - def _on_status_started(self, progress): - """Called when something starts.""" - self._on_status_changed(progress, _("Starting..."), 0) - while gtk.events_pending(): - gtk.main_iteration() - - def _on_status_finished(self, progress): - """Called when something finished.""" - self._on_status_changed(progress, _("Complete"), 100) - while gtk.events_pending(): - gtk.main_iteration() - - def _on_status_changed(self, progress, status, percent): - """Called when the status changed.""" - self._label.set_text(status) - if percent is None or percent == -1: - self._progressbar.pulse() - else: - self._progressbar.set_fraction(percent / 100.0) - while gtk.events_pending(): - gtk.main_iteration() - - def _on_status_timeout(self, progress): - """Called when timeout happens.""" - self._expander.set_expanded(True) - while gtk.events_pending(): - gtk.main_iteration() - - def cancel_download(self): - """Cancel a currently running download.""" - self._progress_fetch.cancel() - - def show_terminal(self, expanded=False): - """Show the expander for the terminal. - - Show an expander with a terminal widget which provides a way - to interact with dpkg - """ - self._expander.show() - self._terminal.show() - self._expander.set_expanded(expanded) - while gtk.events_pending(): - gtk.main_iteration() - - def hide_terminal(self): - """Hide the expander with the terminal widget.""" - self._expander.hide() - while gtk.events_pending(): - gtk.main_iteration() - - def show(self): - """Show the Box""" - gtk.HBox.show(self) - self._label.show() - self._progressbar.show() - while gtk.events_pending(): - gtk.main_iteration() - - -def _test(): - """Test function""" - import sys - - import apt - from apt.debfile import DebPackage - - win = gtk.Window() - apt_progress = GtkAptProgress() - win.set_title("GtkAptProgress Demo") - win.add(apt_progress) - apt_progress.show() - win.show() - cache = apt.cache.Cache(apt_progress.open) - pkg = cache["xterm"] - if pkg.is_installed: - pkg.mark_delete() - else: - pkg.mark_install() - apt_progress.show_terminal(True) - try: - cache.commit(apt_progress.acquire, apt_progress.install) - except Exception as exc: - print("Exception happened:", exc, file=sys.stderr) - if len(sys.argv) > 1: - deb = DebPackage(sys.argv[1], cache) - deb.install(apt_progress.dpkg_install) - win.connect("destroy", gtk.main_quit) - gtk.main() - - -if __name__ == "__main__": - _test() - -# vim: ts=4 et sts=4 diff --git a/debian/control b/debian/control index 6d8a71ac..13e487fb 100644 --- a/debian/control +++ b/debian/control @@ -58,7 +58,7 @@ Breaks: packagekit-backend-apt (<= 0.4.8-0ubuntu4), update-notifier (<< 0.99.3debian9), wajig (<< 2.0.46) Provides: ${python:Provides} -Suggests: python-apt-dbg, python-gtk2, python-vte, python-apt-doc +Suggests: python-apt-dbg, python-apt-doc Description: Python interface to libapt-pkg The apt_pkg Python interface will provide full access to the internal libapt-pkg structures allowing Python programs to easily perform a diff --git a/doc/examples/gui-inst.py b/doc/examples/gui-inst.py deleted file mode 100755 index 654f3794..00000000 --- a/doc/examples/gui-inst.py +++ /dev/null @@ -1,27 +0,0 @@ -#!/usr/bin/python -# example how to install in a custom terminal widget -# see also gnome bug: #169201 -import pygtk -pygtk.require('2.0') -import gtk - -import apt.progress.gtk2 - - -if __name__ == "__main__": - - win = gtk.Window() - progress = apt.progress.gtk2.GtkAptProgress() - win.set_title("GtkAptProgress Demo") - win.add(progress) - progress.show() - win.show() - - cache = apt.cache.Cache(progress.open) - if cache["2vcard"].is_installed: - cache["2vcard"].mark_delete() - else: - cache["2vcard"].mark_install() - progress.show_terminal(expanded=True) - cache.commit(progress.fetch, progress.install) - gtk.main() diff --git a/doc/source/examples/apt-gtk.py b/doc/source/examples/apt-gtk.py deleted file mode 100644 index ad46454e..00000000 --- a/doc/source/examples/apt-gtk.py +++ /dev/null @@ -1,29 +0,0 @@ -#!/usr/bin/python -"""Example for gtk widgets""" -import pygtk -pygtk.require("2.0") -import gtk - -import apt.progress.gtk2 - - -def main(): - """Main function.""" - win = gtk.Window() - win.connect("destroy", gtk.main_quit) - progress = apt.progress.gtk2.GtkAptProgress() - win.set_title("GtkAptProgress Demo") - win.add(progress) - progress.show() - win.show() - cache = apt.cache.Cache(progress.open) - if cache["xterm"].is_installed: - cache["xterm"].mark_delete() - else: - cache["xterm"].mark_install() - progress.show_terminal(expanded=True) - cache.commit(progress.fetch, progress.install) - gtk.main() - -if __name__ == "__main__": - main() diff --git a/doc/source/library/apt.progress.gtk2.rst b/doc/source/library/apt.progress.gtk2.rst deleted file mode 100644 index 0d53ad41..00000000 --- a/doc/source/library/apt.progress.gtk2.rst +++ /dev/null @@ -1,131 +0,0 @@ -:mod:`apt.progress.gtk2` --- Progress reporting for GTK+ interfaces -=================================================================== -.. module:: apt.progress.gtk2 - -The :mod:`apt.progress.gtk2` module provides classes with GObject signals and -a class with a GTK+ widget for progress handling. - - -GObject progress classes -------------------------- -.. class:: GInstallProgress - - An implementation of :class:`apt.progress.base.InstallProgress` supporting - GObject signals. The class emits the following signals: - - .. describe:: status-changed(status: str, percent: int) - - Emitted when the status of an operation changed. - - .. describe:: status-started() - - Emitted when the installation started. - - .. describe:: status-finished() - - Emitted when the installation finished. - - .. describe:: status-timeout() - - Emitted when a timeout happens - - .. describe:: status-error() - - Emitted in case of an error. - - .. describe:: status-conffile() - - Emitted when a conffile update is happening. - - -.. class:: GAcquireProgress - - An implementation of :class:`apt.progress.base.AcquireProgress` supporting - GObject signals. The class emits the following signals: - - .. describe:: status-changed(description: str, percent: int) - - Emitted when the status of the fetcher changed, e.g. when the - percentage increased. - - .. describe:: status-started() - - Emitted when the fetcher starts to fetch. - - .. describe:: status-finished() - - Emitted when the fetcher finished. - - -.. class:: GDpkgInstallProgress - - An implementation of :class:`apt.progress.base.InstallProgress` supporting - GObject signals. This is the same as :class:`GInstallProgress` and is thus - completely deprecated. - -.. class:: GOpProgress - - An implementation of :class:`apt.progress.old.FetchProgress` supporting - GObject signals. The class emits the following signals: - - .. describe:: status-changed(operation: str, percent: int) - - Emitted when the status of an operation changed. - - .. describe:: status-started() - - Emitted when it starts - Not implemented yet. - - .. describe:: status-finished() - - Emitted when all operations have finished. - -GTK+ Widget ------------ -.. class:: GtkAptProgress - - Graphical progress for installation/fetch/operations, providing - a progress bar, a terminal and a status bar for showing the progress - of package manipulation tasks. - - .. method:: cancel_download() - - Cancel a currently running download. - - .. method:: clear() - - Reset all status information. - - .. attribute:: dpkg_install - - Return the install progress handler for dpkg. - - .. attribute:: fetch - - Return the fetch progress handler. - - .. method:: hide_terminal() - - Hide the expander with the terminal widget. - - .. attribute:: install - - Return the install progress handler. - - .. attribute:: open - - Return the cache opening progress handler. - - .. method:: show() - - Show the Box - - .. method:: show_terminal(expanded=False) - - Show an expander with a terminal widget which provides a way to - interact with dpkg. - - -Example -------- -.. literalinclude:: ../examples/apt-gtk.py diff --git a/doc/source/library/apt_pkg.rst b/doc/source/library/apt_pkg.rst index 15316eea..bdf096a4 100644 --- a/doc/source/library/apt_pkg.rst +++ b/doc/source/library/apt_pkg.rst @@ -1541,8 +1541,7 @@ installation. The constructor takes an optional parameter *progress* which takes an :class:`apt.progress.base.AcquireProgress` object. This object may then report progress information (see :mod:`apt.progress.text` for reporting - progress to a I/O stream and :mod:`apt.progress.gtk2` for GTK+ progress - reporting). + progress to a I/O stream). Acquire items have two methods to start and stop the fetching: diff --git a/doc/source/library/index.rst b/doc/source/library/index.rst index dbd58375..0b048c80 100644 --- a/doc/source/library/index.rst +++ b/doc/source/library/index.rst @@ -12,7 +12,7 @@ apt-pkg and apt-inst libraries and the base for the rest of python-apt. Going forward, the :mod:`apt` package appears. This package is using :mod:`apt_pkg` and :mod:`apt_inst` to provide easy to use ways to manipulate the cache, fetch packages, or install new packages. It also provides useful -progress classes, for text and GTK+ interfaces. The last package is +progress classes, currently only for text interfaces. The last package is :mod:`aptsources`. The aptsources package provides classes and functions to read files like :file:`/etc/apt/sources.list` and to modify them. @@ -28,7 +28,6 @@ read files like :file:`/etc/apt/sources.list` and to modify them. apt.package apt.progress.base apt.progress.text - apt.progress.gtk2 aptsources.distinfo aptsources.distro diff --git a/doc/source/whatsnew/1.0.rst b/doc/source/whatsnew/1.0.rst index 7c5951fe..bc022463 100644 --- a/doc/source/whatsnew/1.0.rst +++ b/doc/source/whatsnew/1.0.rst @@ -20,6 +20,16 @@ The following features are deprecated, starting with this release: * The `md5` argument to :class:`apt_pkg.AcquireFile`, it is replaced by the `hash` argument. +Removed +------- +* The module :mod:`apt.progress.gtk2' has been removed. There were no + users in the Debian archive, its last update was in 2013, and it was buggy + already. Apart from that, it suggested that it is OK to run a graphical + application as root, and used the unmaintained GTK+ 2 version. + + Therefore, there is no replacement, please use PackageKit or aptdaemon + for installation in graphical environments. + Maintenance ----------- -- cgit v1.2.3 From ce08058eebc60536cc8088ee79efc80a40f13c9e Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Wed, 10 Jun 2015 15:37:16 +0200 Subject: apt_pkg.Package: Drop the unset 'auto' attribute If somebody uses that, it could assume that no package is auto removable, because the attribute is always 0. So let's just remove that instead of having crazy code working the way it's not intended. Closes: #565364 --- doc/source/library/apt_pkg.rst | 7 ------- doc/source/whatsnew/1.0.rst | 2 ++ python/cache.cc | 4 ---- 3 files changed, 2 insertions(+), 11 deletions(-) diff --git a/doc/source/library/apt_pkg.rst b/doc/source/library/apt_pkg.rst index bdf096a4..5ccb93ae 100644 --- a/doc/source/library/apt_pkg.rst +++ b/doc/source/library/apt_pkg.rst @@ -820,13 +820,6 @@ Resolving Dependencies with :class:`ProblemResolver` **Flags**: - .. attribute:: auto - - This flag is here for compatibility purposes and does not appear to - be used anymore in APT. To find out whether a package is marked as - automatically installed, use :meth:`DepCache.is_auto_installed` - instead. - .. attribute:: essential Whether the package has the 'Essential' flag set; that is, diff --git a/doc/source/whatsnew/1.0.rst b/doc/source/whatsnew/1.0.rst index bc022463..5fa92ece 100644 --- a/doc/source/whatsnew/1.0.rst +++ b/doc/source/whatsnew/1.0.rst @@ -29,6 +29,8 @@ Removed Therefore, there is no replacement, please use PackageKit or aptdaemon for installation in graphical environments. +* The attribute :attr:`apt_pkg.Package.auto` was not set anymore, and thus + removed. Maintenance ----------- diff --git a/python/cache.cc b/python/cache.cc index 17ccc252..e03462a5 100644 --- a/python/cache.cc +++ b/python/cache.cc @@ -614,7 +614,6 @@ MkGet(PackageGetInstState,MkPyNumber(Pkg->InstState)) MkGet(PackageGetCurrentState,MkPyNumber(Pkg->CurrentState)) MkGet(PackageGetID,MkPyNumber(Pkg->ID)) # -MkGet(PackageGetAuto,PyBool_FromLong((Pkg->Flags & pkgCache::Flag::Auto) != 0)) MkGet(PackageGetEssential,PyBool_FromLong((Pkg->Flags & pkgCache::Flag::Essential) != 0)) MkGet(PackageGetImportant,PyBool_FromLong((Pkg->Flags & pkgCache::Flag::Important) != 0)) #undef MkGet @@ -715,9 +714,6 @@ static PyGetSetDef PackageGetSet[] = { "CURSTATE_UNPACKED of the apt_pkg module."}, {"id",PackageGetID,0, "The numeric ID of the package"}, - {"auto",PackageGetAuto,0, - "Ignore it, it does nothing. You want to use\n" - "DepCache.is_auto_installed instead."}, {"essential",PackageGetEssential,0, "Boolean value determining whether the package is essential."}, {"important",PackageGetImportant,0, -- cgit v1.2.3 From 01b73158bc20096a9602068aa724b9bd4528a77b Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Wed, 10 Jun 2015 15:57:13 +0200 Subject: Update POTFILES.in and the pot --- po/POTFILES.in | 1 - po/python-apt.pot | 203 +++++++++++++++++++++++++++--------------------------- 2 files changed, 100 insertions(+), 104 deletions(-) diff --git a/po/POTFILES.in b/po/POTFILES.in index a3c54e3c..eb91d526 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -2,7 +2,6 @@ [type: gettext/rfc822deb] data/templates/Ubuntu.info.in [type: gettext/rfc822deb] data/templates/Debian.info.in aptsources/distro.py -apt/progress/gtk2.py apt/package.py apt/debfile.py apt/progress/text.py diff --git a/po/python-apt.pot b/po/python-apt.pot index 7ff9675e..dab57174 100644 --- a/po/python-apt.pot +++ b/po/python-apt.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2014-10-14 21:31+0200\n" +"POT-Creation-Date: 2015-06-10 15:57+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -30,376 +30,396 @@ msgstr "" #. Description #: ../data/templates/Ubuntu.info.in:140 -msgid "Ubuntu 14.10 'Utopic Unicorn'" +msgid "Ubuntu 15.10 'Wily Werewolf'" msgstr "" #. Description #: ../data/templates/Ubuntu.info.in:147 +msgid "Cdrom with Ubuntu 15.10 'Wily Werewolf'" +msgstr "" + +#. Description +#: ../data/templates/Ubuntu.info.in:249 +msgid "Ubuntu 15.04 'Vivid Vervet'" +msgstr "" + +#. Description +#: ../data/templates/Ubuntu.info.in:256 +msgid "Cdrom with Ubuntu 15.04 'Vivid Vervet'" +msgstr "" + +#. Description +#: ../data/templates/Ubuntu.info.in:368 +msgid "Ubuntu 14.10 'Utopic Unicorn'" +msgstr "" + +#. Description +#: ../data/templates/Ubuntu.info.in:375 msgid "Cdrom with Ubuntu 14.10 'Utopic Unicorn'" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:259 +#: ../data/templates/Ubuntu.info.in:487 msgid "Ubuntu 14.04 'Trusty Tahr'" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:266 +#: ../data/templates/Ubuntu.info.in:494 msgid "Cdrom with Ubuntu 14.04 'Trusty Tahr'" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:378 +#: ../data/templates/Ubuntu.info.in:606 msgid "Ubuntu 13.10 'Saucy Salamander'" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:385 +#: ../data/templates/Ubuntu.info.in:613 msgid "Cdrom with Ubuntu 13.10 'Saucy Salamander'" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:497 +#: ../data/templates/Ubuntu.info.in:725 msgid "Ubuntu 13.04 'Raring Ringtail'" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:504 +#: ../data/templates/Ubuntu.info.in:732 msgid "Cdrom with Ubuntu 13.04 'Raring Ringtail'" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:616 +#: ../data/templates/Ubuntu.info.in:844 msgid "Ubuntu 12.10 'Quantal Quetzal'" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:623 +#: ../data/templates/Ubuntu.info.in:851 msgid "Cdrom with Ubuntu 12.10 'Quantal Quetzal'" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:734 +#: ../data/templates/Ubuntu.info.in:962 msgid "Ubuntu 12.04 'Precise Pangolin'" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:741 +#: ../data/templates/Ubuntu.info.in:969 msgid "Cdrom with Ubuntu 12.04 'Precise Pangolin'" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:852 +#: ../data/templates/Ubuntu.info.in:1080 msgid "Ubuntu 11.10 'Oneiric Ocelot'" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:859 +#: ../data/templates/Ubuntu.info.in:1087 msgid "Cdrom with Ubuntu 11.10 'Oneiric Ocelot'" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:971 +#: ../data/templates/Ubuntu.info.in:1199 msgid "Ubuntu 11.04 'Natty Narwhal'" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:978 +#: ../data/templates/Ubuntu.info.in:1206 msgid "Cdrom with Ubuntu 11.04 'Natty Narwhal'" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:1069 +#: ../data/templates/Ubuntu.info.in:1297 msgid "Ubuntu 10.10 'Maverick Meerkat'" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:1089 +#: ../data/templates/Ubuntu.info.in:1317 msgid "Cdrom with Ubuntu 10.10 'Maverick Meerkat'" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:1101 +#: ../data/templates/Ubuntu.info.in:1329 msgid "Canonical Partners" msgstr "" #. CompDescription -#: ../data/templates/Ubuntu.info.in:1103 +#: ../data/templates/Ubuntu.info.in:1331 msgid "Software packaged by Canonical for their partners" msgstr "" #. CompDescriptionLong -#: ../data/templates/Ubuntu.info.in:1104 +#: ../data/templates/Ubuntu.info.in:1332 msgid "This software is not part of Ubuntu." msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:1111 +#: ../data/templates/Ubuntu.info.in:1339 msgid "Independent" msgstr "" #. CompDescription -#: ../data/templates/Ubuntu.info.in:1113 +#: ../data/templates/Ubuntu.info.in:1341 msgid "Provided by third-party software developers" msgstr "" #. CompDescriptionLong -#: ../data/templates/Ubuntu.info.in:1114 +#: ../data/templates/Ubuntu.info.in:1342 msgid "Software offered by third party developers." msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:1152 +#: ../data/templates/Ubuntu.info.in:1380 msgid "Ubuntu 10.04 'Lucid Lynx'" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:1172 +#: ../data/templates/Ubuntu.info.in:1400 msgid "Cdrom with Ubuntu 10.04 'Lucid Lynx'" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:1215 +#: ../data/templates/Ubuntu.info.in:1443 msgid "Ubuntu 9.10 'Karmic Koala'" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:1235 +#: ../data/templates/Ubuntu.info.in:1463 msgid "Cdrom with Ubuntu 9.10 'Karmic Koala'" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:1278 +#: ../data/templates/Ubuntu.info.in:1506 msgid "Ubuntu 9.04 'Jaunty Jackalope'" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:1297 +#: ../data/templates/Ubuntu.info.in:1525 msgid "Cdrom with Ubuntu 9.04 'Jaunty Jackalope'" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:1340 +#: ../data/templates/Ubuntu.info.in:1568 msgid "Ubuntu 8.10 'Intrepid Ibex'" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:1360 +#: ../data/templates/Ubuntu.info.in:1588 msgid "Cdrom with Ubuntu 8.10 'Intrepid Ibex'" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:1404 +#: ../data/templates/Ubuntu.info.in:1632 msgid "Ubuntu 8.04 'Hardy Heron'" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:1424 +#: ../data/templates/Ubuntu.info.in:1652 msgid "Cdrom with Ubuntu 8.04 'Hardy Heron'" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:1469 +#: ../data/templates/Ubuntu.info.in:1697 msgid "Ubuntu 7.10 'Gutsy Gibbon'" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:1488 +#: ../data/templates/Ubuntu.info.in:1716 msgid "Cdrom with Ubuntu 7.10 'Gutsy Gibbon'" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:1533 +#: ../data/templates/Ubuntu.info.in:1761 msgid "Ubuntu 7.04 'Feisty Fawn'" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:1552 +#: ../data/templates/Ubuntu.info.in:1780 msgid "Cdrom with Ubuntu 7.04 'Feisty Fawn'" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:1594 +#: ../data/templates/Ubuntu.info.in:1822 msgid "Ubuntu 6.10 'Edgy Eft'" msgstr "" #. CompDescription -#: ../data/templates/Ubuntu.info.in:1599 +#: ../data/templates/Ubuntu.info.in:1827 msgid "Community-maintained" msgstr "" #. CompDescription -#: ../data/templates/Ubuntu.info.in:1605 +#: ../data/templates/Ubuntu.info.in:1833 msgid "Restricted software" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:1613 +#: ../data/templates/Ubuntu.info.in:1841 msgid "Cdrom with Ubuntu 6.10 'Edgy Eft'" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:1655 +#: ../data/templates/Ubuntu.info.in:1883 msgid "Ubuntu 6.06 LTS 'Dapper Drake'" msgstr "" #. CompDescriptionLong -#: ../data/templates/Ubuntu.info.in:1658 +#: ../data/templates/Ubuntu.info.in:1886 msgid "Canonical-supported free and open-source software" msgstr "" #. CompDescription -#: ../data/templates/Ubuntu.info.in:1660 +#: ../data/templates/Ubuntu.info.in:1888 msgid "Community-maintained (universe)" msgstr "" #. CompDescriptionLong -#: ../data/templates/Ubuntu.info.in:1661 +#: ../data/templates/Ubuntu.info.in:1889 msgid "Community-maintained free and open-source software" msgstr "" #. CompDescription -#: ../data/templates/Ubuntu.info.in:1663 +#: ../data/templates/Ubuntu.info.in:1891 msgid "Non-free drivers" msgstr "" #. CompDescriptionLong -#: ../data/templates/Ubuntu.info.in:1664 +#: ../data/templates/Ubuntu.info.in:1892 msgid "Proprietary drivers for devices" msgstr "" #. CompDescription -#: ../data/templates/Ubuntu.info.in:1666 +#: ../data/templates/Ubuntu.info.in:1894 msgid "Restricted software (Multiverse)" msgstr "" #. CompDescriptionLong -#: ../data/templates/Ubuntu.info.in:1667 +#: ../data/templates/Ubuntu.info.in:1895 msgid "Software restricted by copyright or legal issues" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:1674 +#: ../data/templates/Ubuntu.info.in:1902 msgid "Cdrom with Ubuntu 6.06 LTS 'Dapper Drake'" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:1690 +#: ../data/templates/Ubuntu.info.in:1918 msgid "Important security updates" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:1695 ../data/templates/Debian.info.in:56 +#: ../data/templates/Ubuntu.info.in:1923 ../data/templates/Debian.info.in:56 msgid "Recommended updates" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:1700 +#: ../data/templates/Ubuntu.info.in:1928 msgid "Pre-released updates" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:1705 +#: ../data/templates/Ubuntu.info.in:1933 msgid "Unsupported updates" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:1716 +#: ../data/templates/Ubuntu.info.in:1944 msgid "Ubuntu 5.10 'Breezy Badger'" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:1731 +#: ../data/templates/Ubuntu.info.in:1959 msgid "Cdrom with Ubuntu 5.10 'Breezy Badger'" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:1747 +#: ../data/templates/Ubuntu.info.in:1975 msgid "Ubuntu 5.10 Security Updates" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:1752 +#: ../data/templates/Ubuntu.info.in:1980 msgid "Ubuntu 5.10 Updates" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:1757 +#: ../data/templates/Ubuntu.info.in:1985 msgid "Ubuntu 5.10 Backports" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:1768 +#: ../data/templates/Ubuntu.info.in:1996 msgid "Ubuntu 5.04 'Hoary Hedgehog'" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:1783 +#: ../data/templates/Ubuntu.info.in:2011 msgid "Cdrom with Ubuntu 5.04 'Hoary Hedgehog'" msgstr "" #. CompDescription -#: ../data/templates/Ubuntu.info.in:1786 ../data/templates/Debian.info.in:209 +#: ../data/templates/Ubuntu.info.in:2014 ../data/templates/Debian.info.in:209 msgid "Officially supported" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:1799 +#: ../data/templates/Ubuntu.info.in:2027 msgid "Ubuntu 5.04 Security Updates" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:1804 +#: ../data/templates/Ubuntu.info.in:2032 msgid "Ubuntu 5.04 Updates" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:1809 +#: ../data/templates/Ubuntu.info.in:2037 msgid "Ubuntu 5.04 Backports" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:1815 +#: ../data/templates/Ubuntu.info.in:2043 msgid "Ubuntu 4.10 'Warty Warthog'" msgstr "" #. CompDescription -#: ../data/templates/Ubuntu.info.in:1821 +#: ../data/templates/Ubuntu.info.in:2049 msgid "Community-maintained (Universe)" msgstr "" #. CompDescription -#: ../data/templates/Ubuntu.info.in:1823 +#: ../data/templates/Ubuntu.info.in:2051 msgid "Non-free (Multiverse)" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:1830 +#: ../data/templates/Ubuntu.info.in:2058 msgid "Cdrom with Ubuntu 4.10 'Warty Warthog'" msgstr "" #. CompDescription -#: ../data/templates/Ubuntu.info.in:1833 +#: ../data/templates/Ubuntu.info.in:2061 msgid "No longer officially supported" msgstr "" #. CompDescription -#: ../data/templates/Ubuntu.info.in:1835 +#: ../data/templates/Ubuntu.info.in:2063 msgid "Restricted copyright" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:1842 +#: ../data/templates/Ubuntu.info.in:2070 msgid "Ubuntu 4.10 Security Updates" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:1847 +#: ../data/templates/Ubuntu.info.in:2075 msgid "Ubuntu 4.10 Updates" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:1852 +#: ../data/templates/Ubuntu.info.in:2080 msgid "Ubuntu 4.10 Backports" msgstr "" @@ -492,39 +512,16 @@ msgstr "" msgid "Custom servers" msgstr "" -#: ../apt/progress/gtk2.py:245 -#, python-format -msgid "Downloading file %(current)li of %(total)li with %(speed)s/s" -msgstr "" - -#: ../apt/progress/gtk2.py:251 -#, python-format -msgid "Downloading file %(current)li of %(total)li" -msgstr "" - -#. Setup some child widgets -#: ../apt/progress/gtk2.py:274 -msgid "Details" -msgstr "" - -#: ../apt/progress/gtk2.py:347 -msgid "Starting..." -msgstr "" - -#: ../apt/progress/gtk2.py:353 -msgid "Complete" -msgstr "" - #: ../apt/package.py:380 #, python-format msgid "Invalid unicode in description for '%s' (%s). Please report." msgstr "" -#: ../apt/package.py:950 ../apt/package.py:1056 +#: ../apt/package.py:951 ../apt/package.py:1057 msgid "The list of changes is not available" msgstr "" -#: ../apt/package.py:1062 +#: ../apt/package.py:1063 #, python-format msgid "" "The list of changes is not available yet.\n" @@ -533,7 +530,7 @@ msgid "" "until the changes become available or try again later." msgstr "" -#: ../apt/package.py:1069 +#: ../apt/package.py:1070 msgid "" "Failed to download the list of changes. \n" "Please check your Internet connection." @@ -612,12 +609,12 @@ msgstr "" msgid "Automatically converted to printable ascii:\n" msgstr "" -#: ../apt/debfile.py:745 +#: ../apt/debfile.py:746 #, python-format msgid "Install Build-Dependencies for source package '%s' that builds %s\n" msgstr "" -#: ../apt/debfile.py:756 +#: ../apt/debfile.py:757 msgid "An essential package would be removed" msgstr "" -- cgit v1.2.3 From e3009e4a955dbad7eed8cc1765b38f8ebd948fd5 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Wed, 10 Jun 2015 15:58:33 +0200 Subject: apt/debfile.py: Fix a too long line Gbp-Dch: ignore --- apt/debfile.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/apt/debfile.py b/apt/debfile.py index 440f9532..d542adae 100644 --- a/apt/debfile.py +++ b/apt/debfile.py @@ -735,7 +735,8 @@ class DscSrcPackage(DebPackage): if 'Source' in sec: self.pkgname = sec['Source'] if 'Binary' in sec: - self.binaries = [b.strip() for b in sec['Binary'].split(',')] + self.binaries = [b.strip() for b in + sec['Binary'].split(',')] for tag in sec.keys(): if tag in sec: self._sections[tag] = sec[tag] -- cgit v1.2.3 From 2ebe65984aff59eb27de849351c4bbb9ca25351b Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Wed, 10 Jun 2015 17:11:01 +0200 Subject: apt/cache.py: Work around a cyclic reference from Cache to its methods This makes the number of FDs stable in the test case and makes sure that our cache gets closed if it is deleted. Closes: #745487 --- apt/cache.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/apt/cache.py b/apt/cache.py index f94f2146..c8615caf 100644 --- a/apt/cache.py +++ b/apt/cache.py @@ -78,8 +78,8 @@ class Cache(object): self._changes_count = -1 self._sorted_set = None - self.connect("cache_post_open", self._inc_changes_count) - self.connect("cache_post_change", self._inc_changes_count) + self.connect("cache_post_open", "_inc_changes_count") + self.connect("cache_post_change", "_inc_changes_count") if memonly: # force apt to build its caches in memory apt_pkg.config.set("Dir::Cache::pkgcache", "") @@ -135,7 +135,10 @@ class Cache(object): """ internal helper to run a callback """ if name in self._callbacks: for callback in self._callbacks[name]: - callback() + if callback == '_inc_changes_count': + self._inc_changes_count() + else: + callback() def open(self, progress=None): """ Open the package cache, after that it can be used like -- cgit v1.2.3 From 7fff13ba3ee863bd84ed910523939069b966dbd7 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Wed, 10 Jun 2015 17:34:04 +0200 Subject: apt/debfile.py: Arch-qualify in compare_to_version_in_cache() This uses the native architecture if the packages architecture is all, and the other architecture in case. We might need to consider versioned provides here, I have not looked at that yet. Closes: #750189 --- apt/debfile.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/apt/debfile.py b/apt/debfile.py index d542adae..22f96bfc 100644 --- a/apt/debfile.py +++ b/apt/debfile.py @@ -456,6 +456,15 @@ class DebPackage(object): """ self._dbg(3, "compare_to_version_in_cache") pkgname = self._sections["Package"] + architecture = self._sections["Architecture"] + + # Architecture all gets mapped to the native architecture internally + if architecture == 'all': + architecture = apt_pkg.config.find("APT::Architecture") + + # Arch qualify the package name + pkgname = ":".join([pkgname, architecture]) + debver = self._sections["Version"] self._dbg(1, "debver: %s" % debver) if pkgname in self._cache: -- cgit v1.2.3 From 7733ef642461daf7bd82aaeb7c9f9b184455b19d Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Wed, 10 Jun 2015 17:45:57 +0200 Subject: apt.package: Only reference Launchpad for missing changelogs on Ubuntu The new message is not really helpful, but hey, who cares. Closes: #781270 --- apt/package.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/apt/package.py b/apt/package.py index 8561d3c4..069b21dd 100644 --- a/apt/package.py +++ b/apt/package.py @@ -1060,11 +1060,15 @@ class Package(object): self._changelog = changelog except HTTPError: - res = _("The list of changes is not available yet.\n\n" - "Please use http://launchpad.net/ubuntu/+source/%s/" - "%s/+changelog\n" - "until the changes become available or try again " - "later.") % (src_pkg, src_ver) + if self.candidate.origins[0].origin == "Ubuntu": + res = _("The list of changes is not available yet.\n\n" + "Please use " + "http://launchpad.net/ubuntu/+source/%s/" + "%s/+changelog\n" + "until the changes become available or try again " + "later.") % (src_pkg, src_ver) + else: + res = _("The list of changes is not available") return res if isinstance(res, unicode) else res.decode("utf-8") except (IOError, BadStatusLine): res = _("Failed to download the list of changes. \nPlease " -- cgit v1.2.3 From 79a9f191d9f262016d28339c69b28777e4c95426 Mon Sep 17 00:00:00 2001 From: Michael Schaller Date: Mon, 10 Mar 2014 20:47:35 +0100 Subject: Fixed docstring of BaseDependency.version property. --- apt/package.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/apt/package.py b/apt/package.py index 069b21dd..0679b25b 100644 --- a/apt/package.py +++ b/apt/package.py @@ -106,9 +106,11 @@ class BaseDependency(object): @property def version(self): - """The target version or None. + """The target version or an empty string. - It is None if and only if relation is the empty string.""" + Note that the version is only an empty string in case of an unversioned + dependency. In this case the relation is also an empty string. + """ return self._dep.target_ver @property -- cgit v1.2.3 From 96a2eddb562e361d0fa811dc7dd7d01c80220cf4 Mon Sep 17 00:00:00 2001 From: Michael Schaller Date: Mon, 10 Mar 2014 20:47:36 +0100 Subject: Improved docstring of the Version.get_dependencies method. --- apt/package.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/apt/package.py b/apt/package.py index 0679b25b..641b1a4c 100644 --- a/apt/package.py +++ b/apt/package.py @@ -452,7 +452,14 @@ class Version(object): return Record(self._records.record) def get_dependencies(self, *types): - """Return a list of Dependency objects for the given types.""" + """Return a list of Dependency objects for the given types. + + Multiple types can be specified. Possible types are: + 'Breaks', 'Conflicts', 'Depends', 'Enhances', 'PreDepends', + 'Recommends', 'Replaces', 'Suggests' + + Additional types might be added in the future. + """ depends_list = [] depends = self._cand.depends_list for type_ in types: -- cgit v1.2.3 From 423b06d1a600f3bf8e54817cd087e152e9574b7b Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Wed, 10 Jun 2015 22:08:29 +0200 Subject: apt/cache.py: Support :all and other special architecture specifies Remove the _set and _fullnameset that previously stored the names of all packages in the cache. Checking if a package is now a matter of checking whether it is in the low-level cache and has versions (that is, is real). Still keep the _sorted_set around and make keys() manage it, and change everyone using _sorted_set for iteration to use keys(). --- apt/cache.py | 67 ++++++++++++++++++++++++++++++------------------------------ 1 file changed, 34 insertions(+), 33 deletions(-) diff --git a/apt/cache.py b/apt/cache.py index c8615caf..e716d9e6 100644 --- a/apt/cache.py +++ b/apt/cache.py @@ -27,7 +27,6 @@ import weakref import apt_pkg from apt import Package -from apt_pkg import gettext as _ import apt.progress.text @@ -73,8 +72,6 @@ class Cache(object): self._list = None self._callbacks = {} self._weakref = weakref.WeakValueDictionary() - self._set = set() - self._fullnameset = set() self._changes_count = -1 self._sorted_set = None @@ -156,28 +153,11 @@ class Cache(object): self._records = apt_pkg.PackageRecords(self._cache) self._list = apt_pkg.SourceList() self._list.read_main_list() - self._set.clear() - self._fullnameset.clear() self._sorted_set = None self._weakref.clear() self._have_multi_arch = len(apt_pkg.get_architectures()) > 1 - progress.op = _("Building data structures") - i = last = 0 - size = len(self._cache.packages) - for pkg in self._cache.packages: - if progress is not None and last + 100 < i: - progress.update(i / float(size) * 100) - last = i - # drop stuff with no versions (cruft) - if pkg.has_versions: - self._set.add(pkg.get_fullname(pretty=True)) - if self._have_multi_arch: - self._fullnameset.add(pkg.get_fullname(pretty=False)) - - i += 1 - progress.done() self._run_callbacks("cache_post_open") @@ -200,37 +180,58 @@ class Cache(object): try: return self._weakref[key] except KeyError: - if key in self._set or key in self._fullnameset: - key = str(key) - pkg = self._weakref[key] = Package(self, self._cache[key]) - return pkg - else: + key = str(key) + try: + rawpkg = self._cache[key] + except KeyError: raise KeyError('The cache has no package named %r' % key) + # It might be excluded due to not having a version or something + if not self.__is_real_pkg(rawpkg): + raise KeyError('The cache has no package named %r' % key) + + # Check if we already know the package using the normalized name + name = rawpkg.get_fullname(pretty=False) + try: + return self._weakref[name] + except KeyError: + pkg = Package(self, rawpkg) + self._weakref[key] = self._weakref[name] = pkg + + return pkg + def __iter__(self): # We iterate sorted over package names here. With this we read the # package lists linearly if we need to access the package records, # instead of having to do thousands of random seeks; the latter # is disastrous if we use compressed package indexes, and slower than # necessary for uncompressed indexes. - if self._sorted_set is None: - self._sorted_set = sorted(self._set) - - for pkgname in self._sorted_set: + for pkgname in self.keys(): yield self[pkgname] raise StopIteration + def __is_real_pkg(self, rawpkg): + """Check if the apt_pkg.Package provided is a real package.""" + return rawpkg.has_versions + def has_key(self, key): - return (key in self._set or key in self._fullnameset) + return key in self def __contains__(self, key): - return (key in self._set or key in self._fullnameset) + try: + return self.__is_real_pkg(self._cache[key]) + except KeyError: + return False def __len__(self): - return len(self._set) + return len(self.keys()) def keys(self): - return list(self._set) + if self._sorted_set is None: + self._sorted_set = sorted(p.get_fullname(pretty=True) + for p in self._cache.packages + if self.__is_real_pkg(p)) + return list(self._sorted_set) # We need a copy here, caller may modify def get_changes(self): """ Get the marked changes """ -- cgit v1.2.3 From 8020ec7d4a9632fb524c215d89aebae942ea37ad Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Wed, 10 Jun 2015 22:13:00 +0200 Subject: apt/debfile: Stop special-casing all when looking for a package in the cache The cache supports :all since the previous commit. --- apt/debfile.py | 4 ---- 1 file changed, 4 deletions(-) diff --git a/apt/debfile.py b/apt/debfile.py index 22f96bfc..b116a1aa 100644 --- a/apt/debfile.py +++ b/apt/debfile.py @@ -458,10 +458,6 @@ class DebPackage(object): pkgname = self._sections["Package"] architecture = self._sections["Architecture"] - # Architecture all gets mapped to the native architecture internally - if architecture == 'all': - architecture = apt_pkg.config.find("APT::Architecture") - # Arch qualify the package name pkgname = ":".join([pkgname, architecture]) -- cgit v1.2.3 From 00b217fb80f83574d70785fb76e136ad22c48a42 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Wed, 10 Jun 2015 22:17:56 +0200 Subject: Document that the cache now supports :all and friends Gbp-Dch: ignore --- apt/cache.py | 7 +++++++ doc/source/whatsnew/1.0.rst | 2 ++ 2 files changed, 9 insertions(+) diff --git a/apt/cache.py b/apt/cache.py index e716d9e6..e1e4529f 100644 --- a/apt/cache.py +++ b/apt/cache.py @@ -63,6 +63,13 @@ class Cache(object): sources.list and system lists/files are not read, only file relative to the given rootdir, memonly -- build the cache in memory only. + + + .. versionchanged:: 1.0 + + The cache now supports package names with special architecture qualifiers + such as :all and :native. It does not export them in :meth:`keys()`, + though, to keep :meth:`keys()` a unique set. """ def __init__(self, progress=None, rootdir=None, memonly=False): diff --git a/doc/source/whatsnew/1.0.rst b/doc/source/whatsnew/1.0.rst index 5fa92ece..88fe69ed 100644 --- a/doc/source/whatsnew/1.0.rst +++ b/doc/source/whatsnew/1.0.rst @@ -10,6 +10,8 @@ New features * A new a :meth:`apt_pkg.TagFile.close` method was added * :class:`apt_pkg.TagFile` is now a context manager +* The high-level cache class, :class:`apt.cache.Cache` now supports package + names with special architecture qualifiers such as :all and :native. Deprecated ---------- -- cgit v1.2.3 From 2e86ceae532feaa3a2297d57d8a578d553926f03 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Wed, 10 Jun 2015 22:24:17 +0200 Subject: cleanup: Fix some too long lines, and references in the documentation Gbp-Dch: ignore --- apt/cache.py | 6 +++--- doc/source/whatsnew/1.0.rst | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/apt/cache.py b/apt/cache.py index e1e4529f..d6d187c3 100644 --- a/apt/cache.py +++ b/apt/cache.py @@ -67,9 +67,9 @@ class Cache(object): .. versionchanged:: 1.0 - The cache now supports package names with special architecture qualifiers - such as :all and :native. It does not export them in :meth:`keys()`, - though, to keep :meth:`keys()` a unique set. + The cache now supports package names with special architecture + qualifiers such as :all and :native. It does not export them + in :meth:`keys()`, though, to keep :meth:`keys()` a unique set. """ def __init__(self, progress=None, rootdir=None, memonly=False): diff --git a/doc/source/whatsnew/1.0.rst b/doc/source/whatsnew/1.0.rst index 88fe69ed..87056012 100644 --- a/doc/source/whatsnew/1.0.rst +++ b/doc/source/whatsnew/1.0.rst @@ -24,7 +24,7 @@ The following features are deprecated, starting with this release: Removed ------- -* The module :mod:`apt.progress.gtk2' has been removed. There were no +* The module :mod:`apt.progress.gtk2` has been removed. There were no users in the Debian archive, its last update was in 2013, and it was buggy already. Apart from that, it suggested that it is OK to run a graphical application as root, and used the unmaintained GTK+ 2 version. -- cgit v1.2.3 From e7972b4ca116f6c1e40d83988c94c162d8b99821 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Wed, 10 Jun 2015 10:55:25 +0200 Subject: python/arfile.cc: Do not allow files larger than SIZE_MAX to be mapped Also catch failed allocations, in case size is still too large. This prepares for large file support, see Bug#742885 --- python/arfile.cc | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/python/arfile.cc b/python/arfile.cc index 3284ff7c..ac766f3d 100644 --- a/python/arfile.cc +++ b/python/arfile.cc @@ -179,10 +179,22 @@ static PyObject *ararchive_extractdata(PyArArchiveObject *self, PyObject *args) PyErr_Format(PyExc_LookupError,"No member named '%s'",name.path); return 0; } + if (member->Size > SIZE_MAX) { + PyErr_Format(PyExc_MemoryError, + "Member '%s' is too large to read into memory",name.path); + return 0; + } if (!self->Fd.Seek(member->Start)) return HandleErrors(); - char* value = new char[member->Size]; + char* value; + try { + value = new char[member->Size]; + } catch (std::bad_alloc&) { + PyErr_Format(PyExc_MemoryError, + "Member '%s' is too large to read into memory",name.path); + return 0; + } self->Fd.Read(value, member->Size, true); PyObject *result = PyBytes_FromStringAndSize(value, member->Size); delete[] value; -- cgit v1.2.3 From ee088583a3b4a0843c36b3eee75879ad93d5e5c8 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Wed, 10 Jun 2015 10:58:59 +0200 Subject: python/arfile.cc: LFS: Use long long instead of long for file sizes This should make large files in ar archives work. See Bug: #742885 --- python/arfile.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/python/arfile.cc b/python/arfile.cc index ac766f3d..d4d7eed6 100644 --- a/python/arfile.cc +++ b/python/arfile.cc @@ -233,14 +233,14 @@ static PyObject *_extract(FileFd &Fd, const ARArchive::Member *member, // Read 4 KiB from the file, until all of the file is read. Deallocated // automatically when the function returns. SPtrArray value = new char[4096]; - unsigned long size = member->Size; - unsigned long read = 4096; + unsigned long long size = member->Size; + unsigned long long read = 4096; while (size > 0) { if (size < read) read = size; if (!Fd.Read(value, read, true)) return HandleErrors(); - if (write(outfd, value, read) != (signed)read) + if (write(outfd, value, read) != (signed long long)read) return PyErr_SetFromErrnoWithFilename(PyExc_OSError, outfile); size -= read; } -- cgit v1.2.3 From 1c99fa6d8e17d331a2f11ccf7061815cba03cb12 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Wed, 10 Jun 2015 22:55:23 +0200 Subject: apt/debfile.py: Allow downgrading packages in check() with a parameter Well, we do not want to allow that in general. Closes: #613974 --- apt/debfile.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/apt/debfile.py b/apt/debfile.py index b116a1aa..e9be9672 100644 --- a/apt/debfile.py +++ b/apt/debfile.py @@ -481,7 +481,7 @@ class DebPackage(object): return self.VERSION_OUTDATED return self.VERSION_NONE - def check(self): + def check(self, allow_downgrade=False): """Check if the package is installable.""" self._dbg(3, "check") @@ -504,7 +504,8 @@ class DebPackage(object): return False # check version - if self.compare_to_version_in_cache() == self.VERSION_OUTDATED: + if (not allow_downgrade and + self.compare_to_version_in_cache() == self.VERSION_OUTDATED): if self._cache[self.pkgname].installed: # the deb is older than the installed self._failure_string = _( -- cgit v1.2.3 From a6e3d4d872b852de308f19a15215180cb4116765 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Wed, 10 Jun 2015 23:13:58 +0200 Subject: Acquire: Document that items may have transient errors on run() success If run() succeeded, items may still have transient errors, like a Not Found error. Closes: #680997 --- doc/source/library/apt_pkg.rst | 8 ++++++-- python/acquire.cc | 9 +++++---- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/doc/source/library/apt_pkg.rst b/doc/source/library/apt_pkg.rst index 5ccb93ae..7a69059b 100644 --- a/doc/source/library/apt_pkg.rst +++ b/doc/source/library/apt_pkg.rst @@ -1599,8 +1599,12 @@ installation. .. attribute:: RESULT_CONTINUE - All items have been fetched successfully and the process has not been - canceled. + All items have been fetched successfully or failed transiently + and the process has not been canceled. + + You need to look at the status of each item and check if it has not + failed transiently to discover errors like a Not Found when acquiring + packages. .. attribute:: RESULT_FAILED diff --git a/python/acquire.cc b/python/acquire.cc index 82968a9d..621f0eef 100644 --- a/python/acquire.cc +++ b/python/acquire.cc @@ -244,10 +244,11 @@ static PyObject *PkgAcquireShutdown(PyObject *Self,PyObject *Args) static PyMethodDef PkgAcquireMethods[] = { {"run",PkgAcquireRun,METH_VARARGS, "run() -> int\n\nRun the fetcher and return one of RESULT_CANCELLED,\n" - "RESULT_CONTINUE, RESULT_FAILED. RESULT_CONTINUE means that all items\n" - "which where queued prior to calling run() have been fetched\n" - "successfully. RESULT_CANCELLED means that the process was canceled\n" - "by the progress class. And RESULT_FAILED means a generic failure."}, + "RESULT_CONTINUE, RESULT_FAILED.\n\n" + "RESULT_CONTINUE means that all items which where queued prior to\n" + "calling run() have been fetched successfully or failed transiently.\n\n" + "RESULT_CANCELLED means canceled by the progress class.\n\n" + "RESULT_FAILED means a generic failure."}, {"shutdown",PkgAcquireShutdown, METH_VARARGS, "shutdown()\n\n" "Shut the fetcher down, removing all items from it. Future access to\n" -- cgit v1.2.3 From 3ae6e69473c785b6c56cfb27c31a7c9375416f06 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Thu, 11 Jun 2015 16:15:34 +0200 Subject: python/tarfile.cc: LFS: Handle too large file Handle both file sizes larger than SIZE_MAX and allocation failures when reading the data of a tarmember. If using the go() function with a callback, pass None as the data parameter for files that are too large. For extractdata, raise a MemoryError if the file too extract is too large. Also check for an existing error first in extractdata, before raising a new one. Test the whole thing on 32-bit platforms with a sample deb that contains a zeroed file that is 5GB large (compressed using xz at level 1 to a few kb). --- python/tarfile.cc | 38 +++++++++++++++++---- .../test_debs/large-package-content_1.0_all.deb | Bin 0 -> 781546 bytes tests/test_large_file.py | 22 ++++++++++++ 3 files changed, 53 insertions(+), 7 deletions(-) create mode 100644 tests/data/test_debs/large-package-content_1.0_all.deb create mode 100644 tests/test_large_file.py diff --git a/python/tarfile.cc b/python/tarfile.cc index adc8e819..0aeae662 100644 --- a/python/tarfile.cc +++ b/python/tarfile.cc @@ -43,7 +43,8 @@ public: PyObject *py_data; // The requested member or NULL. const char *member; - // Set to true if an error occured in the Python callback. + // Set to true if an error occured in the Python callback, or a file + // was too large to read in extractdata. bool error; // Place where the copy of the data is stored. char *copy; @@ -76,9 +77,13 @@ bool PyDirStream::DoItem(Item &Itm, int &Fd) { if (!member || strcmp(Itm.Name, member) == 0) { // Allocate a new buffer if the old one is too small. + if (Itm.Size > SIZE_MAX) + goto to_large; if (copy == NULL || copy_size < Itm.Size) { delete[] copy; - copy = new char[Itm.Size]; + copy = new (std::nothrow) char[Itm.Size]; + if (copy == NULL) + goto to_large; copy_size = Itm.Size; } Fd = -2; @@ -86,6 +91,19 @@ bool PyDirStream::DoItem(Item &Itm, int &Fd) Fd = -1; } return true; +to_large: + delete[] copy; + copy = NULL; + copy_size = 0; + /* If we are looking for a specific member, abort reading now */ + if (member) { + error = true; + PyErr_Format(PyExc_MemoryError, + "The member %s was too large to read into memory", + Itm.Name); + return false; + } + return true; } #if (APT_PKG_MAJOR >= 4 && APT_PKG_MINOR >= 14) @@ -96,7 +114,8 @@ bool PyDirStream::Process(Item &Itm,const unsigned char *Data, unsigned long Size,unsigned long Pos) #endif { - memcpy(copy + Pos, Data,Size); + if (copy != NULL) + memcpy(copy + Pos, Data,Size); return true; } @@ -107,7 +126,12 @@ bool PyDirStream::FinishedFile(Item &Itm,int Fd) return true; Py_XDECREF(py_data); - py_data = PyBytes_FromStringAndSize(copy, Itm.Size); + if (copy == NULL) { + Py_INCREF(Py_None); + py_data = Py_None; + } else { + py_data = PyBytes_FromStringAndSize(copy, Itm.Size); + } if (!callback) return true; @@ -424,12 +448,12 @@ static PyObject *tarfile_extractdata(PyObject *self, PyObject *args) // Go through the stream. GetCpp(self)->Go(stream); + if (stream.error) + return 0; + if (!stream.py_data) return PyErr_Format(PyExc_LookupError, "There is no member named '%s'", member.path); - if (stream.error) { - return 0; - } return Py_INCREF(stream.py_data), stream.py_data; } diff --git a/tests/data/test_debs/large-package-content_1.0_all.deb b/tests/data/test_debs/large-package-content_1.0_all.deb new file mode 100644 index 00000000..56bdce3d Binary files /dev/null and b/tests/data/test_debs/large-package-content_1.0_all.deb differ diff --git a/tests/test_large_file.py b/tests/test_large_file.py new file mode 100644 index 00000000..2e873131 --- /dev/null +++ b/tests/test_large_file.py @@ -0,0 +1,22 @@ +#!/usr/bin/python + +import sys +import unittest + +import apt_inst + +IS_NOT_32BIT = sys.maxsize > 2**32 + +@unittest.skipIf(IS_NOT_32BIT, "Large File support is for 32 bit systems") +class testHashes(unittest.TestCase): + " test the hashsum functions against strings and files " + + LARGE_PACKAGE_CONTENT = "data/test_debs/large-package-content_1.0_all.deb" + + def testExtractData(self): + deb = apt_inst.DebFile(self.LARGE_PACKAGE_CONTENT) + + self.assertRaises(MemoryError, deb.data.extractdata, "large-file") + +if __name__ == "__main__": + unittest.main() -- cgit v1.2.3 From f9fc74f216ebc613370b1b24a3e8ce935847b06c Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Thu, 11 Jun 2015 19:44:34 +0200 Subject: tests/test_large_file.py: make pep8 happy The spacing around the ** operator looks ugly, and that's fixed in pep8 1.6.0, but we only have 1.5.7. Gbp-Dch: ignore --- tests/test_large_file.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/test_large_file.py b/tests/test_large_file.py index 2e873131..852c8579 100644 --- a/tests/test_large_file.py +++ b/tests/test_large_file.py @@ -5,7 +5,8 @@ import unittest import apt_inst -IS_NOT_32BIT = sys.maxsize > 2**32 +IS_NOT_32BIT = sys.maxsize > 2 ** 32 + @unittest.skipIf(IS_NOT_32BIT, "Large File support is for 32 bit systems") class testHashes(unittest.TestCase): -- cgit v1.2.3 From 165c3e534716c7f300a6419e2f0ccc331f63c0c9 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Thu, 11 Jun 2015 17:14:35 +0200 Subject: setup.py: Translate version number from Debian to PEP0440 Such a idiocy. LP: #1445949 --- setup.py | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index f9d56386..b67443fd 100644 --- a/setup.py +++ b/setup.py @@ -24,6 +24,24 @@ try: except ImportError: print('W: [python%s] Sphinx import error.' % sys.version[:3]) + +def get_version(): + """Get a PEP 0440 compatible version string""" + version = os.environ.get('DEBVER') + version = version.replace("~alpha", ".a") + version = version.replace("~beta", ".b") + version = version.replace("~rc", ".rc") + version = version.replace("~exp", ".dev") + version = version.replace("ubuntu", "+ubuntu") + version = version.replace("tanglu", "+tanglu") + version = version.split("build")[0] + + if "~" in version: + raise ValueError("Invalid version") + + return version + + # The apt_pkg module. files = ['apt_pkgmodule.cc', 'acquire.cc', 'cache.cc', 'cdrom.cc', 'configuration.cc', 'depcache.cc', 'generic.cc', 'hashes.cc', @@ -64,7 +82,7 @@ for key, value in cfg_vars.items(): setup(name="python-apt", description="Python bindings for APT", - version=os.environ.get('DEBVER'), + version=get_version(), author="APT Development Team", author_email="deity@lists.debian.org", ext_modules=[apt_pkg, apt_inst], -- cgit v1.2.3 From 632fbccb55563e0fbe3d2d380789caa8a9928e25 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Thu, 11 Jun 2015 22:29:21 +0200 Subject: setup.py: Do not raise a value error if there's a tilde in the version This breaks PPAs. No workaround yet, so PPA users will have to live with pkg_resources complaints. Gbp-Dch: ignore --- setup.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/setup.py b/setup.py index b67443fd..0b519e3d 100644 --- a/setup.py +++ b/setup.py @@ -36,9 +36,6 @@ def get_version(): version = version.replace("tanglu", "+tanglu") version = version.split("build")[0] - if "~" in version: - raise ValueError("Invalid version") - return version -- cgit v1.2.3 From 8352f766b1e290adc1c1a74aa05ffae607ed7fd2 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Thu, 11 Jun 2015 22:38:36 +0200 Subject: Release 1.0.0~beta1 to unstable --- debian/changelog | 57 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) diff --git a/debian/changelog b/debian/changelog index f28a8b40..dfdd1510 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,60 @@ +python-apt (1.0.0~beta1) unstable; urgency=low + + [ Julian Andres Klode ] + * tests/test_tagfile.py: Close files we opened to prevent leakage + (Closes: #785337) + * doc/source/c++/api.rst: Upgrade syntax to use the new domain stuff + * doc/source/library/apt_pkg.rst: Fix indentation (Closes: #736119) + * sphinx docs: Fix remaining instances of old C syntax to use domains + * python/cache.cc: Handle deprecation of pkgCache::PkgIterator::Section() + * doc: Prepare for 1.0 release + * TagFile: Provide close() and context manager (Closes: #748922) + * doc: Document apt_pkg.TagFile additions + * doc: templates: layout: Remove invalid icon links + * debian/control: Build-Depend on dh-python + * Do not link documentation from Architecture: all to Architecture: any + * Use ${python:Depends} and friends for the debug packages + * apt.debfile: Fix splitting of multi-lines Binary fields in dsc files + (Closes: #751770) + * Remove apt.progress.gtk2 + * apt_pkg.Package: Drop the unset 'auto' attribute (Closes: #565364) + * Update POTFILES.in and the pot + * apt/cache.py: Work around a cyclic reference from Cache to its methods + (Closes: #745487) + * apt/debfile.py: Arch-qualify in compare_to_version_in_cache() + (Closes: #750189) + * apt.package: Only reference Launchpad for missing changelogs on Ubuntu + (Closes: #781270) + * apt/cache.py: Support :all and other special architecture specifies + * apt/debfile: Stop special-casing all when looking for a package in the cache + * apt/debfile.py: Allow downgrading packages in check() with a parameter + (Closes: #613974) + * Acquire: Document that items may have transient errors on run() success + (Closes: #680997) + * Large file support (Closes: #742885) + - python/arfile.cc: Do not allow files larger than SIZE_MAX to be mapped + - python/arfile.cc: LFS: Use long long instead of long for file sizes + - python/tarfile.cc: LFS: Handle too large file + * setup.py: Translate version number from Debian to PEP0440 (LP: #1445949) + + [ Michael Vogt ] + * apt_pkg.rst: improve documentation for AcquireFile() hash and add + sha512 to the documentation + * rename "md5" keyword argument in AcquireFile() to "hash" and add + backward compatiblity + * Fix apt.Package.installed_files for multi-arch packages (LP: #1313699) + + [ von ] + * Remove the "-Wstrict-prototypes" compiler option (Closes: #785261) + * Set Standards-Version to 3.9.6 (Closes: #785431) + * Fix indentation and docstring problems (Closes: #784910) + + [ Michael Schaller ] + * Fixed docstring of BaseDependency.version property. + * Improved docstring of the Version.get_dependencies method. + + -- Julian Andres Klode Thu, 11 Jun 2015 22:38:31 +0200 + python-apt (0.9.4) unstable; urgency=medium [ Michael Vogt ] -- cgit v1.2.3 From c57c3e8706d7d7107ddea9bc0c219690533da6e4 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Thu, 11 Jun 2015 23:15:20 +0200 Subject: debian/control: Build-Depend on apt (>= 1.0.9.4) for Files2() We want to use that soon, so start build-depending now, otherwise we might forget it. --- debian/control | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/control b/debian/control index 13e487fb..64f9d7d9 100644 --- a/debian/control +++ b/debian/control @@ -6,7 +6,7 @@ Uploaders: Michael Vogt , Julian Andres Klode Standards-Version: 3.9.6 X-Python-Version: >= 2.7 X-Python3-Version: >= 3.3 -Build-Depends: apt (>= 0.9.6), +Build-Depends: apt (>= 1.0.9.4), apt-utils, debhelper (>= 9), dh-python, -- cgit v1.2.3 From 9d0a358eb6f8abac30321c913cd951daab7f25c5 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Sat, 13 Jun 2015 00:08:21 +0200 Subject: Handle the symlink to directory transition correctly We previously did not delete the symlink before installing the directory, causing the symlink to remain. Closes: #788571 --- debian/python-apt-dev.maintscript | 1 + debian/python-apt-doc.maintscript | 1 + 2 files changed, 2 insertions(+) create mode 100644 debian/python-apt-dev.maintscript create mode 100644 debian/python-apt-doc.maintscript diff --git a/debian/python-apt-dev.maintscript b/debian/python-apt-dev.maintscript new file mode 100644 index 00000000..95afb26e --- /dev/null +++ b/debian/python-apt-dev.maintscript @@ -0,0 +1 @@ +symlink_to_dir /usr/share/doc/python-apt-dev python-apt 1.0.0~beta2~ diff --git a/debian/python-apt-doc.maintscript b/debian/python-apt-doc.maintscript new file mode 100644 index 00000000..5deb7bd1 --- /dev/null +++ b/debian/python-apt-doc.maintscript @@ -0,0 +1 @@ +symlink_to_dir /usr/share/doc/python-apt-doc python-apt 1.0.0~beta2~ -- cgit v1.2.3 From 8b97662a779800e5c22f554b361b0a638eca3a29 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Sat, 13 Jun 2015 00:42:01 +0200 Subject: Release 1.0.0~beta2 to unstable This is a quick fix for the symlink issue to prevent more people from getting infected by it. --- debian/changelog | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/debian/changelog b/debian/changelog index dfdd1510..8602c23f 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +python-apt (1.0.0~beta2) unstable; urgency=low + + * debian/control: Build-Depend on apt (>= 1.0.9.4) for Files2() + * Handle the symlink to directory transition correctly (Closes: #788571) + + -- Julian Andres Klode Sat, 13 Jun 2015 00:41:30 +0200 + python-apt (1.0.0~beta1) unstable; urgency=low [ Julian Andres Klode ] -- cgit v1.2.3 From 12b0e06cb6db76e60455d13269e6ff3fedab5812 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Tue, 16 Jun 2015 16:39:29 +0200 Subject: tests/test_paths.py: Catch and assert the DeprecationWarning This fixes Ubuntu autopkg test failure wily-adt-python-apt #12. https://jenkins.qa.ubuntu.com/job/wily-adt-python-apt/12/ --- tests/test_paths.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/tests/test_paths.py b/tests/test_paths.py index 993ad02b..9fb98432 100644 --- a/tests/test_paths.py +++ b/tests/test_paths.py @@ -4,6 +4,7 @@ import os import shutil import unittest +import warnings import apt_inst import apt_pkg @@ -40,10 +41,15 @@ class TestPath(unittest.TestCase): Ensure that both "md5" and "hash" is supported as keyword for AcquireFile """ - apt_pkg.AcquireFile( - apt_pkg.Acquire(), "http://example.com", - destfile=self.file_bytes, - md5="abcdef") + with warnings.catch_warnings(record=True) as caught_warnings: + apt_pkg.AcquireFile( + apt_pkg.Acquire(), "http://example.com", + destfile=self.file_bytes, + md5="abcdef") + + assert len(caught_warnings) == 1 + assert issubclass(caught_warnings[0].category, DeprecationWarning) + apt_pkg.AcquireFile( apt_pkg.Acquire(), "http://example.com", destfile=self.file_bytes, -- cgit v1.2.3 From b6055ab49ee5a605a1228e81885f552924ad998d Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Tue, 16 Jun 2015 16:44:32 +0200 Subject: tests/test_paths.py: Fix indentation Geany misdetected it as 8 spaces, but it should be 4. Gbp-Dch: ignore --- tests/test_paths.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/test_paths.py b/tests/test_paths.py index 9fb98432..222848f7 100644 --- a/tests/test_paths.py +++ b/tests/test_paths.py @@ -42,10 +42,10 @@ class TestPath(unittest.TestCase): AcquireFile """ with warnings.catch_warnings(record=True) as caught_warnings: - apt_pkg.AcquireFile( - apt_pkg.Acquire(), "http://example.com", - destfile=self.file_bytes, - md5="abcdef") + apt_pkg.AcquireFile( + apt_pkg.Acquire(), "http://example.com", + destfile=self.file_bytes, + md5="abcdef") assert len(caught_warnings) == 1 assert issubclass(caught_warnings[0].category, DeprecationWarning) -- cgit v1.2.3 From 6b1c6abb4d08522b41c129b4b426eeb16e03bd9a Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Tue, 16 Jun 2015 23:33:03 +0200 Subject: tests/test_paths.py: Add an 'always' warning filter, so it is reliable Previously, the warning was not always issued, causing the test to fail in some cases. Also change the assertions to use the assert* methods of unittest, and check that md5 and hash are mentioned in the deprecation message. Thanks: Adam Conrad Gbp-Dch: ignore --- tests/test_paths.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tests/test_paths.py b/tests/test_paths.py index 222848f7..d647e6e2 100644 --- a/tests/test_paths.py +++ b/tests/test_paths.py @@ -42,13 +42,17 @@ class TestPath(unittest.TestCase): AcquireFile """ with warnings.catch_warnings(record=True) as caught_warnings: + warnings.simplefilter("always") apt_pkg.AcquireFile( apt_pkg.Acquire(), "http://example.com", destfile=self.file_bytes, md5="abcdef") - assert len(caught_warnings) == 1 - assert issubclass(caught_warnings[0].category, DeprecationWarning) + self.assertEqual(len(caught_warnings), 1) + self.assertTrue(issubclass(caught_warnings[0].category, + DeprecationWarning)) + self.assertIn("md5", str(caught_warnings[0].message)) + self.assertIn("hash", str(caught_warnings[0].message)) apt_pkg.AcquireFile( apt_pkg.Acquire(), "http://example.com", -- cgit v1.2.3 From 23e044e3dabc7e61553ce559245393c432dadcd4 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Wed, 17 Jun 2015 17:52:05 +0200 Subject: setup.py: If no version is in the environment, return None --- setup.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/setup.py b/setup.py index 0b519e3d..d704f51c 100644 --- a/setup.py +++ b/setup.py @@ -28,6 +28,9 @@ except ImportError: def get_version(): """Get a PEP 0440 compatible version string""" version = os.environ.get('DEBVER') + if not version: + return version + version = version.replace("~alpha", ".a") version = version.replace("~beta", ".b") version = version.replace("~rc", ".rc") -- cgit v1.2.3 From 178a68f5cdb9939113a5088cc8d2a201f1f22fb7 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Wed, 17 Jun 2015 17:54:23 +0200 Subject: doc/source/library/apt_pkg.rst: Fix an example from old API to new API Someone reported this to mvo. --- doc/source/library/apt_pkg.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/source/library/apt_pkg.rst b/doc/source/library/apt_pkg.rst index 7a69059b..c704db3b 100644 --- a/doc/source/library/apt_pkg.rst +++ b/doc/source/library/apt_pkg.rst @@ -1352,10 +1352,10 @@ Records (Release files, Packages, Sources) Example (shortened):: - cand = depcache.GetCandidateVer(cache['python-apt']) - records.Lookup(cand.FileList[0]) + cand = depcache.get_candidate_ver(cache['python-apt']) + records.lookup(cand.file_list[0]) # Now you can access the record - print records.SourcePkg # == python-apt + print records.source_pkg # == python-apt .. attribute:: filename -- cgit v1.2.3 From 7bac94124668c59fa30784d83050620bf0479f16 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Wed, 17 Jun 2015 16:05:45 +0200 Subject: apt.cache.FilteredCache: Fix multi-arch package lookups This makes it slightly slower, but everyone should be happier. --- apt/cache.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/apt/cache.py b/apt/cache.py index d6d187c3..73a95e7c 100644 --- a/apt/cache.py +++ b/apt/cache.py @@ -694,10 +694,14 @@ class FilteredCache(object): return self._filtered.keys() def has_key(self, key): - return (key in self._filtered) + return key in self def __contains__(self, key): - return (key in self._filtered) + try: + # Normalize package name for multi arch + return self.cache[key].name in self._filtered + except KeyError: + return False def _reapply_filter(self): " internal helper to refilter " -- cgit v1.2.3 From 3f241967c363b98284315acc8dafed3805e7eb20 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Wed, 17 Jun 2015 16:04:41 +0200 Subject: apt.Cache: Introduce a connect2() callback connector The new API passes the cache as the first argument to the callback and allows for other arguments to be passed as well. --- apt/cache.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/apt/cache.py b/apt/cache.py index 73a95e7c..faad8523 100644 --- a/apt/cache.py +++ b/apt/cache.py @@ -78,6 +78,7 @@ class Cache(object): self._records = None self._list = None self._callbacks = {} + self._callbacks2 = {} self._weakref = weakref.WeakValueDictionary() self._changes_count = -1 self._sorted_set = None @@ -144,6 +145,10 @@ class Cache(object): else: callback() + if name in self._callbacks2: + for callback, args, kwds in self._callbacks2[name]: + callback(self, *args, **kwds) + def open(self, progress=None): """ Open the package cache, after that it can be used like a dictionary @@ -545,6 +550,26 @@ class Cache(object): self._callbacks[name] = [] self._callbacks[name].append(callback) + def connect2(self, name, callback, *args, **kwds): + """Connect to a signal. + + The callback will be passed the cache as an argument, and + any arguments passed to this function. Make sure that, if you + pass a method of a class as your callback, your class does not + contain a reference to the cache. + + Cyclic references to the cache can cause issues if the Cache object + is replaced by a new one, because the cache keeps a lot of objects and + tens of open file descriptors. + + currently only used for cache_{post,pre}_{changed,open}. + + .. versionadded:: 1.0 + """ + if name not in self._callbacks2: + self._callbacks2[name] = [] + self._callbacks2[name].append((callback, args, kwds)) + def actiongroup(self): """Return an `ActionGroup` object for the current cache. -- cgit v1.2.3 From 51c6efab69eb26d90ed82a9f426f2fb338ce2bc7 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Wed, 17 Jun 2015 16:16:02 +0200 Subject: Break the FilteredCache <-> Cache reference cycle This should do. --- apt/cache.py | 66 +++++++++++++++++++++++++++++++++++------------------------- 1 file changed, 39 insertions(+), 27 deletions(-) diff --git a/apt/cache.py b/apt/cache.py index faad8523..1ba262aa 100644 --- a/apt/cache.py +++ b/apt/cache.py @@ -689,6 +689,38 @@ class MarkedChangesFilter(Filter): return False +class _FilteredCacheHelper(object): + """Helper class for FilteredCache to break a reference cycle.""" + + def __init__(self, cache): + # Do not keep a reference to the cache, or you have a cycle! + + self._filtered = {} + self._filters = {} + cache.connect2("cache_post_change", self.filter_cache_post_change) + cache.connect2("cache_post_open", self.filter_cache_post_change) + + def _reapply_filter(self, cache): + " internal helper to refilter " + # Do not keep a reference to the cache, or you have a cycle! + self._filtered = {} + for pkg in cache: + for f in self._filters: + if f.apply(pkg): + self._filtered[pkg.name] = 1 + break + + def set_filter(self, filter): + """Set the current active filter.""" + self._filters = [] + self._filters.append(filter) + + def filter_cache_post_change(self, cache): + """Called internally if the cache changes, emit a signal then.""" + # Do not keep a reference to the cache, or you have a cycle! + self._reapply_filter(cache) + + class FilteredCache(object): """ A package cache that is filtered. @@ -700,23 +732,20 @@ class FilteredCache(object): self.cache = Cache(progress) else: self.cache = cache - self.cache.connect("cache_post_change", self.filter_cache_post_change) - self.cache.connect("cache_post_open", self.filter_cache_post_change) - self._filtered = {} - self._filters = [] + self._helper = _FilteredCacheHelper(self.cache) def __len__(self): - return len(self._filtered) + return len(self._helper._filtered) def __getitem__(self, key): return self.cache[key] def __iter__(self): - for pkgname in self._filtered: + for pkgname in self._helper._filtered: yield self.cache[pkgname] def keys(self): - return self._filtered.keys() + return self._helper._filtered.keys() def has_key(self, key): return key in self @@ -724,38 +753,21 @@ class FilteredCache(object): def __contains__(self, key): try: # Normalize package name for multi arch - return self.cache[key].name in self._filtered + return self.cache[key].name in self._helper._filtered except KeyError: return False - def _reapply_filter(self): - " internal helper to refilter " - self._filtered = {} - for pkg in self.cache: - for f in self._filters: - if f.apply(pkg): - self._filtered[pkg.name] = 1 - break - def set_filter(self, filter): """Set the current active filter.""" - self._filters = [] - self._filters.append(filter) - #self._reapplyFilter() - # force a cache-change event that will result in a refiltering + self._helper.set_filter(filter) self.cache.cache_post_change() def filter_cache_post_change(self): """Called internally if the cache changes, emit a signal then.""" - #print "filterCachePostChange()" - self._reapply_filter() - -# def connect(self, name, callback): -# self.cache.connect(name, callback) + self._helper.filter_cache_post_change(self.cache) def __getattr__(self, key): """we try to look exactly like a real cache.""" - #print "getattr: %s " % key return getattr(self.cache, key) -- cgit v1.2.3 From d7f10318796b4a33637b4a24d0b984467add101a Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Wed, 17 Jun 2015 18:05:15 +0200 Subject: apt.Cache: Issue a RuntimeWarning in connect() connect() is not deprecated but is very likely to cause a massive memory and file descriptor leak until Python chooses to run its GC. --- apt/cache.py | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/apt/cache.py b/apt/cache.py index 1ba262aa..74bbe71f 100644 --- a/apt/cache.py +++ b/apt/cache.py @@ -23,6 +23,7 @@ from __future__ import print_function import fnmatch import os +import warnings import weakref import apt_pkg @@ -544,8 +545,16 @@ class Cache(object): self._run_callbacks("cache_pre_change") def connect(self, name, callback): - """ connect to a signal, currently only used for - cache_{post,pre}_{changed,open} """ + """Connect to a signal. + + .. deprecated:: 1.0 + + Please use connect2() instead, as this function is very + likely to cause a memory leak. + """ + if callback != '_inc_changes_count': + warnings.warn("connect() likely causes a reference" + " cycle, use connect2() instead", RuntimeWarning, 2) if name not in self._callbacks: self._callbacks[name] = [] self._callbacks[name].append(callback) @@ -771,11 +780,11 @@ class FilteredCache(object): return getattr(self.cache, key) -def cache_pre_changed(): +def cache_pre_changed(cache): print("cache pre changed") -def cache_post_changed(): +def cache_post_changed(cache): print("cache post changed") @@ -784,8 +793,8 @@ def _test(): print("Cache self test") apt_pkg.init() cache = Cache(apt.progress.text.OpProgress()) - cache.connect("cache_pre_change", cache_pre_changed) - cache.connect("cache_post_change", cache_post_changed) + cache.connect2("cache_pre_change", cache_pre_changed) + cache.connect2("cache_post_change", cache_post_changed) print(("aptitude" in cache)) pkg = cache["aptitude"] print(pkg.name) @@ -812,8 +821,8 @@ def _test(): print("Testing filtered cache (argument is old cache)") filtered = FilteredCache(cache) - filtered.cache.connect("cache_pre_change", cache_pre_changed) - filtered.cache.connect("cache_post_change", cache_post_changed) + filtered.cache.connect2("cache_pre_change", cache_pre_changed) + filtered.cache.connect2("cache_post_change", cache_post_changed) filtered.cache.upgrade() filtered.set_filter(MarkedChangesFilter()) print(len(filtered)) @@ -824,8 +833,8 @@ def _test(): print("Testing filtered cache (no argument)") filtered = FilteredCache(progress=apt.progress.base.OpProgress()) - filtered.cache.connect("cache_pre_change", cache_pre_changed) - filtered.cache.connect("cache_post_change", cache_post_changed) + filtered.cache.connect2("cache_pre_change", cache_pre_changed) + filtered.cache.connect2("cache_post_change", cache_post_changed) filtered.cache.upgrade() filtered.set_filter(MarkedChangesFilter()) print(len(filtered)) -- cgit v1.2.3 From 1fe86f006ec3ac6b88ff96c2fc13199da9aa830f Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Wed, 17 Jun 2015 18:22:01 +0200 Subject: doc: whatsnew: Document what's new in beta3 --- doc/source/whatsnew/1.0.rst | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/doc/source/whatsnew/1.0.rst b/doc/source/whatsnew/1.0.rst index 87056012..ab59f1a7 100644 --- a/doc/source/whatsnew/1.0.rst +++ b/doc/source/whatsnew/1.0.rst @@ -10,9 +10,14 @@ New features * A new a :meth:`apt_pkg.TagFile.close` method was added * :class:`apt_pkg.TagFile` is now a context manager -* The high-level cache class, :class:`apt.cache.Cache` now supports package +* The high-level cache class, :class:`apt.cache.Cache` and it's companion + :class:`apt.cache.FilteredCache` now support package names with special architecture qualifiers such as :all and :native. +* The method :meth:`apt.cache.Cache.connect2` allows connecting callbacks on + cache changes that take the cache as their first argument, reducing the + potential for reference cycles. + Deprecated ---------- The following features are deprecated, starting with this release: @@ -21,6 +26,9 @@ The following features are deprecated, starting with this release: * The `files` member of of :class:`apt_pkg.SourceRecords` * The `md5` argument to :class:`apt_pkg.AcquireFile`, it is replaced by the `hash` argument. +* The method :meth:`apt.cache.Cache.connect` has been deprecated. It is + replaced by :meth:`apt.cache.Cache.connect2` which is more flexible and + less prone to reference cycles. Removed ------- @@ -36,6 +44,10 @@ Removed Maintenance ----------- +* The classes :class:`apt.cache.Cache` and :class:`apt.cache.FilteredCache` no + longer store cyclic references to/between them. This fixes a huge issue, + because a cache can have tens of open file descriptors, causing the maximum + of file descriptors to be reached easily. * :mod:`apt_inst` now supports ar and tar archives that are larger than 4 GiB * Various smaller bug fixes -- cgit v1.2.3 From cb57a52242a6da1b1791e63791f1b9cd50518829 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Wed, 17 Jun 2015 18:29:02 +0200 Subject: Release 1.0.0~beta3 to unstable Let's use the default urgency this time, no need to delay the transition to testing, they should test too. --- debian/changelog | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/debian/changelog b/debian/changelog index 8602c23f..2dc57e6d 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,16 @@ +python-apt (1.0.0~beta3) unstable; urgency=medium + + * tests/test_paths.py: Catch and assert the DeprecationWarning + * setup.py: If no version is in the environment, return None + * doc/source/library/apt_pkg.rst: Fix an example from old API to new API + * apt.cache.FilteredCache: Fix multi-arch package lookups + * apt.Cache: Introduce a connect2() callback connector + * Break the FilteredCache <-> Cache reference cycle + * apt.Cache: Issue a RuntimeWarning in connect() + * doc: whatsnew: Document what's new in beta3 + + -- Julian Andres Klode Wed, 17 Jun 2015 18:28:44 +0200 + python-apt (1.0.0~beta2) unstable; urgency=low * debian/control: Build-Depend on apt (>= 1.0.9.4) for Files2() -- cgit v1.2.3 From c74dc171bf03d27ffb77f150f144cac47cd3f8f5 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Sun, 21 Jun 2015 12:52:45 +0200 Subject: fix py3 issue with auto .gz decompression and add test --- apt/debfile.py | 6 +++--- tests/data/test_debs/gdebi-test13.deb | Bin 0 -> 720 bytes tests/test_debfile.py | 5 +++++ 3 files changed, 8 insertions(+), 3 deletions(-) create mode 100644 tests/data/test_debs/gdebi-test13.deb diff --git a/apt/debfile.py b/apt/debfile.py index e9be9672..3f4bca4b 100644 --- a/apt/debfile.py +++ b/apt/debfile.py @@ -27,7 +27,7 @@ import os import sys from apt_pkg import gettext as _ -from io import StringIO +from io import BytesIO class NoDebArchiveException(IOError): @@ -637,9 +637,9 @@ class DebPackage(object): data = part.extractdata(name) # check for zip content if name.endswith(".gz") and auto_decompress: - io = StringIO(data) + io = BytesIO(data) gz = gzip.GzipFile(fileobj=io) - data = _("Automatically decompressed:\n\n") + data = _("Automatically decompressed:\n\n").encode("utf-8") data += gz.read() # auto-convert to hex try: diff --git a/tests/data/test_debs/gdebi-test13.deb b/tests/data/test_debs/gdebi-test13.deb new file mode 100644 index 00000000..4e7a8289 Binary files /dev/null and b/tests/data/test_debs/gdebi-test13.deb differ diff --git a/tests/test_debfile.py b/tests/test_debfile.py index eae8038f..d6cc88b2 100644 --- a/tests/test_debfile.py +++ b/tests/test_debfile.py @@ -178,6 +178,11 @@ Description: testpackage for gdebi - contains usr/bin/binary for file reading "./data/test_debs/testdep-same-arch_1.0-1_i386.deb") self.assertTrue(same.check(), same._failure_string) + def test_get_content_gzip_data(self): + deb = apt.debfile.DebPackage("./data/test_debs/gdebi-test13.deb") + data = deb.data_content("./lala.gz") + self.assertEqual(data, "Automatically decompressed:\n\nlala\n") + if __name__ == "__main__": #logging.basicConfig(level=logging.DEBUG) -- cgit v1.2.3 From dbb4d8711a0009615f4f275e8418cbf068deeffa Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Tue, 23 Jun 2015 22:26:30 +0200 Subject: doc/source/conf.py: Reproducibility: Set html_last_updated_fmt = None This hopefully makes the build reproducible now. --- doc/source/conf.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/source/conf.py b/doc/source/conf.py index 36d89c06..c4dde305 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -164,7 +164,7 @@ html_static_path = ['.static'] # If not '', a 'Last updated on:' timestamp is inserted at every page bottom, # using the given strftime format. -html_last_updated_fmt = '%b %d, %Y' +html_last_updated_fmt = None # If true, SmartyPants will be used to convert quotes and dashes to # typographically correct entities. -- cgit v1.2.3 From 8ad17a7fbc01935eb5f7cb252631e6d7d2ebedf7 Mon Sep 17 00:00:00 2001 From: Michael Schaller Date: Sun, 28 Jun 2015 13:32:49 +0200 Subject: BaseDependency.__repr__: Replace pre_depend with rawtype pre_depend only states if the relation is PreDepends, rawtype gives the relation type itself. --- apt/package.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apt/package.py b/apt/package.py index 641b1a4c..391ee4fc 100644 --- a/apt/package.py +++ b/apt/package.py @@ -130,8 +130,8 @@ class BaseDependency(object): return self._dep.dep_type_untranslated == 'PreDepends' def __repr__(self): - return ('' - % (self.name, self.relation, self.version, self.pre_depend)) + return ('' + % (self.name, self.relation, self.version, self.rawtype)) class Dependency(list): -- cgit v1.2.3 From fdd173dd444098ed533cbcd541a7f10f228bc47e Mon Sep 17 00:00:00 2001 From: Michael Schaller Date: Mon, 29 Jun 2015 14:51:03 +0200 Subject: apt/package.py: Add rawtype property to Dependency class --- apt/package.py | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/apt/package.py b/apt/package.py index 391ee4fc..57c89b35 100644 --- a/apt/package.py +++ b/apt/package.py @@ -139,16 +139,30 @@ class Dependency(list): Attributes defined here: or_dependencies - The possible choices + rawtype - The type of the dependencies in the Or-group """ - def __init__(self, alternatives): - super(Dependency, self).__init__() - self.extend(alternatives) + def __init__(self, base_deps, rawtype): + super(Dependency, self).__init__(base_deps) + self._rawtype = rawtype @property def or_dependencies(self): return self + @property + def rawtype(self): + """Type of the Or-group of dependency. + + This should be one of 'Breaks', 'Conflicts', 'Depends', 'Enhances', + 'PreDepends', 'Recommends', 'Replaces', 'Suggests'. + + Additional types might be added in the future. + + .. versionadded:: 1.0.0 + """ + return self._rawtype + class Origin(object): """The origin of a version. @@ -468,7 +482,7 @@ class Version(object): base_deps = [] for dep_or in dep_ver_list: base_deps.append(BaseDependency(dep_or)) - depends_list.append(Dependency(base_deps)) + depends_list.append(Dependency(base_deps, type_)) except KeyError: pass return depends_list -- cgit v1.2.3