alliedmodders / ambuild

AlliedModders C++ Build System
BSD 3-Clause "New" or "Revised" License
61 stars 32 forks source link

Fix old buildscripts failing when calling Compiler.cxx.like() for VS projects #55

Closed peace-maker closed 6 years ago

peace-maker commented 6 years ago

The VS project generation frontend has a compatibility shim for old buildscripts accessing the Compiler.cxx or Compiler.cc attributes like

    cfg = builder.DetectCompilers()
    cxx = cfg.cxx

    if cxx.like('gcc'):
        # do something

The CompileShell is lacking a like method though, so generating VS files fails for such buildscripts.

C:\Users\User\Documents\GitHub\sourcepawn\vs>python ..\configure.py --enable-debug -g vs --build=all
Traceback (most recent call last):
  File "..\configure.py", line 41, in <module>
    run.Configure()
  File "C:\Users\User\AppData\Local\Programs\Python\Python36\lib\site-packages\ambuild2\frontend\v2_0\prep.py", line 121, in Configure
    if not builder.generate():
  File "C:\Users\User\AppData\Local\Programs\Python\Python36\lib\site-packages\ambuild2\frontend\v2_0\base\gen.py", line 274, in generate
    self.parseBuildScripts()
  File "C:\Users\User\AppData\Local\Programs\Python\Python36\lib\site-packages\ambuild2\frontend\v2_0\base\gen.py", line 183, in parseBuildScripts
    self.evalScript(root)
  File "C:\Users\User\AppData\Local\Programs\Python\Python36\lib\site-packages\ambuild2\frontend\v2_0\base\gen.py", line 243, in evalScript
    exec(code, new_vars)
  File "C:\Users\User\Documents\GitHub\sourcepawn\AMBuildScript", line 263, in <module>
    root.configure()
  File "C:\Users\User\Documents\GitHub\sourcepawn\AMBuildScript", line 34, in configure
    if cxx.like('gcc'):
AttributeError: 'CompilerShell' object has no attribute 'like'