~ubuntu-branches/ubuntu/utopic/youker-assistant/utopic-proposed

« back to all changes in this revision

Viewing changes to backends/youker-assistant-daemon/src/cleaner/cacheclean.py

  • Committer: Package Import Robot
  • Author(s): Kobe Lee (kylinkobe)
  • Date: 2013-09-18 16:22:14 UTC
  • mfrom: (1.1.2)
  • Revision ID: package-import@ubuntu.com-20130918162214-6nqyjyf3cd3ynqky
Tags: 0.2.1-0ubuntu1
* Modify the mouse events of MonitorBall.
* Add reset button for clear pages.
* Add policykit for apt clear in sudodbus.
* Fixed the bug about software status and add masklayer.
* Rewrite the code of system information.
* Add some signals and slots.
* Fixed the bug about Software signals(LP: #1226389).
* Modify KThread and add base.py.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
import os
2
2
from common import get_dir_size
3
 
 
 
3
from common import confirm_filesize_unit
4
4
 
5
5
 
6
6
class CacheClean():
9
9
 
10
10
    def get_apt_cache(self):
11
11
        apt_cache = '/var/cache/apt/archives'
12
 
        aptcachelist = map(lambda filename: '%s/%s<2_2>%s' % (apt_cache, filename, str(os.path.getsize('%s/%s' % (apt_cache, filename)))), filter(lambda filestr: filestr.endswith('deb'), os.listdir(apt_cache)))
13
 
        deb_num = len(aptcachelist)
 
12
        #aptcachelist = map(lambda filename: '%s/%s<2_2>%s' % (apt_cache, filename, str(os.path.getsize('%s/%s' % (apt_cache, filename)))), filter(lambda filestr: filestr.endswith('deb'), os.listdir(apt_cache)))
 
13
        aptcachelist = ['%s/%s<2_2>%s' % (apt_cache,filename, confirm_filesize_unit(os.path.getsize('%s/%s' % (apt_cache, filename)))) for filename in os.listdir(apt_cache) if filename.endswith('deb')]
14
14
        return aptcachelist
15
15
 
16
16
    def get_softwarecenter_cache(self, homedir):
24
24
            tmp_path = full_path + one
25
25
            if os.path.isdir(tmp_path):
26
26
                size = get_dir_size(tmp_path)
27
 
                centercachelist.append('%s<2_2>%s' % (tmp_path, str(size)))
 
27
                centercachelist.append('%s<2_2>%s' % (tmp_path, confirm_filesize_unit(size)))
28
28
            else:
29
 
                centercachelist.append('%s<2_2>%s' % (tmp_path, str(os.path.getsize(tmp_path))))
 
29
                centercachelist.append('%s<2_2>%s' % (tmp_path, confirm_filesize_unit(os.path.getsize(tmp_path))))
30
30
        return centercachelist
31
31
 
32
32
if __name__ == "__main__":