Checking for windows newlines

A while back I added windows/old-style-mac newline checking to the whitespace
checker, but got distracted before committing. Reviving it from the stash. This
should do the trick, but haven't checked it against windows files (guess we'll
get confirmation that it works or doesn't when we have one submitted).
Integ test relied on tor being in path

I thought that it was a safe assumption that tor was in our path since the
integ tests will only run if it can start tor. However, the tests have a
'--tor <path to tor>' argument which means that the tests may be running
without our path including the tor binary (or even having the binary called
'tor').

Changing the test to look for 'ls' or 'dir' instead since every platform that I
can think of has that. Caught by Karsten.
Python 2.5 doesn't have is_set() method for Events

In python 2.5 the threading module used camel case method names. They also
accepted the underscore convention (the 'official' style for python) in python
2.6, but until we drop 2.5 compatability we need to use the camel case
versions.
Python 2.5 doesn't have is_alive() method for Threads

Though it's not documented [1], the Thread class' isAlive() method was first
aliased to is_alive() in python 2.6. Also filed a ticket for the documentation
bug [2].

[1] http://docs.python.org/library/threading.html#threading.Thread.is_alive
[2] http://bugs.python.org/issue15126
Using theading's currrentThead() rather than current_thread()

The threading module's current_thead() function isn't availalbe in python 2.5.
It isn't documented, but there seems to have been a mass aliasing in 2.6 to the
underscore convention so using that instead.
Avoiding the 'with' keyword for tarfile

The tarfile's __exit__() method was added sometime after python 2.5, causing it
to produce a stacktrace if used via the 'with' keyword. Pity, yet another hack
to accomidate a six-year-old version of python...
Subprocess lacks a kill() method on python 2.5

The Popen.kill() ad Popen.terminate() methods were first added in python 2.6...
http://docs.python.org/library/subprocess.html#subprocess.Popen.kill

We can work around this with os.kill() but that only works on *nix...
http://stackoverflow.com/questions/552423/use-python-2-6-subprocess-module-in-python-2-5/552510#552510
Missed another tarfile 'with' declaration

Missed that we were using the 'with' keyword for a tarfile in the integ tests.
Using a try/catch instead so this'll work on python 2.5.
Respecting custom tor commands for process integ tests

The process integ tests were attempting to run 'tor', which naturally doesn't
work if it isn't in your path. Using the command that we're using for our main
test instance instead since that is sure to work.
get_pid_by_port() unavailable on Mac OSX

Tests for get_pid_by_port() are failing on Mac OSX 10.5.8 because sockstat is
unavailable and lsof neither provides ports nor accepts the flags we need.
Noting this in the pydocs/comments, and skipping its integ tests when on a mac.
Missing kill() fallback when ending integ tests

As an earlier commit mentioned, Popen.kill() is unavailable on python 2.5, and
its fallback (os.kill()) is unavailable on Windows. Accounting for this in the
integ test runner.
Respecting reader stop() calls in mid-directory

If we, say, attempted to read a directory with a million files then the
reader's stop() method won't be respected until we've finished with that
directory. That's stupid. Checking the _is_stopped Event after processing
each file.

Python lacks targeted breaks, so I needed to refactor the code a bit to
accomidate this.
Inverted check when falling back to kill a process

Oops, we're supposed to use os.kill() as a fallback if we *aren't* on windows.
OSX sucks at terminating processes

Our os.kill() call evidently doesn't kill tor right away on OSX, causing tests
to disrupt each other (port conflicts).
Python 2.5 and OSX compatability fixes
Stopping tor initialization timeout when done

Ok, I'm kinda surprised that we haven't tripped over this before. We never
terminate the tor initialization timeout on either or success or failure,
causing us to arbitrarily kill our process after 90 seconds.

This bug probably survived so long becuase our integ tests take less time than
that to complete, and then spawns a new tor instance resetting the timer again.
Remove single letter variable

According to the guidelines of our benevolent dictator we
must abolish the use of single letter variables. The sole
infiltrator has been abolished. Once again, there is peace in the land
of stem.