Skip to content

Commit

Permalink
Merge pull request #29 from ignatenkobrain/master
Browse files Browse the repository at this point in the history
more psutil 2.x
  • Loading branch information
FrostyX committed Jan 26, 2015
2 parents 728edc6 + 1c5e88b commit efad173
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 12 deletions.
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
psutil
psutil >= 2.0.0
BeautifulSoup4
sphinx_rtd_theme
2 changes: 1 addition & 1 deletion tracer.spec
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ BuildRequires: python-sphinx
BuildRequires: libxslt
Requires: python
Requires: python-beautifulsoup4
Requires: python-psutil
Requires: python-psutil >= 2.0.0

%description
Tracer determines which applications use outdated files and prints them. For
Expand Down
6 changes: 3 additions & 3 deletions tracer/controllers/resource.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,13 @@ def render_processes(self):
view.render()

def render_packages(self):
timestamp = self.args.timestamp[0] if self.args.timestamp[0] else psutil.BOOT_TIME
timestamp = self.args.timestamp[0] if self.args.timestamp[0] else psutil.boot_time()
manager = System.package_manager()
packages = manager.packages_newer_than(timestamp)

view = PackagesView()
view.assign('packages', packages)
view.assign('boot_time', psutil.BOOT_TIME)
view.assign('boot_time', psutil.boot_time())
view.render()

def render_rules(self):
Expand All @@ -76,7 +76,7 @@ def render_applications(self):
view.render()

def render_system(self):
uptime = datetime.now() - datetime.fromtimestamp(psutil.BOOT_TIME)
uptime = datetime.now() - datetime.fromtimestamp(psutil.boot_time())
uptime = str(uptime).split('.')[0]

users = set([user.name for user in psutil.get_users()])
Expand Down
7 changes: 1 addition & 6 deletions tracer/resources/processes.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,7 @@ def files(self):
files.append(FilenameCleaner.strip(mmap.path))

# Process arguments
# this trick is for compatibility for 1.2.x psutil
try:
cmdline = self.cmdline()
except TypeError:
cmdline = self.cmdline
for arg in cmdline[1:]:
for arg in self.cmdline()[1:]:
if os.path.isfile(arg):
files.append(arg)

Expand Down
2 changes: 1 addition & 1 deletion tracer/resources/tracer.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def _modified_packages(self):
if self.specified_packages and self.now:
return self.specified_packages

timestamp = self.timestamp if self.timestamp else psutil.BOOT_TIME
timestamp = self.timestamp if self.timestamp else psutil.boot_time()
packages = self._PACKAGE_MANAGER.packages_newer_than(timestamp)
packages = packages.intersection(self.specified_packages)
return packages
Expand Down

0 comments on commit efad173

Please sign in to comment.