On Apr 7, 2010, at 1:05 PM, Török Edwin wrote:
> Is there a way to detect if python was built with THREADS on or off?
> 
> I currently do this test:
> 
> python -V || { echo "Python not found, skipping LLVM tests"; exit 77; }
> python <<EOF
> import sys
> if sys.hexversion < 0x2040000: sys.exit(1)
> EOF
> test $? -eq 0 || { echo "Python version older than 2.4, skipping LLVM
> tests"; exit 77; }
> 
> If its not too complicated to detect THREADS, I can add that too, and
> then skip 'make check' if a broken python is installed (maybe printing
> only a warning).

I believe you can simply try to "import threading" (which should pull in thread 
or dummy_thread, etc depending on whether the local system has Posix threads):

% python -c "import threading"
% echo $?
0
% python -c "import no_such_module"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ImportError: No module named no_such_module
% echo $?
1

Regards,
-- 
-Chuck

_______________________________________________
Help us build a comprehensive ClamAV guide: visit http://wiki.clamav.net
http://www.clamav.net/support/ml

Reply via email to