Opened 17 years ago

Closed 16 years ago

Last modified 13 years ago

#3203 closed defect (fixed)

[patch] bdist_wininst does not place package data files correctly

Reported by: ymasuda <whosaysni@…> Owned by: Karen Tracey
Component: Tools Version:
Severity: normal Keywords:
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

From changeset [3906], setup.py uses 'data_files' option for setup() to specify package data files (message catalogs, templates, etc).
This breaks bdist_wininst behaviour to place those datafiles onto C:Python2X/django instead of C:/Python2X/Lib/site-packages/django.
The attached patch includes a small hack to fix this.

Attachments (4)

bdist_wininst_fix.diff (1.1 KB ) - added by ymasuda <ymasuda@…> 17 years ago.
Fixing bdist_wininst to place package data files correctly
bdist_wininst.patch (924 bytes ) - added by cwt <cwt@…> 16 years ago.
alpha_2-bdist_wininst.patch (622 bytes ) - added by cwt <cwt@…> 16 years ago.
for 1.0-alpha_2
setup.diff (683 bytes ) - added by Karen Tracey 16 years ago.
Don't try to read args that might not be there

Download all attachments as: .zip

Change History (14)

by ymasuda <ymasuda@…>, 17 years ago

Attachment: bdist_wininst_fix.diff added

Fixing bdist_wininst to place package data files correctly

comment:1 by Adrian Holovaty, 17 years ago

Resolution: fixed
Status: newclosed

(In [4264]) Fixed #3203 -- Fixed setup.py bdist_wininst. Thanks for the patch, ymasuda

comment:2 by anonymous, 16 years ago

Resolution: fixed
Status: closedreopened

In the current SVN trunk (retrieved on March 30, 2008), this is happening again: bdist_wininst installers place the data files in C:\Python2X\django, instead of alongside the .py files under C:\Python2X\Lib\site-packages\django. A look at setup.py shows that the patch for this bug was lost at some point.

comment:3 by Malcolm Tredinnick, 16 years ago

The patch was removed because it was causing active harm. It was also tested quite extensively before removing. See #3536 for details.

Any "solution" here will need to work out why it was causing the problems mentioned in #3536 and how to work around it for both situations. We shouldn't just add this back until that has been resolved (it was marked as "hack" with good reason; let's default to non-hackiness until we truly understand the boundaries of the problem).

comment:4 by Jacob, 16 years ago

Triage Stage: UnreviewedDesign decision needed

by cwt <cwt@…>, 16 years ago

Attachment: bdist_wininst.patch added

by cwt <cwt@…>, 16 years ago

Attachment: alpha_2-bdist_wininst.patch added

for 1.0-alpha_2

comment:5 by cwt <cwt@…>, 16 years ago

Please try my patch, this one for 1.0-alpha_2. The original patch can't work correctly on my environment (python 2.4 and 2.5 on Win32). So I modify '/PURELIB/%s' to '
PURELIB
%s', and it work well for me.

See this thread http://groups.google.com/group/django-developers/browse_thread/thread/1524c615243fa356 for the reason why I need this patch.

PS. my first patch was a wrong file, don't use it.

comment:6 by Karen Tracey, 16 years ago

Owner: changed from Adrian Holovaty to Karen Tracey
Status: reopenednew

I'm looking at this.

by Karen Tracey, 16 years ago

Attachment: setup.diff added

Don't try to read args that might not be there

comment:7 by Karen Tracey, 16 years ago

Triage Stage: Design decision neededReady for checkin

After some testing I do not see how the original patch (with forward slashes) ever worked. Trying it I got the (#3536) ValueError about paths not being allowed to be absolute using 'python setup.py bdist_wininst' on Python 2.3.5, 2.4.4, 2.5.1, and 2.6b2, all on Win2K.

I've also verified that without the (backslash version) of this patch, data files do not get installed in the right place by the .exe produced by bdist_wininst. They are put under the main python install tree rather than under site-packages. Some of them (files used by startapp, which was reported as running properly after removing the patch code in #3536?) may be findable in that configuration, but the admin templates, for one, are not found unless they are really under the same tree as the admin .py files.

Given that the hack is so old I tried to see if there was a better way to accomplish the same thing by now. I think there is: the package_data option to setup(). However, that was added in Python 2.4 so won't work for Python 2.3. Since Django still needs to support Python 2.3 I did not investigate that option any further. (But if/when Django drops support for Python 2.3 it may be possible to remove several of the hacks in setup.py that are there simply to force data files into the code tree.)

Therefore I've tried the revised patch (plus included a check to not try to read args that may not be there) under Python 2.3.5, 2.4.4, 2.5.1, and 2.6b2 on Win2K and in all cases verified that:

1 - 'python setup.py bdist_wininst' runs to completion and produces an .exe, not an error message.

2 - the resutling .exe file copies data files (I checked for the admin templates specifically) into the site-packages\django tree, not the base python install tree.

So, I think this can be checked in. I did not test on WinXP but I could do that if anyone thinks it is necessary. I don't have any Vista to test on, though.

comment:8 by Karen Tracey, 16 years ago

milestone: 1.0

comment:9 by Malcolm Tredinnick, 16 years ago

Resolution: fixed
Status: newclosed

(In [8313]) Fixed #3203 (again!) -- Install data files in the right place on MS Windows
systems. Thanks, Karen Tracey and cwt@….

comment:10 by Jacob, 13 years ago

milestone: 1.0

Milestone 1.0 deleted

Note: See TracTickets for help on using tickets.
Back to Top