Carles Puigdemont, the Catalan separatist leader, is set to return to Spain after an amnesty law was confirmed to apply to him.