public inbox for java@gcc.gnu.org
 help / color / mirror / Atom feed
From: Gary Benson <gbenson@redhat.com>
To: java@gcc.gnu.org, gcc-patches@gcc.gnu.org
Cc: Richard Guenther <richard.guenther@gmail.com>,
	       Gerald Pfeifer <gerald@pfeifer.com>,
	Tom Tromey <tromey@redhat.com>
Subject: Re: Another Python namespace pollution (was: r147958 - in	/trunk/libstdc++-v3: ChangeLog Mak...)
Date: Wed, 02 Feb 2011 15:00:00 -0000	[thread overview]
Message-ID: <20110202145959.GA28926@redhat.com> (raw)
In-Reply-To: <20110127105952.GC5165@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 1623 bytes --]

Gary Benson wrote:
> Richard Guenther wrote:
> > On Thu, Jan 27, 2011 at 11:38 AM, Gary Benson <gbenson@redhat.com> wrote:
> > > Gerald Pfeifer wrote:
> > > > I noticed that coming from the Java side of things we also
> > > > have two files that are installed in common namespace:
> > > >
> > > >   share/python/aotcompile.py
> > > >   share/python/classfile.py
> > >
> > > I'm on the hook to fix this, but it's been a while since I
> > > worked on this stuff so I'm a little out of touch with GCC.
> > > Can you tell me what you mean by "common namespace", and
> > > what the alternative should be?
> > 
> > The files should reside in a directory that is private to gcc or
> > at least mangled with the gcc version it comes from.  Otherwise
> > multiple parallel gcc installations conflict.
> 
> Ah, ok, that shouldn't be too hard.  I'll get working on a patch.

Ha ha, famous last words, I've been fighting this for days.

Ok, attached is a patch that causes the two Python modules to be
installed in a versioned directory.  Also attached is a separate
patch, orthogonal to the first, which changes how the modules are
made available to the aot-compile scripts.  What is currently in
svn adds the directory to the _end_ of the path, so if the modules
exist elsewhere then the other versions will take priority.  The
attached patch changes it to add the directory to the start of the
path.

If the patches are ok then could someone please commit them for me?
I thought I had commit access, but I couldn't seem to check out a
tree using ssh, so maybe it was revoked for inactivity :)

Cheers,
Gary

-- 
http://gbenson.net/

[-- Attachment #2: aot-compile-fix-take-1.patch --]
[-- Type: text/plain, Size: 2730 bytes --]

Index: libjava/configure.ac
===================================================================
--- libjava/configure.ac	(revision 169331)
+++ libjava/configure.ac	(working copy)
@@ -1842,21 +1842,18 @@
 # We get this from the environment.
 AC_SUBST(GCJFLAGS)
 
+default_python_dir="/share/gcc-`cat ${srcdir}/../gcc/BASE-VER`/python/libjava"
 AC_ARG_WITH([python-dir],
             AS_HELP_STRING([--with-python-dir],
                            [the location to install Python modules. This path should NOT include the prefix.]),
-            [with_python_dir=$withval], [with_python_dir=""])
+            [with_python_dir=$withval], [with_python_dir="${default_python_dir}"])
 
-if test "x${with_python_dir}" = "x"
-then
-  # Needed for installing Python modules during make install.
-  python_mod_dir="\${prefix}/share/python"
-  # Needed for substituting into aot-compile*
-  python_mod_dir_expanded="${expanded_prefix}/share/python"
-else
-  python_mod_dir="\${prefix}${with_python_dir}"
-  python_mod_dir_expanded="${expanded_prefix}${with_python_dir}"
-fi
+# Needed for installing Python modules during make install.
+python_mod_dir="\${prefix}${with_python_dir}"
+
+# Needed for substituting into aot-compile*
+python_mod_dir_expanded="${expanded_prefix}${with_python_dir}"
+
 AC_MSG_RESULT(Python modules dir: ${python_mod_dir_expanded});
 AC_SUBST(python_mod_dir)
 AC_SUBST(python_mod_dir_expanded)
Index: libjava/configure
===================================================================
--- libjava/configure	(revision 169331)
+++ libjava/configure	(working copy)
@@ -24649,25 +24649,22 @@
 # We get this from the environment.
 
 
