This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Embedded/nuget packages incorrectly reference bdist_wininst
Type: behavior Stage: resolved
Components: Windows Versions: Python 3.7, Python 3.6, Python 3.5
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: steve.dower Nosy List: larry, ned.deily, paul.moore, python-dev, steve.dower, tim.golden, zach.ware
Priority: Keywords: patch

Created on 2016-11-23 18:29 by steve.dower, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
no_bdist_wininst.patch steve.dower, 2016-11-23 18:29
28783_1.patch steve.dower, 2016-12-11 07:23
Messages (16)
msg281576 - (view) Author: Steve Dower (steve.dower) * (Python committer) Date: 2016-11-23 18:29
For the embedded zip and nuget releases, I've omitted bdist_wininst. However, I forgot to remove the reference to it from distutils.command.__init__.__all__, and so setuptools will occasionally crash trying to import it.

This patch updates Tools/msi/make_zip.py to exclude the default distutils.command.__init__ and substitute a copy that does not have the added reference in it.

Doing something "smarter" in the actual Lib/distutils/command/__init__.py isn't really an option. The only reliable option is to import the module eagerly, which I don't want to do. Including bdist_wininst in these packages is also a bad option (I considered completely removing distutils from them, but it has *some* uses - can't say the same for bdist_wininst though).

Ned - I'd like to apply this change to 3.6. The patch is against 3.5, and there may be some subtle differences when I merge it forward (not every change to make_zip.py has been backported), but the intent is well captured here. If this is not applied to 3.6, then the packages will not be reliably usable with pip/setuptools, which is one of the intended uses (particularly for the nuget package).
msg281577 - (view) Author: Steve Dower (steve.dower) * (Python committer) Date: 2016-11-23 18:34
The full fix may also require updating setuptools, which I'm pursuing, but we also should stop referring to a module that isn't there.
msg281578 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2016-11-23 18:57
I'd like one of the other Windows folks to review it but, in principle, LGTM.
msg281581 - (view) Author: Paul Moore (paul.moore) * (Python committer) Date: 2016-11-23 19:17
I've had a look. I agree in principle with the change, and the code looks OK on inspection, although I can't really test it. As it's only a change to one of the scripts in tools/msi, this seems like a low-risk change to me, so I'm OK with it.
msg281583 - (view) Author: Steve Dower (steve.dower) * (Python committer) Date: 2016-11-23 19:38
A convenient test is:

    python.exe -c "import distutils.core; distutils.core.setup()" --help-comm
ands

Without the fix, it raises "distutils.errors.DistutilsModuleError: invalid command 'bdist_wininst'".

But yes, unfortunately the fix is not particularly direct here. I've validated that it works, and since it really only has to work on my machine (right now) that's actually pretty good coverage :)
msg281584 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2016-11-23 20:23
New changeset f7aa200bed8d by Steve Dower in branch '3.5':
Issue #28783: Embedded and nuget packages incorrect reference missing bdist_wininst command.
https://hg.python.org/cpython/rev/f7aa200bed8d

New changeset a3755890545c by Steve Dower in branch '3.6':
Issue #28783: Embedded and nuget packages incorrect reference missing bdist_wininst command.
https://hg.python.org/cpython/rev/a3755890545c

New changeset 831f73efe3a6 by Steve Dower in branch 'default':
Issue #28783: Embedded and nuget packages incorrect reference missing bdist_wininst command.
https://hg.python.org/cpython/rev/831f73efe3a6
msg281585 - (view) Author: Steve Dower (steve.dower) * (Python committer) Date: 2016-11-23 20:25
Thanks.

For reference, the setuptools issue is https://github.com/pypa/setuptools/issues/857

A setuptools install from source should be fixed by this change, though an install from a wheel (which is now typical, unfortunately) requires a separate fix. But we've done our part now.
msg282907 - (view) Author: Steve Dower (steve.dower) * (Python committer) Date: 2016-12-11 07:23
I have a better fix for this issue in the attached patch. It doesn't require any change to setuptools in order to avoid crashing when installing from sdist (e.g. Cython).

