Move atoi() into atoi.py and add a new debug2() debug level.

atoi() was getting redundant, and unfortunately we can't easily load
helpers.py in some places where we'd want to, because it depends on vars.py.
So move it to its own module.
This commit is contained in:
Avery Pennarun 2010-11-16 04:13:17 -08:00
commit 94b0e7166e
5 changed files with 19 additions and 21 deletions

View file

@ -2,6 +2,7 @@
# beware the jobberwack
#
import sys, os, errno, select, fcntl
import atoi
_toplevel = 0
_mytokens = 1
@ -14,13 +15,6 @@ def _debug(s):
sys.stderr.write('jwack#%d: %s' % (os.getpid(),s))
def _atoi(v):
try:
return int(v or 0)
except ValueError:
return 0
def _release(n):
global _mytokens
_debug('release(%d)\n' % n)
@ -60,8 +54,8 @@ def setup(maxjobs):
s = flags[ofs+len(FIND):]
(arg,junk) = s.split(' ', 1)
(a,b) = arg.split(',', 1)
a = _atoi(a)
b = _atoi(b)
a = atoi.atoi(a)
b = atoi.atoi(b)
if a <= 0 or b <= 0:
raise ValueError('invalid --jobserver-fds: %r' % arg)
try: