Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1132)

Unified Diff: third_party/psutil/psutil/_compat.py

Issue 8774018: Add psutil build step to fix pyauto media issues. Upgrade psutil to 0.4.0. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Disable Mac builds. Created 9 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/psutil/psutil/_compat.py
diff --git a/third_party/psutil/psutil/_compat.py b/third_party/psutil/psutil/_compat.py
index 1cac8b7b6721ba99366945ac441761325e25f38f..b0ca8fd9ab94f3b963f93020b94ef6eda1657464 100644
--- a/third_party/psutil/psutil/_compat.py
+++ b/third_party/psutil/psutil/_compat.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
#
-# $Id: _compat.py 1142 2011-10-05 18:45:49Z g.rodola $
+# $Id: _compat.py 1145 2011-10-11 10:30:02Z g.rodola $
#
# Copyright (c) 2009, Jay Loden, Giampaolo Rodola'. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
@@ -119,36 +119,23 @@ except ImportError:
return result
-# dirty hack to support property.setter on python < 2.6
-property = property
-
-if not hasattr(property, "setter"):
-
- class property(property):
+# hack to support property.setter/deleter on python < 2.6
+# http://docs.python.org/library/functions.html?highlight=property#property
+if hasattr(property, 'setter'):
+ property = property
+else:
+ class property(__builtin__.property):
+ __metaclass__ = type
def __init__(self, fget, *args, **kwargs):
- self.__doc__ = fget.__doc__
super(property, self).__init__(fget, *args, **kwargs)
+ self.__doc__ = fget.__doc__
- def setter(self, fset):
- cls_ns = _sys._getframe(1).f_locals
- for k, v in cls_ns.iteritems():
- if v == self:
- propname = k
- break
- cls_ns[propname] = property(self.fget, fset,
- self.fdel, self.__doc__)
- return cls_ns[propname]
-
- def deleter(self, fdel):
- cls_ns = _sys._getframe(1).f_locals
- for k, v in cls_ns.iteritems():
- if v == self:
- propname = k
- break
- cls_ns[propname] = property(self.fget, self.fset,
- fdel, self.__doc__)
- return cls_ns[propname]
+ def getter(self, method):
+ return property(method, self.fset, self.fdel)
- __builtin__.property = property
+ def setter(self, method):
+ return property(self.fget, method, self.fdel)
+ def deleter(self, method):
+ return property(self.fget, self.fset, method)

Powered by Google App Engine
This is Rietveld 408576698