[buildcore] Remove duplicate defines and add extra detection for Python 3
[buildcore] Remove duplicate defines and add extra detection for Python 3

wombatant/nostalgia,wombatant/nostalgia,wombatant/nostalgia