Stable localized spatial solitons in $$\mathcal {PT}$$PT-symmetric potentials with power-law nonlinearity