Ansible Vs Cygwin

with tags ansible cywin pip cffi -

New year, New job, New laptop.

As part of the fun and games when changing job I’ve been handed a windows laptop and rather than immediately running off and installing a Linux distro or whining till they gave me a mac I decided to stick with it. Unfortunately due to $Reasons, upgrading to Win10 anniversary edition to make use of the windows subsystem for linux is also out :(

Cygwin to save the day

So after installing all the usual tools I found I need to be able to work with ansible for which there is no windows binary and rather than having to bother with jumping onto a local vm every time I wanted to play with it I figured it can’t be that hard to get working … and it wasn’t except for one little package.

When attempting to run pip install ansible the cryptography dependency kept bombing out on install

Installing collected packages: cryptography, paramiko, jinja2, PyYAML, ansible
 Running setup.py install for cryptography ... error
   Complete output from command /usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-L55Y3E/cryptography/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-BRA9am-record/install-record.txt --single-version-externally-managed --compile:
   Traceback (most recent call last):
     File "<string>", line 1, in <module>
     File "/tmp/pip-build-L55Y3E/cryptography/setup.py", line 334, in <module>
       **keywords_with_side_effects(sys.argv)
     File "/usr/lib/python2.7/distutils/core.py", line 111, in setup
       _setup_distribution = dist = klass(attrs)
     File "/usr/lib/python2.7/site-packages/setuptools/dist.py", line 320, in __init__
       _Distribution.__init__(self, attrs)
     File "/usr/lib/python2.7/distutils/dist.py", line 287, in __init__
       self.finalize_options()
     File "/usr/lib/python2.7/site-packages/setuptools/dist.py", line 387, in finalize_options
       ep.load()(self, ep.name, value)
     File "/usr/lib/python2.7/site-packages/cffi/setuptools_ext.py", line 187, in cffi_modules
       add_cffi_module(dist, cffi_module)
     File "/usr/lib/python2.7/site-packages/cffi/setuptools_ext.py", line 49, in add_cffi_module
       execfile(build_file_name, mod_vars)
     File "/usr/lib/python2.7/site-packages/cffi/setuptools_ext.py", line 25, in execfile
       exec(code, glob, glob)
     File "src/_cffi_src/build_openssl.py", line 85, in <module>
       extra_link_args=extra_link_args(compiler_type()),
     File "/tmp/pip-build-L55Y3E/cryptography/src/_cffi_src/utils.py", line 61, in build_ffi_for_binding
       extra_link_args=extra_link_args,
     File "/tmp/pip-build-L55Y3E/cryptography/src/_cffi_src/utils.py", line 70, in build_ffi
       ffi.cdef(cdef_source)
     File "/usr/lib/python2.7/site-packages/cffi/api.py", line 106, in cdef
       self._parser.parse(csource, override=override, packed=packed)
     File "/usr/lib/python2.7/site-packages/cffi/cparser.py", line 165, in parse
       self._internal_parse(csource)
     File "/usr/lib/python2.7/site-packages/cffi/cparser.py", line 199, in _internal_parse
       realtype = self._get_type(decl.type, name=decl.name)
     File "/usr/lib/python2.7/site-packages/cffi/cparser.py", line 356, in _get_type
       return resolve_common_type(ident)
     File "/usr/lib/python2.7/site-packages/cffi/commontypes.py", line 38, in resolve_common_type
       "if you think it should be." % (commontype,))
   cffi.api.FFIError: Unsupported type: 'int __dotdotdot__'.  Please file a bug if you think it should be.

Fortunately this was quickly remedied by a quick pip uninstall ciff followed by rerunning pip install ansible

I’ve not yet bothered to dig into how I managed to break the cffi package but a quick reinstall did the job and I can now ansible locally to my hearts content.

Written by
Older article
AWS Renewal