title: Check if --upgrade was passed during pip install
body: <p>In my setup.py file, I would like to check whether <code>--upgrade</code> was passed in <code>pip install ...</code> and if so I would like to run some code.</p>
  <p>In this example &quot;Hello World&quot; should only print if <code>--upgrade</code> was passed during pip install otherwise nothing should happen.</p>
  <pre><code># setup.py
  
  setup(...)
  
  if &quot;--upgrade was passed&quot;: # WHAT SHOULD I PUT HERE
    print(&quot;Hello World&quot;)
  </code></pre>
  <p>So if I ran <code>pip install package-name</code> the if statement would return false, but if I ran <code>pip install --upgrade package-name</code> the if statement would return true and the code inside it would run.</p>