Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #51307

Re: PyGLet, 2to3...?

From Kushal Kumaran <kushal.kumaran+python@gmail.com>
Subject Re: PyGLet, 2to3...?
References <4ddada8b-81fd-46e7-bd5d-eeab550a9fa7@googlegroups.com> <a548b0e1-4d48-4667-ae97-f356771140e6@googlegroups.com> <mailman.5103.1374763156.3114.python-list@python.org> <5c35c252-67ed-4810-88b2-6708ed321bee@googlegroups.com> <d5edc756-bcdd-4e67-a659-68aaf575a8f0@googlegroups.com>
Date 2013-07-26 10:22 +0530
Newsgroups comp.lang.python
Message-ID <mailman.5150.1374850752.3114.python-list@python.org> (permalink)

Show all headers | View raw


John Ladasky <john_ladasky@sbcglobal.net> writes:

> 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@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@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

----------^

Your import is attempting to import from your current directory, which
has the pre-2to3 version of the files packaged in the original
distribution.  Switch away and try again.

>     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@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?

That seems correct.  My familiarity with the python packaging tools is
limited, though.

-- 
regards,
kushal

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Python3, GUIs, game APIs, PyGLet, 2to3...? John Ladasky <john_ladasky@sbcglobal.net> - 2013-07-24 22:26 -0700
  Re: Python3, GUIs, game APIs, PyGLet, 2to3...? John Ladasky <john_ladasky@sbcglobal.net> - 2013-07-24 23:56 -0700
    Re: Python3, GUIs, game APIs, PyGLet, 2to3...? Kushal Kumaran <kushal.kumaran+python@gmail.com> - 2013-07-25 14:05 +0530
      Re: Python3, GUIs, game APIs, PyGLet, 2to3...? John Ladasky <john_ladasky@sbcglobal.net> - 2013-07-25 15:26 -0700
        PyGLet, 2to3...? John Ladasky <john_ladasky@sbcglobal.net> - 2013-07-25 16:49 -0700
          Re: PyGLet, 2to3...? Jerry Hill <malaclypse2@gmail.com> - 2013-07-26 09:39 -0400
          Re: PyGLet, 2to3...? Kushal Kumaran <kushal.kumaran+python@gmail.com> - 2013-07-26 10:22 +0530
          Re: PyGLet, 2to3...? John Ladasky <john_ladasky@sbcglobal.net> - 2013-07-26 16:35 -0700
            Re: PyGLet, 2to3...? John Ladasky <john_ladasky@sbcglobal.net> - 2013-07-26 18:19 -0700
              Re: PyGLet, 2to3...? John Ladasky <john_ladasky@sbcglobal.net> - 2013-07-26 21:00 -0700

csiph-web