From 69bed12a4ce6e7d5c2451cf36d598cf68353c3df Mon Sep 17 00:00:00 2001 From: harshadyeola Date: Thu, 5 Feb 2015 17:58:00 +0530 Subject: [PATCH] improved apt-get --- ee/core/aptget.py | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/ee/core/aptget.py b/ee/core/aptget.py index 46685508..ce6f9712 100644 --- a/ee/core/aptget.py +++ b/ee/core/aptget.py @@ -64,19 +64,6 @@ class EEAptGet(): except Exception as e: Log.debug(self, str(e)) Log.error(self, str(e)) - - try: - #apt_pkg.PkgSystemUnLock() - result = apt_cache.commit() - #apt_cache.close() - return result - except SystemError as e: - Log.debug(self, 'SystemError: ' + str(e)) - Log.error(self, 'SystemError: ' + str(e)) - #apt_cache.close() - except Exception as e: - Log.debug(self, str(e)) - Log.error(self, str(e)) else: #apt_cache.close() Log.error(self, 'Unknown package selected (' + @@ -86,6 +73,20 @@ class EEAptGet(): if not install_package(self, package): continue + if apt_cache.install_count > 0: + try: + #apt_pkg.PkgSystemUnLock() + result = apt_cache.commit() + #apt_cache.close() + return result + except SystemError as e: + Log.debug(self, 'SystemError: ' + str(e)) + Log.error(self, 'SystemError: ' + str(e)) + #apt_cache.close() + except Exception as e: + Log.debug(self, str(e)) + Log.error(self, str(e)) + def remove(self, packages, auto=False, purge=False): """ Similar to `apt-get remove/purge`