There are two general ways a tub spout is attached to the pipe: push-on, which then has a setscrew to lock it in place (uses O-rings for seals), or screw on, which requires either a threaded pipe or a soldered on threaded adapter. I don't work with them much, but it appears yours must be a push on type. It looks like that fitting in the end may be a twist lock arrangement that holds the spout to the adapter and pipe, and the part at the end would be first installed, then locked down onto the pipe stub. Can you see a dent or scratch on the bottom of the pipe where there may have been a setscrew holding it in place? Is there a corresponding hole on the bottom of the spout? If so, it probably uses an Allen wrench, but a few have a straight slot for a setscrew. If there is no slot for a screw, then the adapter must come off the spout, and that is locked onto the pipe, then the spout is attached afterwards.