Django

Code

Ticket #3203 (closed: fixed)

Opened 2 years ago

Last modified 4 months ago

[patch] bdist_wininst does not place package data files correctly

Reported by: ymasuda <whosaysni@gmail.com> Assigned to: kmtracey
Milestone: 1.0 Component: Tools
Version: Keywords:
Cc: Triage Stage: Ready for checkin
Has patch: 1 Needs documentation: 0
Needs tests: 0 Patch needs improvement: 0

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

bdist_wininst_fix.diff (1.1 kB) - added by ymasuda <ymasuda@ethercube.com> on 12/28/06 22:42:20.
Fixing bdist_wininst to place package data files correctly
bdist_wininst.patch (0.9 kB) - added by cwt <cwt@bashell.com> on 08/11/08 08:23:38.
alpha_2-bdist_wininst.patch (0.6 kB) - added by cwt <cwt@bashell.com> on 08/11/08 08:25:46.
for 1.0-alpha_2
setup.diff (0.7 kB) - added by kmtracey on 08/11/08 10:39:35.
Don't try to read args that might not be there

Change History

12/28/06 22:42:20 changed by ymasuda <ymasuda@ethercube.com>

  • attachment bdist_wininst_fix.diff added.

Fixing bdist_wininst to place package data files correctly

12/30/06 00:17:21 changed by adrian

  • status changed from new to closed.
  • resolution set to fixed.

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

03/30/08 11:47:13 changed by anonymous

  • status changed from closed to reopened.
  • resolution deleted.

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.

03/31/08 19:37:24 changed 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).

05/31/08 17:10:47 changed by jacob

  • stage changed from Unreviewed to Design decision needed.

08/11/08 08:23:38 changed by cwt <cwt@bashell.com>

  • attachment bdist_wininst.patch added.

08/11/08 08:25:46 changed by cwt <cwt@bashell.com>

  • attachment alpha_2-bdist_wininst.patch added.

for 1.0-alpha_2

08/11/08 08:30:36 changed by cwt <cwt@bashell.com>

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.

08/11/08 09:38:42 changed by kmtracey

  • owner changed from adrian to kmtracey.
  • status changed from reopened to new.

I'm looking at this.

08/11/08 10:39:35 changed by kmtracey

  • attachment setup.diff added.

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

08/11/08 11:04:48 changed by kmtracey

  • 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.

08/11/08 11:40:07 changed by kmtracey

  • milestone set to 1.0.

08/11/08 21:15:00 changed by mtredinnick

  • status changed from new to closed.
  • resolution set to fixed.

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


Add/Change #3203 ([patch] bdist_wininst does not place package data files correctly)




Change Properties
Action