The details may differ, but the political calculations made by President Barack Obama in 2008 and Donald Trump in 2016 are eerily similar. | Getty

I’ll protect your livelihoods, the newly elected president promised factory employees whose jobs were in danger.

I’ll save you money by rejecting a costly overhaul of my own aircraft, he told taxpayers a couple of weeks later.

I’ll spend billions to repair the country’s crumbling roads and bridges, creating jobs in the process, he told Congress.

I’ll sell my agenda by using the bully pulpit, he told the press, holding rallies around the country and shaming corporate greed that comes at the expense of ordinary people. And to do it all, he would set up a new political organization to pressure anyone who refused to play along.

His opponents were horrified, and said he was abusing the power of the Oval Office.

The year was 2009. The new president was Barack Obama.

Flash forward to today: Donald Trump is following much the same political blueprint his predecessor and longtime adversary laid out years ago, signaling he’ll actively intervene in the U.S. economy while antagonizing free-marketeers who say his meddling will end in disaster. It’s a funhouse-mirror version of Obama’s early image of the presidency — the man of action for down-and-out Americans who desperately want to see that somebody is on their side.

Only this time, Democrats aren’t hailing the president-to-be’s efforts as a needed corrective to capitalism run amok. And Republicans, aside from a principled few, aren’t quoting from dog-eared copies of The Road to Serfdom to warn of impending socialist tyranny. The parties have almost completely reversed positions in response to Trump, testament to the Death Star-like pull of Washington partisanship.

The situations are, of course, vastly different: Obama was inheriting an economy in freefall, with the economy losing 500,000 jobs a month, while Trump enters office with an unemployment rate of just 4.6 percent. As is the message: Obama spoke of building a high-tech economy for the future; Trump vows to bring back the jobs of yesteryear. And the style: Trump threatens punishment; Obama tried persuasion.

Still, the superficial parallels are striking: Trump cut a deal with Carrier to keep jobs from going to Mexico, much like Obama asked the CEO of Caterpillar to halt planned layoffs. Trump said a planned upgrade of Air Force One was a waste of money, while Obama said he didn’t need expensive new Marine One helicopters. Trump wants a $1 trillion infrastructure package, while Obama eventually settled for $830 billion. Trump has launched a “thank you tour” of states he won, while Obama stumped for his stimulus bill. And both men believed in the need to set up an external political arm — Obama for America vs. Trump’s reported Unleash the Potential — to keep their grass-roots bases fired up and ready to go.

The details may differ, but the political calculations are eerily similar — so much so that the president’s former campaign and White House guru, David Axelrod, has recognized the potency of Trump’s economic showmanship.

“Without knowing details of what was promised, any fair reading is that the Carrier intervention is a good early win for @realDonaldTrump,” Axelrod tweeted on Dec. 1. And again on Tuesday, sharing the results of a…