[Python-bugs-list] [ python-Bugs-662701 ] sys.version[:3] gives incorrect version

SourceForge.net noreply@sourceforge.net
Mon, 06 Jan 2003 01:54:23 -0800


Bugs item #662701, was opened at 2003-01-05 18:10
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=662701&group_id=5470

Category: Python Library
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Pearu Peterson (pearu)
Assigned to: Nobody/Anonymous (nobody)
Summary: sys.version[:3] gives incorrect version

Initial Comment:

sys.version[:3] is used in several places [*] for
Python version and in most cases it is OK.
However, when Python is build/installed, say, with
  make all install VERSION=2.2.2
then sys.version[:3] does not represent Python version
correctly anymore. For example, the path to Python Lib
is then
  <prefix>/lib/python2.2.2/
but e.g. distutils finds it as
  <prefix>/lib/python2.2/
which obviously causes either an exception or a silent
incorrect behaviour [**] when trying to use distutils.

Note about fix: I don't have it but simply replacing
sys.version[:3] with
sys.version.split()[0] will not work.

Best regards, Pearu

[*] Running
  grep  "sys.version\[:3\]" {*,*/*,*/*/*}.py
in the Python Lib tree shows 8 matches for Python 2.2.2.

[**] .. e.g. when one has other Python installed with
VERSION=2.2

----------------------------------------------------------------------

>Comment By: Martin v. Löwis (loewis)
Date: 2003-01-06 10:54

Message:
Logged In: YES 
user_id=21627

I see. What you have been doing is indeed documented as
supported. Unfortunately, there is currently no way in which
distutils could find out what VERSION is. So if this is
intended to work, we need to expose VERSION somewhere.

----------------------------------------------------------------------

Comment By: Pearu Peterson (pearu)
Date: 2003-01-06 00:40

Message:
Logged In: YES 
user_id=88489

A note: according to Python README Installation section,
make
make altinstall VERSION=2.2.2
is "legal". From reading the generated Makefile, the above seems
to be identical to 'make all install VERSION=2.2.2', but I
haven't
actually tried it out, though, so I might be wrong.
If fixing this issue is too difficult, that's fine with me.
One can
always use --prefix= as a workaround when configuring Python.

----------------------------------------------------------------------

Comment By: Martin v. Löwis (loewis)
Date: 2003-01-06 00:14

Message:
Logged In: YES 
user_id=21627

I would suggest that 'make all install VERSION=2.2.2' is not
supported, so this does not need to be fixed.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=662701&group_id=5470