Can we fool Python for Cygwin as being on the win32 platform? (for installing PyBluez)

I want to use Python packaged with Cygwin on Windows. I need to install PyBluez, a Python Bluetooth binding. I installed it with easy_install, no problem. I know that it works well with the Python version for Windows since I installed .exe to install PyBluez and did some tests.

However, I do not want to use the Python version for Windows, but for Cygwin. But actually installation with easy_install or directly from tarball does not work well (no error messages, but it is not fully installed). The reason seems simple: there are some conditional statements in several files:

if sys.platform == 'win32':
...
elif sys.platform == 'linux2':
...
elif sys.platform == 'darwin':
...

Unfortunately, when I run Python for Cygwin, the platform:

$ python

>>> import sys
>>> sys.platform
'cygwin'

, , Python Windows Cygwin:

$ /cygdrive/d/Programs/Python26/python -i

>>> import sys
>>> sys.platform
'win32'

Python PyBluez, "win32", "cygwin":

if sys.platform == 'win32' or sys.platform == 'cygwin':
...

, 1) , 2) : PyBluez, , __init__.py:

if sys.platform == "win32":
    _dbg("trying widcomm")
    have_widcomm = False
    dll = "wbtapi.dll"
    sysroot = os.getenv ("SystemRoot")
    ...

os.getenv( "SystemRoot" ) Python Windows, Python Cygwin.

, : Python Cygwin, , win32 ?

, ? ( Windows, -).

PyBluez, .

+5

All Articles