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

Side by Side Diff: third_party/twisted_8_1/twisted/python/runtime.py

Issue 12261012: Remove third_party/twisted_8_1 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/build
Patch Set: Created 7 years, 10 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1
2 # Copyright (c) 2001-2004 Twisted Matrix Laboratories.
3 # See LICENSE for details.
4
5
6 # System imports
7 import os
8 import sys
9 import time
10 import imp
11
12 def shortPythonVersion():
13 hv = sys.hexversion
14 major = (hv & 0xff000000L) >> 24
15 minor = (hv & 0x00ff0000L) >> 16
16 teeny = (hv & 0x0000ff00L) >> 8
17 return "%s.%s.%s" % (major,minor,teeny)
18
19 knownPlatforms = {
20 'nt': 'win32',
21 'ce': 'win32',
22 'posix': 'posix',
23 'java': 'java',
24 'org.python.modules.os': 'java',
25 }
26
27 _timeFunctions = {
28 #'win32': time.clock,
29 'win32': time.time,
30 }
31
32 class Platform:
33 """Gives us information about the platform we're running on"""
34
35 type = knownPlatforms.get(os.name)
36 seconds = staticmethod(_timeFunctions.get(type, time.time))
37
38 def __init__(self, name=None):
39 if name is not None:
40 self.type = knownPlatforms.get(name)
41 self.seconds = _timeFunctions.get(self.type, time.time)
42
43 def isKnown(self):
44 """Do we know about this platform?"""
45 return self.type != None
46
47 def getType(self):
48 """Return 'posix', 'win32' or 'java'"""
49 return self.type
50
51 def isMacOSX(self):
52 """Return if we are runnng on Mac OS X."""
53 return sys.platform == "darwin"
54
55 def isWinNT(self):
56 """Are we running in Windows NT?"""
57 if self.getType() == 'win32':
58 import _winreg
59 try:
60 k=_winreg.OpenKeyEx(_winreg.HKEY_LOCAL_MACHINE,
61 r'Software\Microsoft\Windows NT\CurrentVersi on')
62 _winreg.QueryValueEx(k, 'SystemRoot')
63 return 1
64 except WindowsError:
65 return 0
66 # not windows NT
67 return 0
68
69 def isWindows(self):
70 return self.getType() == 'win32'
71
72 def supportsThreads(self):
73 """Can threads be created?
74 """
75 try:
76 return imp.find_module('thread')[0] is None
77 except ImportError:
78 return False
79
80 platform = Platform()
81 platformType = platform.getType()
82 seconds = platform.seconds
OLDNEW
« no previous file with comments | « third_party/twisted_8_1/twisted/python/roots.py ('k') | third_party/twisted_8_1/twisted/python/shortcut.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698