Skip to content

Commit 4954266

Browse files
authored
Merge pull request #2691 from echoix/simplify-haveWheel-setup.py
Simplify haveWheel condition in setup.py
2 parents 45f9e89 + f8c8571 commit 4954266

File tree

2 files changed

+18
-25
lines changed

2 files changed

+18
-25
lines changed

requirements/devel.txt

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ appdirs
44
setuptools
55
sip == 6.9.1
66

7-
wheel
87
twine
98
requests >= 2.26.0
109
cython==3.0.10

setup.py

+18-24
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@
2323
from buildtools.config import Config, msg, opj, runcmd, canGetSOName, getSOName
2424
import buildtools.version as version
2525

26-
haveWheel = True
27-
2826
# Create a buildtools.config.Configuration object
2927
cfg = Config(noWxConfig=True)
3028
DOCS_BASE='http://docs.wxPython.org'
@@ -174,30 +172,28 @@ def run(self):
174172
# Run the default bdist_egg command
175173
orig_bdist_egg.run(self)
176174

175+
class wx_bdist_wheel(orig_bdist_wheel):
176+
def finalize_options(self):
177+
# Do a bit of monkey-patching to let bdist_wheel know that there
178+
# really are extension modules in this build, even though they are
179+
# not built here.
180+
def _has_ext_modules(self):
181+
return True
182+
from setuptools.dist import Distribution
183+
#Distribution.is_pure = _is_pure
184+
Distribution.has_ext_modules = _has_ext_modules
177185

178-
if haveWheel:
179-
class wx_bdist_wheel(orig_bdist_wheel):
180-
def finalize_options(self):
181-
# Do a bit of monkey-patching to let bdist_wheel know that there
182-
# really are extension modules in this build, even though they are
183-
# not built here.
184-
def _has_ext_modules(self):
185-
return True
186-
from setuptools.dist import Distribution
187-
#Distribution.is_pure = _is_pure
188-
Distribution.has_ext_modules = _has_ext_modules
189-
190-
orig_bdist_wheel.finalize_options(self)
186+
orig_bdist_wheel.finalize_options(self)
191187

192188

193-
def run(self):
194-
# Ensure that there is a basic library build for bdist_egg/wheel to pull from.
195-
self.run_command("build")
189+
def run(self):
190+
# Ensure that there is a basic library build for bdist_egg/wheel to pull from.
191+
self.run_command("build")
196192

197-
_cleanup_symlinks(self)
193+
_cleanup_symlinks(self)
198194

199-
# Run the default bdist_wheel command
200-
orig_bdist_wheel.run(self)
195+
# Run the default bdist_wheel command
196+
orig_bdist_wheel.run(self)
201197

202198

203199
class wx_install(orig_install):
@@ -233,10 +229,8 @@ def run(self):
233229
'bdist_egg' : wx_bdist_egg,
234230
'install' : wx_install,
235231
'sdist' : wx_sdist,
232+
'bdist_wheel' : wx_bdist_wheel,
236233
}
237-
if haveWheel:
238-
CMDCLASS['bdist_wheel'] = wx_bdist_wheel
239-
240234

241235

242236
#----------------------------------------------------------------------

0 commit comments

Comments
 (0)