Safe wheel import (#905)
Only allow wheel commands if wheel is installed
This commit is contained in:
Родитель
df0574db55
Коммит
93968d2572
|
@ -19,6 +19,7 @@
|
|||
- Callum Noble ([@callumnoble](https://github.com/callumnoble))
|
||||
- Christian Heimes ([@tiran](https://github.com/tiran))
|
||||
- Christoph Gohlke ([@cgohlke](https://github.com/cgohlke))
|
||||
- Christopher Bremner ([@chrisjbremner](https://github.com/chrisjbremner))
|
||||
- Christopher Pow ([@christopherpow](https://github.com/christopherpow))
|
||||
- Daniel Fernandez ([@fdanny](https://github.com/fdanny))
|
||||
- Daniel Santana ([@dgsantana](https://github.com/dgsantana))
|
||||
|
|
|
@ -14,6 +14,7 @@ This document follows the conventions laid out in [Keep a CHANGELOG][].
|
|||
### Changed
|
||||
|
||||
- Added argument types information to "No method matches given arguments" message
|
||||
- Moved wheel import in setup.py inside of a try/except to prevent pip collection failures
|
||||
|
||||
### Fixed
|
||||
|
||||
|
|
47
setup.py
47
setup.py
|
@ -15,10 +15,14 @@ import sys
|
|||
import sysconfig
|
||||
from distutils import spawn
|
||||
from distutils.command import install, build, build_ext, install_data, install_lib
|
||||
from wheel import bdist_wheel
|
||||
|
||||
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
|
||||
|
@ -594,21 +598,21 @@ class InstallPythonnet(install.install):
|
|||
_update_xlat_devtools()
|
||||
return install.install.run(self)
|
||||
|
||||
if bdist_wheel:
|
||||
class BDistWheelPythonnet(bdist_wheel.bdist_wheel):
|
||||
user_options = bdist_wheel.bdist_wheel.user_options + [("xplat", None, None)]
|
||||
|
||||
class BDistWheelPythonnet(bdist_wheel.bdist_wheel):
|
||||
user_options = bdist_wheel.bdist_wheel.user_options + [("xplat", None, None)]
|
||||
def initialize_options(self):
|
||||
bdist_wheel.bdist_wheel.initialize_options(self)
|
||||
self.xplat = None
|
||||
|
||||
def initialize_options(self):
|
||||
bdist_wheel.bdist_wheel.initialize_options(self)
|
||||
self.xplat = None
|
||||
def finalize_options(self):
|
||||
bdist_wheel.bdist_wheel.finalize_options(self)
|
||||
|
||||
def finalize_options(self):
|
||||
bdist_wheel.bdist_wheel.finalize_options(self)
|
||||
|
||||
def run(self):
|
||||
if self.xplat:
|
||||
_update_xlat_devtools()
|
||||
return bdist_wheel.bdist_wheel.run(self)
|
||||
def run(self):
|
||||
if self.xplat:
|
||||
_update_xlat_devtools()
|
||||
return bdist_wheel.bdist_wheel.run(self)
|
||||
|
||||
###############################################################################
|
||||
|
||||
|
@ -621,6 +625,15 @@ setup_requires = []
|
|||
if not os.path.exists(_get_interop_filename()):
|
||||
setup_requires.append("pycparser")
|
||||
|
||||
cmdclass={
|
||||
"install": InstallPythonnet,
|
||||
"build_ext": BuildExtPythonnet,
|
||||
"install_lib": InstallLibPythonnet,
|
||||
"install_data": InstallDataPythonnet,
|
||||
}
|
||||
if bdist_wheel:
|
||||
cmdclass["bdist_wheel"] = BDistWheelPythonnet
|
||||
|
||||
setup(
|
||||
name="pythonnet",
|
||||
version="2.4.1-dev",
|
||||
|
@ -633,13 +646,7 @@ setup(
|
|||
long_description=_get_long_description(),
|
||||
ext_modules=[Extension("clr", sources=list(_get_source_files()))],
|
||||
data_files=[("{install_platlib}", ["{build_lib}/Python.Runtime.dll"])],
|
||||
cmdclass={
|
||||
"install": InstallPythonnet,
|
||||
"build_ext": BuildExtPythonnet,
|
||||
"install_lib": InstallLibPythonnet,
|
||||
"install_data": InstallDataPythonnet,
|
||||
"bdist_wheel": BDistWheelPythonnet,
|
||||
},
|
||||
cmdclass=cmdclass,
|
||||
classifiers=[
|
||||
"Development Status :: 5 - Production/Stable",
|
||||
"Intended Audience :: Developers",
|
||||
|
|
Загрузка…
Ссылка в новой задаче