Skip to content

Safe wheel import #905

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jul 3, 2019
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Move wheel try/except to the top
  • Loading branch information
chrisjbremner committed Jul 3, 2019
commit 16dcc1d3f40a93e44f8ab62e7e674cd29ecf5c4b
15 changes: 7 additions & 8 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@

from setuptools import Extension, setup

try:
from wheel import bdist_wheel
except ImportError:
bdist_wheel = None

# Allow config/verbosity to be set from cli
# http://stackoverflow.com/a/4792601/5208670
CONFIG = "Release" # Release or Debug
Expand Down Expand Up @@ -593,8 +598,7 @@ def run(self):
_update_xlat_devtools()
return install.install.run(self)

try:
from wheel import bdist_wheel
if bdist_wheel:
class BDistWheelPythonnet(bdist_wheel.bdist_wheel):
user_options = bdist_wheel.bdist_wheel.user_options + [("xplat", None, None)]

Expand All @@ -609,9 +613,6 @@ def run(self):
if self.xplat:
_update_xlat_devtools()
return bdist_wheel.bdist_wheel.run(self)
except ImportError:
import warnings
warnings.warn("Wheel not installed, bdist_wheel command is disabled", stacklevel=2)

###############################################################################

Expand All @@ -630,10 +631,8 @@ def run(self):
"install_lib": InstallLibPythonnet,
"install_data": InstallDataPythonnet,
}
try:
if bdist_wheel:
cmdclass["bdist_wheel"] = BDistWheelPythonnet
except NameError:
pass

setup(
name="pythonnet",
Expand Down