Opened 9 years ago

Closed 7 years ago

Last modified 4 years ago

#3203 closed defect (fixed)

[patch] bdist_wininst does not place package data files correctly

Reported by: ymasuda <whosaysni@…> Owned by: kmtracey
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: UI/UX:

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@…> 9 years ago.
Fixing bdist_wininst to place package data files correctly
bdist_wininst.patch (924 bytes) - added by cwt <cwt@…> 7 years ago.
alpha_2-bdist_wininst.patch (622 bytes) - added by cwt <cwt@…> 7 years ago.
for 1.0-alpha_2
setup.diff (683 bytes) - added by kmtracey 7 years ago.
Don't try to read args that might not be there

Download all attachments as: .zip

Change History (14)

Changed 9 years ago by ymasuda <ymasuda@…>

Fixing bdist_wininst to place package data files correctly

comment:1 Changed 9 years ago by adrian

  • Resolution set to fixed
  • Status changed from new to closed

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

comment:2 Changed 7 years ago by anonymous

  • Resolution fixed deleted
  • Status changed from closed to reopened

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 Changed 7 years ago by mtredinnick

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 Changed 7 years ago by jacob

  • Triage Stage changed from Unreviewed to Design decision needed

Changed 7 years ago by cwt <cwt@…>

Changed 7 years ago by cwt <cwt@…>

for 1.0-alpha_2

comment:5 Changed 7 years ago by cwt <cwt@…>

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 Changed 7 years ago by kmtracey

  • Owner changed from adrian to kmtracey
  • Status changed from reopened to new

I'm looking at this.

Changed 7 years ago by kmtracey

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

comment:7 Changed 7 years ago by kmtracey

  • Triage Stage changed from Design decision needed to Ready 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 Changed 7 years ago by kmtracey

  • milestone set to 1.0

comment:9 Changed 7 years ago by mtredinnick

  • Resolution set to fixed
  • Status changed from new to closed

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

comment:10 Changed 4 years ago by jacob

  • milestone 1.0 deleted

Milestone 1.0 deleted

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