PyGLet, 2to3...?
John Ladasky
john_ladasky at sbcglobal.net
Thu Jul 25 19:49:16 EDT 2013
On Thursday, July 25, 2013 3:26:01 PM UTC-7, John Ladasky wrote:
> I'll try again from scratch, and see whether that clears up my problems.
Nope, that didn't work.
=======================================
john at john:~/Desktop/pyglet-1.2alpha1$ sudo python3 setup.py install
[sudo] password for john:
running install
running build
running build_py
running install_lib
running install_egg_info
Removing /usr/local/lib/python3.3/dist-packages/pyglet-1.2alpha1.egg-info
Writing /usr/local/lib/python3.3/dist-packages/pyglet-1.2alpha1.egg-info
john at john:~/Desktop/pyglet-1.2alpha1$ python3
Python 3.3.1 (default, Apr 17 2013, 22:30:32)
[GCC 4.7.3] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pyglet
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "./pyglet/__init__.py", line 276
print '[%d] %s%s %s' % (thread, indent, name, location)
^
SyntaxError: invalid syntax
=======================================
The source code link that Kushal posted is dated December 19, 2012. Since that was several months ago, I double-checked the source code of setup.py in the 1.2alpha1 package that I downloaded. It would appear to perform the same check of sys.version_info that was shown on the Google Code page.
To see how that check actually runs, I saved a copy of setup.py as setup2.py, adding diagnostic calls to print() as shown in the code block below:
=======================================
if sys.version_info >= (3,):
# Automatically run 2to3 when using Python 3
print("Python version is 3.0 or later.") # I added this
if _have_setuptools:
print("Have setuptools.") # I added this
setup_info["use_2to3"] = True
else:
print("Do not have setuptools.") # I added this
from distutils.command.build_py import build_py_2to3
setup_info["cmdclass"] = {"build_py" : build_py_2to3}
=======================================
Here's the output:
=======================================
john at john:~/Desktop/pyglet-1.2alpha1$ sudo python3 setup2.py install
Python version is 3.0 or later.
Do not have setuptools.
running install
running build
running build_py
running install_lib
running install_egg_info
Removing /usr/local/lib/python3.3/dist-packages/pyglet-1.2alpha1.egg-info
Writing /usr/local/lib/python3.3/dist-packages/pyglet-1.2alpha1.egg-info
=======================================
So, I don't know much yet about this _have_setuptools flag. I don't know whether it has to be True, instead of False, in order for 2to3 to work properly. I get the impression from the code that 2to3 should run regardless of the _have_setuptools flag, it is just that the task is accomplished in two different ways?
More information about the Python-list
mailing list