[Bf-committers] Python 1.5 is wrong, 2.2 works, probably 2.0 a must

Guillermo S. Romero / Familia Romero bf-committers@blender.org
Mon, 2 Dec 2002 21:35:12 +0100


Hi:

More light in the Python thing.

$ python1.5
Python 1.5.2 (#1, Apr  3 2002, 18:16:26)  [GCC 2.96 20000731 (Red Hat Linux 7.2 2 on linux-i386
Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
>>> import math as os
  File "<stdin>", line 1
    import math as os
                 ^
SyntaxError: invalid syntax
>>>

$ python2.2
Python 2.2 (#1, Apr 12 2002, 15:29:57) 
[GCC 2.96 20000731 (Red Hat Linux 7.2 2.96-109)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import math as os
>>>

$ grep -ErI "import .* as " *       
intern/python/freeze/freeze_ac.py:import makemakefile_ac as makemakefile
intern/python/modules/Blender/Camera.py:import _Blender.Camera as _Camera
intern/python/modules/Blender/Image.py:import _Blender.Image as _Image
intern/python/modules/Blender/Material.py:import _Blender.Material as _Material
intern/python/modules/Blender/Material.py:#import Blender.Curve as Curve
intern/python/modules/Blender/Ipo.py:import _Blender.Ipo as _Ipo
...

Clearly, 1.5 is not enough.

---8<---
Index: configure.ac
===================================================================
RCS file: /cvs01/blender/configure.ac,v
retrieving revision 1.10
diff -u -p -r1.10 configure.ac
--- configure.ac        2002/12/01 09:20:35     1.10
+++ configure.ac        2002/12/02 19:48:08
@@ -142,7 +142,7 @@ dnl ----------------------
   )
 
 #Python!
-  AM_PATH_PYTHON(1.5)
+  AM_PATH_PYTHON(2.2)
 #Find out what path to use for python.
 python_sysprefix=`echo "import sys; print sys.prefix" | python -`
 
--->8---

That should fix it. Everyone running .2 of the 2 series, right? If
someone is sure it works with 2.1 or 2.0, change the line in the
patch, to avoid requiring the latest just for fun.

And to the problem I had about python2.22.2 or similar, it is due this

---8<---
Index: intern/python/freeze/Makefile.am
===================================================================
RCS file: /cvs01/blender/intern/python/freeze/Makefile.am,v
retrieving revision 1.7
diff -u -p -r1.7 Makefile.am
--- Makefile.am 2002/11/30 19:55:39     1.7
+++ Makefile.am 2002/12/02 20:00:38
@@ -20,10 +20,9 @@ PYFILES = \
 EXTRA_DIST = $(top_srcdir)/intern/python/frozen/*.c README.NaN $(PYFILES)
 
 libfrozen.a: $(PYFILES)
-       @PYTHON@@PYTHON_VERSION@ -S -O \
+       @PYTHON@ -S -O \
                $(top_srcdir)/intern/python/freeze/freeze_ac.py -d -x os -x \
                pprint -I $(SRCDIR) -o ../frozen $(SRCDIR)/VRMLmain.py
-#Or leave out @PYTHON@@PYTHON_VERSION@?
        cd ../frozen && make && cd ../freeze
 
 clean:;
--->8---

PYTHON has the exec name that is working and is going to be used, or
should, PYTHON_VERSION will just cause havoc in a system with multiple
pythons installed. Or at least does in the one I tested. :]

GSR