[ python-Bugs-1600860 ] --enable-shared links extensions to libpython statically

2006-11-25 Thread SourceForge.net
Bugs item #1600860, was opened at 2006-11-22 00:29
Message generated for change (Comment added) made by gustavo
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1600860&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Distutils
Group: None
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Marien Zwart (marienz)
Assigned to: Nobody/Anonymous (nobody)
Summary: --enable-shared links extensions to libpython statically

Initial Comment:
python 2.5 tries to link extension modules to libpython2.5 if python is 
compiled with --enable-shared (patch #1429775, bug #83279, svn r45232). To do 
this it adds -lpython2.5 and -L$PREFIX/lib/python2.5/config to the link command 
line. -lpython2.5 is fine, however the "config" directory it adds contains a 
static libpython2.5.a library. The libpython2.5.so I think it should be linking 
to is in $PREFIX/lib. The result is even a trivial extension pulls in (nearly) 
all of that library, so you get an extension that is over a megabyte in size 
where older pythons produce one of a few kilobytes.

There is a comment on the referenced bug saying

"""
You can probably rely on libpythonxy.so ending up in
$(DESTDIR)$(LIBDIR)/$(INSTSONAME), whose values you can
retrieve from the installed Makefile (i.e. through
distutils.config).
"""

so I think the patch that got applied does not do what was intended.

--

Comment By: Gustavo J. A. M. Carneiro (gustavo)
Date: 2006-11-25 13:10

Message:
Logged In: YES 
user_id=908
Originator: NO

*sigh* why doesn't SF let me attach patches? :(

You can find a patch to fix this here:
http://www.gnome.org/~gjc/linux-shlib.diff


--

Comment By: Gustavo J. A. M. Carneiro (gustavo)
Date: 2006-11-23 20:47

Message:
Logged In: YES 
user_id=908
Originator: NO

Hmm.. I think I wrongfully assumed $prefix/lib/pythonX.Y/config contained
a shared python library in addition to the static one.  It seems that was
an Ubuntu specific thing :|

I'll take a good look and fix this within a couple of days...

--

Comment By: Marien Zwart (marienz)
Date: 2006-11-22 13:02

Message:
Logged In: YES 
user_id=857292
Originator: YES

I can reproduce this by using either gentoo's python 2.5 or one I
installed temporarily with ./configure --enable-shared --prefix
$HOME/tmp/pytem, using a trivial distutils extension (I used
http://dev.gentooexperimental.org/~marienz/ext.c and
http://dev.gentooexperimental.org/~marienz/setup.py for testing). The
relevant command that is run is:

gcc -pthread -shared build/temp.linux-i686-2.5/ext.o
-L/home/marienz/tmp/pytem/lib/python2.5/config -lpython2.5 -o
build/lib.linux-i686-2.5/ext.so

for the manually-configured python and something similar for gentoo's
python. The code doing the adding was added by r45232 in svn. From the
diff (svn di -r45231:45232
http://svn.python.org/projects/python/trunk/Lib/distutils/command/build_ext.py)
with some extra context added:

-if sys.platform[:6] == 'cygwin' or sys.platform[:6] == 'atheos':
+if sys.platform[:6] == 'cygwin' or sys.platform[:6] == 'atheos'
or \
+   (sys.platform.startswith('linux') and
+sysconfig.get_config_var('Py_ENABLE_SHARED')):
 if string.find(sys.executable, sys.exec_prefix) != -1:
 # building third party extensions
 self.library_dirs.append(os.path.join(sys.prefix, "lib",
  "python" +
get_python_version(),
  "config"))

(that is around line 188 of Lib/distutils/command/build_ext.py)

sys.platform on this host is linux2 and as far as I can tell
Py_ENABLE_SHARED is true if --enable-shared is passed to configure.

If you need any more information please ask.

--

Comment By: Martin v. Löwis (loewis)
Date: 2006-11-22 07:09

Message:
Logged In: YES 
user_id=21627
Originator: NO

I can't reproduce the problem. Why do you think
-L$PREFIX/lib/python2.5/config is added to the link command line? AFAICT,
it never is.

What operating system are you using?

--

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1600860&group_id=5470
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[ python-Bugs-1600860 ] --enable-shared links extensions to libpython statically

2006-11-25 Thread SourceForge.net
Bugs item #1600860, was opened at 2006-11-22 01:29
Message generated for change (Comment added) made by loewis
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1600860&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Distutils
Group: None
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Marien Zwart (marienz)
Assigned to: Nobody/Anonymous (nobody)
Summary: --enable-shared links extensions to libpython statically

Initial Comment:
python 2.5 tries to link extension modules to libpython2.5 if python is 
compiled with --enable-shared (patch #1429775, bug #83279, svn r45232). To do 
this it adds -lpython2.5 and -L$PREFIX/lib/python2.5/config to the link command 
line. -lpython2.5 is fine, however the "config" directory it adds contains a 
static libpython2.5.a library. The libpython2.5.so I think it should be linking 
to is in $PREFIX/lib. The result is even a trivial extension pulls in (nearly) 
all of that library, so you get an extension that is over a megabyte in size 
where older pythons produce one of a few kilobytes.

There is a comment on the referenced bug saying

"""
You can probably rely on libpythonxy.so ending up in
$(DESTDIR)$(LIBDIR)/$(INSTSONAME), whose values you can
retrieve from the installed Makefile (i.e. through
distutils.config).
"""

so I think the patch that got applied does not do what was intended.

--

>Comment By: Martin v. Löwis (loewis)
Date: 2006-11-25 14:42

Message:
Logged In: YES 
user_id=21627
Originator: NO

gustavo: you can only attach a patch if you are team member or creator of
the bug report. I'm attaching your patch.

marienz: can you please confirm whether this patch solves this problem?

--

Comment By: Gustavo J. A. M. Carneiro (gustavo)
Date: 2006-11-25 14:10

Message:
Logged In: YES 
user_id=908
Originator: NO

*sigh* why doesn't SF let me attach patches? :(

You can find a patch to fix this here:
http://www.gnome.org/~gjc/linux-shlib.diff


--

Comment By: Gustavo J. A. M. Carneiro (gustavo)
Date: 2006-11-23 21:47

Message:
Logged In: YES 
user_id=908
Originator: NO

Hmm.. I think I wrongfully assumed $prefix/lib/pythonX.Y/config contained
a shared python library in addition to the static one.  It seems that was
an Ubuntu specific thing :|

I'll take a good look and fix this within a couple of days...

--

Comment By: Marien Zwart (marienz)
Date: 2006-11-22 14:02

Message:
Logged In: YES 
user_id=857292
Originator: YES

I can reproduce this by using either gentoo's python 2.5 or one I
installed temporarily with ./configure --enable-shared --prefix
$HOME/tmp/pytem, using a trivial distutils extension (I used
http://dev.gentooexperimental.org/~marienz/ext.c and
http://dev.gentooexperimental.org/~marienz/setup.py for testing). The
relevant command that is run is:

gcc -pthread -shared build/temp.linux-i686-2.5/ext.o
-L/home/marienz/tmp/pytem/lib/python2.5/config -lpython2.5 -o
build/lib.linux-i686-2.5/ext.so

for the manually-configured python and something similar for gentoo's
python. The code doing the adding was added by r45232 in svn. From the
diff (svn di -r45231:45232
http://svn.python.org/projects/python/trunk/Lib/distutils/command/build_ext.py)
with some extra context added:

-if sys.platform[:6] == 'cygwin' or sys.platform[:6] == 'atheos':
+if sys.platform[:6] == 'cygwin' or sys.platform[:6] == 'atheos'
or \
+   (sys.platform.startswith('linux') and
+sysconfig.get_config_var('Py_ENABLE_SHARED')):
 if string.find(sys.executable, sys.exec_prefix) != -1:
 # building third party extensions
 self.library_dirs.append(os.path.join(sys.prefix, "lib",
  "python" +
get_python_version(),
  "config"))

(that is around line 188 of Lib/distutils/command/build_ext.py)

sys.platform on this host is linux2 and as far as I can tell
Py_ENABLE_SHARED is true if --enable-shared is passed to configure.

If you need any more information please ask.

--

Comment By: Martin v. Löwis (loewis)
Date: 2006-11-22 08:09

Message:
Logged In: YES 
user_id=21627
Originator: NO

I can't reproduce the problem. Why do you think
-L$PREFIX/lib/python2.5/config is added to the link command line? AFAICT,
it never is.

What operating system are you using?

--

You can respond by visiting: 
https://sourceforge.net

[ python-Bugs-1602742 ] itemconfigure returns incorrect text property of text items

2006-11-25 Thread SourceForge.net
Bugs item #1602742, was opened at 2006-11-25 17:27
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1602742&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Tkinter
Group: Python 2.4
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Wojciech Mula (wmula)
Assigned to: Martin v. Löwis (loewis)
Summary: itemconfigure returns incorrect text property of text items

Initial Comment:
Tkinter: canvas itemconfigure bug

Consider following code:

-- tkbug.py ---
from Tkinter import *
root   = Tk()
canvas = Canvas(root)
text   = "sample text with spaces"
id = canvas.create_text(0, 0, text=text)

text2  = canvas.itemconfigure(id)['text'][-1]

print text
print text2
--- eof ---

This toy prints:

sample text with spaces
('sample', 'text', 'with', 'spaces')

The returned value is not a string -- Tk returns the same
string as passed on creating item, but Tkinter split it.
To fix this problem, internal method '_configure' have
to be changed a bit:

*** Tkinter.py.old  2006-11-20 16:48:27.0 +0100
--- Tkinter.py  2006-11-20 17:00:13.0 +0100
***
*** 1122,1129 
  cnf = _cnfmerge(cnf)
  if cnf is None:
  cnf = {}
! for x in self.tk.split(
  self.tk.call(_flatten((self._w, cmd:
  cnf[x[0][1:]] = (x[0][1:],) + x[1:]
  return cnf
  if type(cnf) is StringType:
--- 1122,1134 
  cnf = _cnfmerge(cnf)
  if cnf is None:
  cnf = {}
! for x in self.tk.splitlist(
  self.tk.call(_flatten((self._w, cmd:
+ if type(x) is StringType:
+ if x.startswith('-text '):
+ x = self.tk.splitlist(x)
+ else:
+ x = self.tk.split(x)
  cnf[x[0][1:]] = (x[0][1:],) + x[1:]
  return cnf
  if type(cnf) is StringType:


Maybe better/faster way is to provide Canvas method, that
return a 'text' property for text items:

---
def get_text(self, text_id):
try:
r = self.tk.call(self._w, 'itemconfigure', text_id, '-text')
return self.tk.splitlist(r)[-1]
except TclError:
return ''
---


--

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1602742&group_id=5470
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com