Python version detection broken on systems that do not report the minor version

Bug #605327 reported by Jan
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
openWNS SDK
Fix Committed
Undecided
Daniel Bültmann

Bug Description

The new python version detection mechanisms does not work on systems where python only reports, e.g., 2.6 instead of, e.g., 2.6.5. This happens for example on openSUSE 11.1

cat /etc/issue
Welcome to openSUSE 11.1 - Kernel \r (\l).

This is what happens:

openwns-sdk> ./playground.py install
Executing: scons dbg --warn=no-missing-sconscript -j 8 default
scons: Reading SConscript files ...

WARNING Cannot acces /etc/lsb-release. Unknown distribution. Trying fallback.

IndexError: list index out of range:
  File "/tmp/build/openwns-sdk/SConstruct", line 61:
    envInfo = EnvInfo()
  File "/tmp/build/openwns-sdk/SConstruct", line 33:
    self.python["version_minor"] = "%s" % (version[2])

The reason is that in the python version output there is only one "." and thus no version[2]:

openwns-sdk> python --version
Python 2.6

Related branches

Revision history for this message
Daniel Bültmann (daniel.bueltmann) wrote : Re: [openWNS-bugsquad] [Bug 605327] [NEW] Python version detection broken on systems that do not report the minor version

Patch please ;)

I think we can make the minor version optional. The code that decides
something depending on the python version only looks at the major
version number. Could you check this and provide the patch if
compilation works on SuSe?

Regards,
  Daniel

On 07/14/2010 11:12 AM, Jan wrote:
> Public bug reported:
>
> The new python version detection mechanisms does not work on systems
> where python only reports, e.g., 2.6 instead of, e.g., 2.6.5. This
> happens for example on openSUSE 11.1
>
> cat /etc/issue
> Welcome to openSUSE 11.1 - Kernel \r (\l).
>
> This is what happens:
>
> openwns-sdk> ./playground.py install
> Executing: scons dbg --warn=no-missing-sconscript -j 8 default
> scons: Reading SConscript files ...
>
> WARNING Cannot acces /etc/lsb-release. Unknown distribution. Trying
> fallback.
>
> IndexError: list index out of range:
> File "/tmp/build/openwns-sdk/SConstruct", line 61:
> envInfo = EnvInfo()
> File "/tmp/build/openwns-sdk/SConstruct", line 33:
> self.python["version_minor"] = "%s" % (version[2])
>
> The reason is that in the python version output there is only one "."
> and thus no version[2]:
>
> openwns-sdk> python --version
> Python 2.6
>
> ** Affects: openwns-sdk
> Importance: Undecided
> Status: New
>

Revision history for this message
Jan (jan-ellenbeck) wrote :

This is the workaround I use on that system:

=== modified file 'SConstruct'
--- SConstruct 2010-07-19 23:59:03 +0000
+++ SConstruct 2010-07-21 14:12:05 +0000
@@ -30,14 +30,19 @@
             output = subprocess.Popen(["python", "-V"], stderr=subprocess.PIPE).communicate()[1]
             output = output.split()
             version = output[1].split(".")
- self.python["version_major"] = "%s.%s" % (version[0], version[1])
- self.python["version_minor"] = "%s" % (version[2])
+ self.python["version_major"] = "%s.%s" % (version[0], version[1])
         except OSError:
             print
             print "Error!!! Cannot find python command"
             print
             exit(1)

+ try:
+ self.python["version_minor"] = "0"
+ self.python["version_minor"] = "%s" % (version[2])
+ except IndexError:
+ pass
+
         guess_python_config = "python-config"

         if self.lsb["DISTRIB_ID"] == "Ubuntu" and self.lsb["DISTRIB_CODENAME"] == 'lucid':

Revision history for this message
Daniel Bültmann (daniel.bueltmann) wrote :

Dear Jan,

I just applied your patch to the trunk. Thanks for your help. I hope it now works for you.

Regards,
  Daniel

Changed in openwns-sdk:
status: New → Fix Committed
assignee: nobody → Daniel Bültmann (daniel.bueltmann)
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.