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

Unified Diff: third_party/disk_usage/disk_usage.py

Issue 648353002: Remove Skia's forked buildbot code (Closed) Base URL: https://skia.googlesource.com/buildbot.git@master
Patch Set: Address comment Created 6 years, 2 months 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
« no previous file with comments | « third_party/disk_usage/__init__.py ('k') | tools/download_skp_repo.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/disk_usage/disk_usage.py
diff --git a/third_party/disk_usage/disk_usage.py b/third_party/disk_usage/disk_usage.py
deleted file mode 100644
index 18b3c359dc7ccf18ad186a13c5a9cc9b995b8739..0000000000000000000000000000000000000000
--- a/third_party/disk_usage/disk_usage.py
+++ /dev/null
@@ -1,45 +0,0 @@
-#!/usr/bin/env python
-
-"""
-Return disk usage statistics about the given path as a (total, used, free)
-namedtuple. Values are expressed in bytes.
-"""
-# Author: Giampaolo Rodola' <g.rodola [AT] gmail [DOT] com>
-# License: MIT
-
-import os
-import collections
-
-_ntuple_diskusage = collections.namedtuple('usage', 'total used free')
-
-if hasattr(os, 'statvfs'): # POSIX
- def disk_usage(path):
- st = os.statvfs(path)
- free = st.f_bavail * st.f_frsize
- total = st.f_blocks * st.f_frsize
- used = (st.f_blocks - st.f_bfree) * st.f_frsize
- return _ntuple_diskusage(total, used, free)
-
-elif os.name == 'nt': # Windows
- import ctypes
- import sys
-
- def disk_usage(path):
- _, total, free = ctypes.c_ulonglong(), ctypes.c_ulonglong(), \
- ctypes.c_ulonglong()
- if sys.version_info >= (3,) or isinstance(path, unicode):
- fun = ctypes.windll.kernel32.GetDiskFreeSpaceExW
- else:
- fun = ctypes.windll.kernel32.GetDiskFreeSpaceExA
- ret = fun(path, ctypes.byref(_), ctypes.byref(total), ctypes.byref(free))
- if ret == 0:
- raise ctypes.WinError()
- used = total.value - free.value
- return _ntuple_diskusage(total.value, used, free.value)
-else:
- raise NotImplementedError("platform not supported")
-
-disk_usage.__doc__ = __doc__
-
-if __name__ == '__main__':
- print disk_usage(os.getcwd())
« no previous file with comments | « third_party/disk_usage/__init__.py ('k') | tools/download_skp_repo.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698