Feature #2722

Support for Python 3

Added by Terkhen over 6 years ago. Updated over 3 years ago.

Status:ClosedStart date:2011-06-10
Priority:NormalDue date:
Assignee:-% Done:

100%

Category:-
Target version:0.4.0

Description

Currently PIL has no support for Python 3.x. PLY supports Python 3.2 already. I have not tested any possible issues in NML caused by running from Python 3.x.

nml_2_to_3.diff Magnifier (66.8 KB) Terkhen, 2011-06-10 09:17

Associated revisions

Revision 1388:c811118427f4
Added by yexo over 6 years ago

Codechange #2722: prepent module names in relative import statements with a dot

Revision 1388:c811118427f4
Added by yexo over 6 years ago

Codechange #2722: prepent module names in relative import statements with a dot

Revision 1389:feded5eeb2e7
Added by yexo over 6 years ago

Codechange #2722: wrap range() with list() when we need a list instead of only an iterator

Revision 1389:feded5eeb2e7
Added by yexo over 6 years ago

Codechange #2722: wrap range() with list() when we need a list instead of only an iterator

Revision 1390:5191d3942582
Added by yexo over 6 years ago

Codechange #2722: operator.div is deprecated in python3, make sure we already do the correct thing now

Revision 1390:5191d3942582
Added by yexo over 6 years ago

Codechange #2722: operator.div is deprecated in python3, make sure we already do the correct thing now

History

#1 Updated by Terkhen over 6 years ago

Some discussions in the PIL mailing list confirm that we shouldn't be expecting a PIL release for Python 3.x anytime soon:

http://mail.python.org/pipermail/image-sig/2009-March/005502.html
http://mail.python.org/pipermail/image-sig/2011-January/006636.html

#2 Updated by Terkhen over 6 years ago

Yexo found this: http://mail.python.org/pipermail/image-sig/2011-January/006650.html

Depending on how much is supported, nml might work or not.

I'm attaching to this comment the diff file resulting from applying the 2to3 script to nml. With this diff file, nml with python3 still fails to compile OpenGFX+ Industries. I will look into the error later:

Traceback (most recent call last):
File "/usr/bin/nmlc", line 3, in <module>
from nml import main
File "/home/terkhen/nml/nml/nml/main.py", line 2, in <module>
from nml import generic, grfstrings, parser, version_info, output_base, output_nml, output_nfo, output_grf, palette
File "/home/terkhen/nml/nml/nml/parser.py", line 1, in <module>
from nml import generic, expression, tokens, nmlop
File "/home/terkhen/nml/nml/nml/expression/__init__.py", line 5, in <module>
from .bin_not import BinNot, Not
File "/home/terkhen/nml/nml/nml/expression/bin_not.py", line 1, in <module>
from nml import generic, nmlop
File "/home/terkhen/nml/nml/nml/nmlop.py", line 85, in <module>
compiletime_func = operator.div,
AttributeError: 'module' object has no attribute 'div'

#3 Updated by planetmaker over 3 years ago

  • Target version set to 0.4.0

The version of http://devs.openttd.org/~alberth/py3_changes_20140319.patch tested:
(See issue 6871, http://dev.openttdcoop.org/attachments/download/5997/py3_changes_20140319.patch )

planetmaker@localhost:~/ottd/grfdev/nml$ python3 setup.py bdist_egg
(...)
byte-compiling build/bdist.linux-x86_64/egg/nml/ast/base_sprites.py to base_sprites.cpython-33.pyc
Sorry: TabError: inconsistent use of tabs and spaces in indentation (base_sprites.py, line 36)

byte-compiling build/bdist.linux-x86_64/egg/nml/ast/assignment.py to assignment.cpython-33.pyc
byte-compiling build/bdist.linux-x86_64/egg/nml/ast/conditional.py to conditional.cpython-33.pyc
byte-compiling build/bdist.linux-x86_64/egg/nml/ast/produce.py to produce.cpython-33.pyc
byte-compiling build/bdist.linux-x86_64/egg/nml/ast/disable_item.py to disable_item.cpython-33.pyc
byte-compiling build/bdist.linux-x86_64/egg/nml/ast/base_statement.py to base_statement.cpython-33.pyc
byte-compiling build/bdist.linux-x86_64/egg/nml/ast/spritecount.py to spritecount.cpython-33.pyc
File "build/bdist.linux-x86_64/egg/nml/ast/spritecount.py", line 8
print indentation*' ' + 'Sprite count'
^
SyntaxError: invalid syntax
(...)

py3_changes_20140319.patch Magnifier (36.1 KB) Delete planetmaker, 2014-04-19 09:24

#4 Updated by planetmaker over 3 years ago

Right, the previous report in #3 is invalid, caused by old data laying around and not cleaned properly from my repo

#5 Updated by frosch over 3 years ago

  • % Done changed from 0 to 100
  • Status changed from New to Closed

Also available in: Atom PDF