File: util2.py

package info (click to toggle)
pyro 1%3A3.14-5
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 2,048 kB
  • ctags: 1,988
  • sloc: python: 11,194; xml: 128; sh: 52; makefile: 28
file content (35 lines) | stat: -rw-r--r-- 835 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#############################################################################
#
#	Pyro Utilities (part 2, to avoid circular dependencies)
#	User code should never import this, always use Pyro.util!
#
#	This is part of "Pyro" - Python Remote Objects
#	which is (c) Irmen de Jong - irmen@razorvine.net
#
#############################################################################

_supports_mt=None
_supports_comp=None

def supports_multithreading():
	global _supports_mt
	if _supports_mt is None:
		try:
			from threading import Thread, Lock
			_supports_mt=1
		except:
			_supports_mt=0
	return _supports_mt
	
def supports_compression():
	global _supports_comp
	if _supports_comp is None:
		try:
			import zlib
			_supports_comp=1
		except:
			_supports_comp=0
	return _supports_comp

if supports_multithreading():
	import threading