As before, this only involves changing the nuget package and its build scripts, so there is zero risk to the main installer. It's even simpler than before too, because I can reuse the infrastructure that was added. (That said, I haven't tested this patch with a real build on the real build machine yet - I will do so before committing.)

Ned - can I get this in for 3.6.0? If not, I'll patch the file by hand before publishing the nuget packages.
msg282941 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2016-12-11 20:14
I agree that the risk if this is applied appears to be minimal.  If Paul or Zack are OK with it and your testing is successful, I'll plan on cherrypicking it for 3.6.0 final.
msg282944 - (view) Author: Paul Moore (paul.moore) * (Python committer) Date: 2016-12-11 20:23
I'm OK for this to go in.
msg282949 - (view) Author: Steve Dower (steve.dower) * (Python committer) Date: 2016-12-11 21:32
Is it easy to cherry pick a merge commit? This will go into 3.5 first, but I can null merge and then clean commit it if that's easier?
msg282951 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2016-12-11 21:39
Just do your normal thing.  I'll make it work.
msg282952 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2016-12-11 22:48
New changeset 47bf09270027 by Steve Dower in branch '3.5':
Issue #28783: Replaces bdist_wininst in nuget packages with stub
https://hg.python.org/cpython/rev/47bf09270027

New changeset b8b1ad21e073 by Steve Dower in branch '3.6':
Issue #28783: Replaces bdist_wininst in nuget packages with stub
https://hg.python.org/cpython/rev/b8b1ad21e073

New changeset 402a227564f5 by Steve Dower in branch 'default':
Issue #28783: Replaces bdist_wininst in nuget packages with stub
https://hg.python.org/cpython/rev/402a227564f5
msg282953 - (view) Author: Steve Dower (steve.dower) * (Python committer) Date: 2016-12-11 22:49
Thanks Ned, it's all yours.
msg283373 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2016-12-16 07:44
New changeset 1f69fb337288 by Steve Dower in branch '3.6':
Issue #28783: Replaces bdist_wininst in nuget packages with stub
https://hg.python.org/cpython/rev/1f69fb337288
msg283383 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2016-12-16 07:53
[cherrypicked for 3.6.0rc2]
History
Date User Action Args
2022-04-11 14:58:39adminsetgithub: 72969
2016-12-16 07:53:05ned.deilysetstatus: open -> closed
priority: release blocker ->
messages: + msg283383

resolution: fixed
stage: commit review -> resolved
2016-12-16 07:44:44python-devsetmessages: + msg283373
2016-12-11 22:49:44steve.dowersetmessages: + msg282953
stage: patch review -> commit review
2016-12-11 22:48:55python-devsetmessages: + msg282952
2016-12-11 21:39:56ned.deilysetmessages: + msg282951
2016-12-11 21:32:24steve.dowersetmessages: + msg282949
2016-12-11 20:23:40paul.mooresetmessages: + msg282944
2016-12-11 20:14:50ned.deilysetmessages: + msg282941
2016-12-11 07:23:21steve.dowersetstatus: closed -> open
files: + 28783_1.patch


nosy: + larry
stage: resolved -> patch review
messages: + msg282907
resolution: fixed -> (no value)
priority: normal -> release blocker
2016-11-23 20:25:02steve.dowersetstatus: open -> closed
resolution: fixed
messages: + msg281585

stage: patch review -> resolved
2016-11-23 20:23:33python-devsetnosy: + python-dev
messages: + msg281584
2016-11-23 19:38:49steve.dowersetmessages: + msg281583
2016-11-23 19:17:31paul.mooresetmessages: + msg281581
2016-11-23 18:57:37ned.deilysetmessages: + msg281578
2016-11-23 18:34:34steve.dowersetmessages: + msg281577
2016-11-23 18:29:43steve.dowercreate