Py3k port of python-daemon

Aaron Maxwell amax at redsymbol.net
Sat May 19 23:28:26 UTC 2012


Hi all,

Based on my experiences porting Python-daemon 1.5.5 to work on our Python 3.2 
stack, I have ported it to over to the (recent) tip of the mainline branch.  
Ben, you can get the merge bundles here (created via bzr send):

http://files.redsymbol.net/bfinney/lockfile-amax-py3k.gz

http://files.redsymbol.net/bfinney/python-daemon-amax-py3k.gz

(Please let me know if they are in a usable format for you - I'm still kind of 
learning bzr.)

I was able to run all the tests and get all but one to pass (see below), and 
verify that the ported version will at least run and load with some simple 
daemons.

Once it is merged, run tests like so:
1) download my py3k-patched minimock from 
http://files.redsymbol.net/bfinney/minimock.tar.gz
2) Provide daemon/version/version_info.py.  See below.
3) Ensure the correct python-daemon, lockfile, and minimocks are in python 
path.
4) Run python 3.2's version of nosetests.  (There may be other ways to run the 
tests, this is just how I did it.)

I haven't tested it on any version of Python prior to 3.2.  Nor on 3.3, but I 
believe it will work fine on that.

Re: version_info.py: I didn't figure out to regenerate this file, so I copied 
the one from python 1.5.5 into daemon/version/ in my working copy.  There were 
some py3k issues in this file, which are simple enough to fix, but should really 
be handled in the program that generates it.  Here's one version that you can 
probably just download and drop in:

https://github.com/mobilewebup/python-daemon-1.5.5-
py3k/raw/master/daemon/version/version_info.py

One test does not pass - test_return_set_omits_streams_without_file_descriptors 
in test_daemon:

{{{
amax at epic:~/wdir/bzr/python-daemon.amax-tip nosetests 
test.test_daemon.DaemonContext_get_exclude_file_descriptors_TestCase
...E
======================================================================
ERROR: Should omit any stream without a file descriptor.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/amax/wdir/bzr/python-daemon.amax-tip/test/test_daemon.py", line 
813, in test_return_set_omits_streams_without_file_descriptors
    result = instance._get_exclude_file_descriptors()
  File "/home/amax/wdir/bzr/python-daemon.amax-tip/daemon/daemon.py", line 
430, in _get_exclude_file_descriptors
    exclude_descriptors.add(item.fileno())
io.UnsupportedOperation: fileno

----------------------------------------------------------------------
Ran 4 tests in 0.054s
}}}

I'm not convinced I understand correctly enough the nuances of what the code 
is actually supposed to do, so I ended up backing out my attempted changes and 
just left it failing.

As for real-world testing, I have a py3k-ported version of python-daemon 1.5.5 
and lockfile 0.9.1 (which doesn't officially exist ;) that has been running 
pretty well in production.  This is a bit different from the patches offered 
here, since they're on the development head of both repos (python-daemon and 
lockfile).  In other words, I just took my steps to port over 1.5.5, redid them 
for the development head, made all but one of the tests pass, and verified it 
would run a simple daemon program with no obvious errors. So it will need some 
more rigorous testing before being unleashed on the world.

Ben, please let me know if I have given you everything you need to utilize 
this is your own branches. 

Cheers,
Aaron


-- 
Aaron Maxwell
http://redsymbol.net



More information about the python-daemon-devel mailing list