diff options
| -rw-r--r-- | apt/cache.py | 14 | ||||
| -rw-r--r-- | apt/package.py | 4 | ||||
| -rw-r--r-- | apt/progress/base.py | 2 | ||||
| -rw-r--r-- | apt/progress/text.py | 2 | ||||
| -rw-r--r-- | debian/changelog | 1 | ||||
| -rw-r--r-- | doc/source/library/apt_pkg.rst | 16 | ||||
| -rw-r--r-- | python/apt_pkgmodule.cc | 18 |
7 files changed, 29 insertions, 28 deletions
diff --git a/apt/cache.py b/apt/cache.py index eea06d56..d339f377 100644 --- a/apt/cache.py +++ b/apt/cache.py @@ -223,9 +223,9 @@ class Cache(object): transient = False err_msg = "" for item in fetcher.items: - if item.status == item.stat_done: + if item.status == item.STAT_DONE: continue - if item.stat_idle: + if item.STAT_IDLE: transient = True continue err_msg += "Failed to fetch %s %s\n" % (item.desc_uri, @@ -311,7 +311,7 @@ class Cache(object): pulse_interval) if res == apt_pkg.Acquire.result_cancelled and raise_on_error: raise FetchCancelledException() - if res == apt_pkg.Acquire.result_failed and raise_on_error: + if res == apt_pkg.Acquire.RESULT_FAILED and raise_on_error: raise FetchFailedException() else: return res @@ -369,17 +369,17 @@ class Cache(object): # then install res = self.install_archives(pm, install_progress) - if res == pm.result_completed: + if res == pm.RESULT_COMPLETED: break - elif res == pm.result_failed: + elif res == pm.RESULT_FAILED: raise SystemError("installArchives() failed") - elif res == pm.result_incomplete: + elif res == pm.RESULT_INCOMPLETE: pass else: raise SystemError("internal-error: unknown result code from InstallArchives: %s" % res) # reload the fetcher for media swaping fetcher.shutdown() - return (res == pm.result_completed) + return (res == pm.RESULT_COMPLETED) def clear(self): """ Unmark all changes """ diff --git a/apt/package.py b/apt/package.py index 315a7589..8171f57d 100644 --- a/apt/package.py +++ b/apt/package.py @@ -500,7 +500,7 @@ class Version(object): self.size, base, destfile=destfile) acq.run() - if acqfile.status != acqfile.stat_done: + if acqfile.status != acqfile.STAT_DONE: raise FetchError("The item %r could not be fetched: %s" % (acqfile.destfile, acqfile.error_text)) print self._records.filename @@ -548,7 +548,7 @@ class Version(object): acq.run() for item in acq.items: - if item.status != item.stat_done: + if item.status != item.STAT_DONE: raise FetchError("The item %r could not be fetched: %s" % (item.destfile, item.error_text)) diff --git a/apt/progress/base.py b/apt/progress/base.py index fd6bc475..adb39e93 100644 --- a/apt/progress/base.py +++ b/apt/progress/base.py @@ -192,7 +192,7 @@ class InstallProgress(object): os._exit(os.spawnlp(os.P_WAIT, "dpkg", "dpkg", "--status-fd", str(self.writefd.fileno()), "-i", obj)) except Exception: - os._exit(apt_pkg.PackageManager.result_failed) + os._exit(apt_pkg.PackageManager.RESULT_FAILED) self.child_pid = pid res = self.wait_child() diff --git a/apt/progress/text.py b/apt/progress/text.py index 3a6d3e65..796577e2 100644 --- a/apt/progress/text.py +++ b/apt/progress/text.py @@ -125,7 +125,7 @@ class AcquireProgress(base.AcquireProgress, TextProgress): def fail(self, item): """Called when an item is failed.""" base.AcquireProgress.fail(self, item) - if item.owner.status == item.owner.stat_done: + if item.owner.status == item.owner.STAT_DONE: self._write(_("Ign ") + item.description) else: self._write(_("Err ") + item.description) diff --git a/debian/changelog b/debian/changelog index a7204a0a..acd9c3ca 100644 --- a/debian/changelog +++ b/debian/changelog @@ -8,6 +8,7 @@ python-apt (0.7.93) UNRELEASED; urgency=low - Disable 2.6 and 3.1 builds previously available in experimental. * Merge lp:~forest-bond/python-apt/cache-is-virtual-package-catch-key-error - Return False in Cache.is_virtual_package if the package does not exist. + * Make all class-level constants have uppercase names. [ Colin Watson ] * apt/progress/__init__.py: diff --git a/doc/source/library/apt_pkg.rst b/doc/source/library/apt_pkg.rst index 5876fb8d..c3a74267 100644 --- a/doc/source/library/apt_pkg.rst +++ b/doc/source/library/apt_pkg.rst @@ -282,21 +282,21 @@ Working with the cache Fix the installation if a package could not be downloaded. - .. attribute:: result_completed + .. attribute:: RESULT_COMPLETED A constant for checking whether the the result is 'completed'. Compare it against the return value of :meth:`PackageManager.get_archives` or :meth:`PackageManager.do_install`. - .. attribute:: result_failed + .. attribute:: RESULT_FAILED A constant for checking whether the the result is 'failed'. Compare it against the return value of :meth:`PackageManager.get_archives` or :meth:`PackageManager.do_install`. - .. attribute:: result_incomplete + .. attribute:: RESULT_INCOMPLETE A constant for checking whether the the result is 'incomplete'. @@ -1110,23 +1110,23 @@ installation. Integer, representing the status of the item. - .. attribute:: stat_idle + .. attribute:: STAT_IDLE Constant for comparing :attr:`AcquireItem.status`. - .. attribute:: stat_fetching + .. attribute:: STAT_FETCHING Constant for comparing :attr:`AcquireItem.status` - .. attribute:: stat_done + .. attribute:: STAT_DONE Constant for comparing :attr:`AcquireItem.status` - .. attribute:: stat_error + .. attribute:: STAT_ERROR Constant for comparing :attr:`AcquireItem.status` - .. attribute:: stat_auth_error + .. attribute:: STAT_AUTH_ERROR Constant for comparing :attr:`AcquireItem.status` diff --git a/python/apt_pkgmodule.cc b/python/apt_pkgmodule.cc index f20b0c87..cdd23705 100644 --- a/python/apt_pkgmodule.cc +++ b/python/apt_pkgmodule.cc @@ -670,7 +670,7 @@ extern "C" void initapt_pkg() Py_BuildValue("i", pkgAcquire::Cancelled)); PyDict_SetItemString(PyAcquire_Type.tp_dict, "result_continue", Py_BuildValue("i", pkgAcquire::Continue)); - PyDict_SetItemString(PyAcquire_Type.tp_dict, "result_failed", + PyDict_SetItemString(PyAcquire_Type.tp_dict, "RESULT_FAILED", Py_BuildValue("i", pkgAcquire::Failed)); #ifdef COMPAT_0_7 PyDict_SetItemString(PyAcquire_Type.tp_dict, "ResultCancelled", @@ -702,11 +702,11 @@ extern "C" void initapt_pkg() // PackageManager constants - PyDict_SetItemString(PyPackageManager_Type.tp_dict, "result_completed", + PyDict_SetItemString(PyPackageManager_Type.tp_dict, "RESULT_COMPLETED", Py_BuildValue("i", pkgPackageManager::Completed)); - PyDict_SetItemString(PyPackageManager_Type.tp_dict, "result_failed", + PyDict_SetItemString(PyPackageManager_Type.tp_dict, "RESULT_FAILED", Py_BuildValue("i", pkgPackageManager::Failed)); - PyDict_SetItemString(PyPackageManager_Type.tp_dict, "result_incomplete", + PyDict_SetItemString(PyPackageManager_Type.tp_dict, "RESULT_INCOMPLETE", Py_BuildValue("i", pkgPackageManager::Incomplete)); #ifdef COMPAT_0_7 @@ -719,15 +719,15 @@ extern "C" void initapt_pkg() #endif // AcquireItem Constants. - PyDict_SetItemString(PyAcquireItem_Type.tp_dict, "stat_idle", + PyDict_SetItemString(PyAcquireItem_Type.tp_dict, "STAT_IDLE", Py_BuildValue("i", pkgAcquire::Item::StatIdle)); - PyDict_SetItemString(PyAcquireItem_Type.tp_dict, "stat_fetching", + PyDict_SetItemString(PyAcquireItem_Type.tp_dict, "STAT_FETCHING", Py_BuildValue("i", pkgAcquire::Item::StatFetching)); - PyDict_SetItemString(PyAcquireItem_Type.tp_dict, "stat_done", + PyDict_SetItemString(PyAcquireItem_Type.tp_dict, "STAT_DONE", Py_BuildValue("i", pkgAcquire::Item::StatDone)); - PyDict_SetItemString(PyAcquireItem_Type.tp_dict, "stat_error", + PyDict_SetItemString(PyAcquireItem_Type.tp_dict, "STAT_ERROR", Py_BuildValue("i", pkgAcquire::Item::StatError)); - PyDict_SetItemString(PyAcquireItem_Type.tp_dict, "stat_auth_error", + PyDict_SetItemString(PyAcquireItem_Type.tp_dict, "STAT_AUTH_ERROR", Py_BuildValue("i", pkgAcquire::Item::StatAuthError)); #ifdef COMPAT_0_7 |