+default_python_dir="/share/gcc-`cat ${srcdir}/../gcc/BASE-VER`/python/libjava"
 
 # Check whether --with-python-dir was given.
 if test "${with_python_dir+set}" = set; then :
   withval=$with_python_dir; with_python_dir=$withval
 else
-  with_python_dir=""
+  with_python_dir="${default_python_dir}"
 fi
 
 
-if test "x${with_python_dir}" = "x"
-then
-  # Needed for installing Python modules during make install.
-  python_mod_dir="\${prefix}/share/python"
-  # Needed for substituting into aot-compile*
-  python_mod_dir_expanded="${expanded_prefix}/share/python"
-else
-  python_mod_dir="\${prefix}${with_python_dir}"
-  python_mod_dir_expanded="${expanded_prefix}${with_python_dir}"
-fi
+# Needed for installing Python modules during make install.
+python_mod_dir="\${prefix}${with_python_dir}"
+
+# Needed for substituting into aot-compile*
+python_mod_dir_expanded="${expanded_prefix}${with_python_dir}"
+
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: Python modules dir: ${python_mod_dir_expanded}" >&5
 $as_echo "Python modules dir: ${python_mod_dir_expanded}" >&6; };
 

[-- Attachment #3: aot-compile-improvement.patch --]
[-- Type: text/plain, Size: 1419 bytes --]

Index: libjava/contrib/aot-compile.in
===================================================================
--- libjava/contrib/aot-compile.in	(revision 169331)
+++ libjava/contrib/aot-compile.in	(working copy)
@@ -1,6 +1,6 @@
 #!/usr/bin/env python
 
-## Copyright (C) 2006 Free Software Foundation
+## Copyright (C) 2006, 2011 Free Software Foundation
 ## Written by Gary Benson <gbenson@redhat.com>
 ##
 ## This program is free software; you can redistribute it and/or modify
@@ -14,7 +14,7 @@
 ## GNU General Public License for more details.
 
 import sys
-sys.path.append("@python_mod_dir_expanded@")
+sys.path.insert(0, "@python_mod_dir_expanded@")
 import aotcompile
 import getopt
 import os
Index: libjava/contrib/aot-compile-rpm.in
===================================================================
--- libjava/contrib/aot-compile-rpm.in	(revision 169331)
+++ libjava/contrib/aot-compile-rpm.in	(working copy)
@@ -1,6 +1,6 @@
 #!/usr/bin/env python
 
-## Copyright (C) 2005, 2006, 2007 Free Software Foundation
+## Copyright (C) 2005, 2006, 2007, 2011 Free Software Foundation
 ## Written by Gary Benson <gbenson@redhat.com>
 ##
 ## This program is free software; you can redistribute it and/or modify
@@ -14,7 +14,7 @@
 ## GNU General Public License for more details.
 
 import sys
-sys.path.append("@python_mod_dir_expanded@")
+sys.path.insert(0, "@python_mod_dir_expanded@")
 import aotcompile
 import os
 

  parent reply	other threads:[~2011-02-02 15:00 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20090528171422.508.qmail@sourceware.org>
     [not found] ` <Pine.LNX.4.64.0905282258430.24872@digraph.polyomino.org.uk>
     [not found]   ` <m33aan21h4.fsf@fleche.redhat.com>
     [not found]     ` <Pine.LNX.4.64.0905291955130.18075@digraph.polyomino.org.uk>
     [not found]       ` <m3y6sfzk3y.fsf@fleche.redhat.com>
     [not found]         ` <m3ljofzhtd.fsf@fleche.redhat.com>
2011-01-27  1:48           ` Gerald Pfeifer
2011-01-27 10:38             ` Gary Benson
2011-01-27 10:43               ` Richard Guenther
2011-01-27 11:00                 ` Gary Benson
2011-01-27 19:54                   ` Gerald Pfeifer
2011-01-27 23:59                     ` Another Python namespace pollution Matthias Klose
2011-02-02 15:00                   ` Gary Benson [this message]
2011-02-18 14:21                     ` Another Python namespace pollution (was: r147958 - in /trunk/libstdc++-v3: ChangeLog Mak...) Gerald Pfeifer
2011-02-18 14:32                       ` Another Python namespace pollution Andrew Haley

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110202145959.GA28926@redhat.com \
    --to=gbenson@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=gerald@pfeifer.com \
    --cc=java@gcc.gnu.org \
    --cc=richard.guenther@gmail.com \
    --cc=tromey@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).