spglib: installation fails on Windows due to no CFLAGS config var

In setup.py:

import sysconfig
config_var = sysconfig.get_config_var("CFLAGS")
if "-Werror=declaration-after-statement" in config_var:
    os.environ['CFLAGS'] = config_var.replace(
        "-Werror=declaration-after-statement", "")    

Fails with

Traceback (most recent call last):
  File "setup.py", line 22, in <module>
    if "-Werror=declaration-after-statement" in config_var:
TypeError: argument of type 'NoneType' is not iterable

because config_var is None on my system (Windows, Conda Python 3). You could perhaps change the condition to be if config_var and ("-Werror=declaration-after-statement" in config_var):.

My end goal is to install spglib in a windows conda py3 environment, so if you could conda build windows versions as part of your conda build procedure when you release new versions, that would be ideal.

Thank you for maintaining such an excellent library!

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 16 (7 by maintainers)

Most upvoted comments

But anyway thanks for reporting it. By this I could know there are at least some (and possibly more) spglib users on windows, which was beyond my imagination.

Yes. Please wait for a while to prepare the conda (and PyPI) package with this fix.