A few months ago at work, I installed Graphserver under Cygwin and got
it working. I just re-installed it to refresh my memory and document the
experience. Seems fairly painless. There is one tricky bit: pygs doesn't
correctly find the standard C library.
The culprit is the following line in pygs/graphserver/gsdll.py:
libc = cdll.LoadLibrary(find_library('c'))
A more general solution is to replace the above line with:
# Adapted from ctypes.test.test_loading
# Find and load the c runtime library
libc_name = None
if sys.platform == "cygwin":
libc_name = "cygwin1.dll"
else:
libc_name = find_library("c")
if not libc_name:
raise ImportError('could not determine which c runtime library to
use')
libc = cdll.LoadLibrary(libc_name)
With the above modification, I just ran the pygs nosetests, and all came
out OK except three:
======================================================================
FAIL: test_load_sample (test.gtfs_test.GTFSTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/Byrd/src/graphserver/pygs/test/gtfs_test.py", line 160, in
test_load_sample
leads_to( "gtfsEMSI", ('gtfsDADAN',) )
File "/home/Byrd/src/graphserver/pygs/test/gtfs_test.py", line 157, in
leads_to
assert vs == list(y), "%s vs %s" % (vs, list(y))
AssertionError: ['gtfsDADAN', 'gtfsDADAN', 'gtfsDADAN', 'gtfsDADAN',
'gtfsDADAN'] vs ['gtfsDADAN']
======================================================================
FAIL: test_spt_performance (test.unit_test.TestGraphPerformance)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/Byrd/src/graphserver/pygs/test/unit_test.py", line 774, in
test_spt_performance
assert average < limit
AssertionError:
-------------------- >> begin captured stdout << ---------------------
average runtime is 0.039100 s; limit 0.031000 s
--------------------- >> end captured stdout << ----------------------
======================================================================
FAIL: test_getstate (test.unit_test.TestStreet)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/Byrd/src/graphserver/pygs/test/unit_test.py", line 1008,
in test_getstate
assert s.__getstate__() == ('longstreet', 2, 0, 0)
AssertionError
----------------------------------------------------------------------
Ran 199 tests in 590.548s
FAILED (failures=3)
Failure 1:
If I comment out the assert in leads_to, the rest pass. Maybe this is
not really a problem, just the new graph type. Complains about some
missing commas in the sample feed's stop_times.txt.
Failure 2: Looks like it's just not running very fast.
Failure 3: state of street s at time of assertion is ('longstreet', 2.0,
0.0, 0.0, 1.0)
This is reasonable since the __getstate__ function in the street class
returns 4 elements.
I think the test is just outdated.
Another potential problem is that Cygwin Python is still at version 2.5,
and some Graphserver functions (serializing graphs I think) need the
zipfile module in Python 2.6. Apparently you have to build Python 2.6
without thread support to make it work under Cygwin.
Good luck,
Andrew Byrd
-----------------------------------
Andrew BYRD
165, rue Saint Maur
75011 Paris, France
email : and...@fastmail.net
cell/portable : +33(0)6 50 32 21 29
home/domicile : +33(0)1 71 19 56 66
-----------------------------------
No problem. If someone can confirm that my 3 failed tests are benign,
may I suggest that we incorporate this change to the C library loading
so future users can avoid this patching step? I will be using
Graphserver regularly over the next months (years?) at the office, so
I should be able to verify out-of-the-box Cygwin compatibility or
provide compatibility notes. I also need to serialize graphs, so I
will develop a workaround for that in the near future.
-Andrew Byrd