[Mailman-Developers] japanesecodes-1.4.5 install prob

Tamito KAJIYAMA kajiyama@grad.sccs.chukyo-u.ac.jp
Sat, 27 Apr 2002 05:51:04 +0900


barry@zope.com (Barry A. Warsaw) writes:
| 
| [I'm Cc'ing the distutils wizard and the JapaneseCodecs author, since
| I believe this is a bug in one of those two systems -BAW]
| 
| >>>>> "RJ" == Ron Jarrell <jarrell@vt.edu> writes:
| 
|     RJ> When I try to install mailman now I'm getting:
| 
|     RJ> for p in email-2.0.1 JapaneseCodecs-1.4.5 KoreanCodecs-1.0.0;
|     RJ> \ do \
|     RJ> gunzip -c $p.tar.gz | tar xf -; \ (cd $p ;
|     RJ> PYTHONPATH=/home/mailman/pythonlib /usr/local/bin/python setup.py
|     RJ> --quiet install --install-lib /home/mailman/pythonlib); \
|     RJ> done error:
|     RJ> /usr/local/lib/python2.2/site-packages/japanese.pth:
|     RJ> Permission denied *** Error code 1 make: Fatal error: Command
|     RJ> failed for target `install-packages' Current working directory
|     RJ> /usr/local/src/mailman-dev/mailman/misc *** Error code 1 make:
|     RJ> Fatal error: Command failed for target `doinstall'
| 
|     RJ> Which of course, is correct, since as a non root users I can't
|     RJ> write to site-packages...  But which is shouldn't be trying to
|     RJ> write *to*..
| 
| The problem I believe is in either distutils, or the way the Japanese
| codec package setup.py file is written.
| 
| "python setup.py --help install" says:
| 
| Options for 'Install' command:
| [...]
|   --install-base      base installation directory (instead of --prefix or --
|                       home)
|   --install-platbase  base installation directory for platform-specific files
|                       (instead of --exec-prefix or --home)
|   --root              install everything relative to this alternate root
|                       directory
|   --install-purelib   installation directory for pure Python module
|                       distributions
|   --install-platlib   installation directory for non-pure module distributions
|   --install-lib       installation directory for all module distributions
|                       (overrides --install-purelib and --install-platlib)
|   --install-headers   installation directory for C/C++ headers
|   --install-scripts   installation directory for Python scripts
|   --install-data      installation directory for data files
| 
| So I've been using --install-lib to put the JapaneseCodecs package
| (as well as the email and KoreanCodecs packages) in $(PYTHONLIBDIR),
| which by default is /usr/local/mailman/pythonlib.
| 
| The problem comes because the japanese.pth file doesn't honor
| --install-lib.  Trial and error shows that if I include
| --install-purelib $(PYTHONLIBDIR) then japanese.pth goes in the right
| place, e.g. /usr/local/mailman/pythonlib.  So as a workaround, I've
| made this change.
| 
| >From the JapaneseCodecs setup.py file:
| 
| -------------------- snip snip --------------------
| class Install(install):
|     def finalize_options (self):
|         install.finalize_options(self)
|         self.distribution.data_files = [
|             (self.install_purelib, ["japanese.pth"])]
| -------------------- snip snip --------------------
| 
| and according to the help text above, shouldn't self.install_purelib
| be coming from my --install-lib option?  Is this a bug in distutils?
| Or does the setup.py file need to be fixed?
| 
| Note: Python 2.2.1 being used.

Barry, thanks you for the feedback.

I got reports that bdist_wininst and bdist_rpm posed similar
problems.  Attached below are the patches the reporters sent
to me.  Honestly speaking I cannot figure out a right way that
fixes problems on all platforms with any distutils options.

Any comments and suggestions are very appreciated.

Regards,

-- 
KAJIYAMA, Tamito <kajiyama@grad.sccs.chukyo-u.ac.jp>


For bdist_wininst:
--- setup.py.orig       Thu Apr 18 01:20:38 2002
+++ setup.py    Thu Apr 18 01:20:16 2002
@@ -27,7 +27,7 @@
     def finalize_options (self):
         install.finalize_options(self)
         self.distribution.data_files = [
-            (self.install_purelib, ["japanese.pth"])]
+            ("lib/site-packages", ["japanese.pth"])]

 setup (name = "JapaneseCodecs",
        version = "1.4.5",


For bdist_rpm:
--- setup.py.orig	Wed Apr 17 16:42:13 2002
+++ setup.py	Thu Apr 18 19:50:49 2002
@@ -2,6 +2,7 @@
 # Tamito KAJIYAMA <30 November 2000>
 # $Id: setup.py,v 1.7 2002/04/17 03:53:31 kajiyama Exp $
 
+import sys, os
 from distutils.core import setup, Extension
 from distutils.command.build_py import build_py
 from distutils.command.install import install
@@ -27,7 +28,8 @@
     def finalize_options (self):
         install.finalize_options(self)
         self.distribution.data_files = [
-            (self.install_purelib, ["japanese.pth"])]
+            (os.path.join(sys.prefix, 'lib', 'python'+sys.version[:3], 'site-packages'),
+            ["japanese.pth"])]
 
 setup (name = "JapaneseCodecs",
        version = "1.4.5",