Skip to content

Commit

Permalink
Only download vswhere if on windows (#240)
Browse files Browse the repository at this point in the history
This updates the setup.py script used for installing edk2-pytool-extensions as a pypi module to only install vswhere if we are on a windows device.
  • Loading branch information
Javagedes authored Jan 31, 2023
1 parent 9866ead commit c734b17
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,32 +12,39 @@
from setuptools.command.install import install
from setuptools.command.develop import develop
from edk2toollib.windows.locate_tools import _DownloadVsWhere
from edk2toollib.utility_functions import GetHostInfo

with open("readme.md", "r") as fh:
long_description = fh.read()


def _download_vswhere_if_windows(): # noqa
"""Downloads vswhere only if on the windows OS."""
if GetHostInfo().os == "Windows":
_DownloadVsWhere()


class PostSdistCommand(sdist): # noqa
"""Post-sdist."""
def run(self): # noqa
# we need to download vswhere so throw the exception if we don't get it
_DownloadVsWhere()
_download_vswhere_if_windows()
sdist.run(self)


class PostInstallCommand(install): # noqa
"""Post-install."""
def run(self): # noqa
install.run(self)
_DownloadVsWhere()
_download_vswhere_if_windows()


class PostDevCommand(develop): # noqa
"""Post-develop."""
def run(self): # noqa
develop.run(self)
try:
_DownloadVsWhere()
_download_vswhere_if_windows()
except:
pass

Expand Down

0 comments on commit c734b17

Please sign in to comment.