# HG changeset patch # User Paul Boddie # Date 1279035601 -7200 # Node ID 89434233addacc5f6676267c3da115b59012bf1f # Parent 75b5b457146621a7f6fe36a44785c6868db14673 Moved the FLAGS file into the installed shedskin Python package directory. Added a patch to fix Python 3.x print function usage. Made the make package a suggested package in the package metadata. diff -r 75b5b4571466 -r 89434233adda README.txt --- a/README.txt Sun Jun 20 21:42:04 2010 +0200 +++ b/README.txt Tue Jul 13 17:40:01 2010 +0200 @@ -36,6 +36,12 @@ cp ../shedskin-packaging/shared.py.diff . patch -p0 < shared.py.diff +Various issues related to Python 2.5 and earlier (with respect to support for +the print function in Python 3.x) need fixing with a patch: + +cp ../shedskin-packaging/python25print.diff . +patch -p0 < python25print.diff + Using pbuilder, try and build the package (this example is using my signing key): diff -r 75b5b4571466 -r 89434233adda debian/control --- a/debian/control Sun Jun 20 21:42:04 2010 +0200 +++ b/debian/control Tue Jul 13 17:40:01 2010 +0200 @@ -11,7 +11,7 @@ Package: shedskin Architecture: all Depends: ${python:Depends}, libgc-dev (>= 6.8), libpcre3-dev (>= 7.4) -Suggests: g++ +Suggests: g++, make XB-Python-Version: ${python:Versions} Description: Python-to-C++ compiler designed to speed up Python programs Shed Skin converts programs written in a static subset of Python to C++. diff -r 75b5b4571466 -r 89434233adda debian/shedskin.install --- a/debian/shedskin.install Sun Jun 20 21:42:04 2010 +0200 +++ b/debian/shedskin.install Tue Jul 13 17:40:01 2010 +0200 @@ -4,4 +4,3 @@ shedskin/lib/os/*.cpp usr/share/shedskin/lib/os/ shedskin/lib/os/*.hpp usr/share/shedskin/lib/os/ shedskin/lib/os/*.py usr/share/shedskin/lib/os/ -shedskin/FLAGS usr/share/shedskin/ diff -r 75b5b4571466 -r 89434233adda python25print.diff --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/python25print.diff Tue Jul 13 17:40:01 2010 +0200 @@ -0,0 +1,57 @@ +--- shedskin/lib/builtin.py (revision 1507) ++++ shedskin/lib/builtin.py (working copy) +@@ -1,5 +1,3 @@ +-from __future__ import print_function +- + class class_: + def __repr__(self): + return self.__name__ +@@ -848,5 +846,5 @@ + return iter1.next() + return fillvalue + +-def print(__kw_sep=0, __kw_end=0, __kw_file=0, *value): ++def __print(__kw_sep=0, __kw_end=0, __kw_file=0, *value): + value.__str__() +--- shedskin/graph.py (revision 1507) ++++ shedskin/graph.py (working copy) +@@ -1200,6 +1200,8 @@ + elif isinstance(node.node, Name): + # direct call + ident = node.node.name ++ if ident == 'print': ++ ident = node.node.name = '__print' # XXX + + if ident in ['getattr', 'setattr', 'slice', 'type']: + error("'%s' function is not supported" % ident, node.node) +--- shedskin/cpp.py (revision 1507) ++++ shedskin/cpp.py (working copy) +@@ -1656,6 +1656,8 @@ + return + elif ident == 'hash': + self.append('hasher(') # XXX cleanup ++ elif ident == '__print': # XXX ++ self.append('print(') + elif ident == 'isinstance' and isinstance(node.args[1], Name) and node.args[1].name in ['float','int']: + error("'isinstance' cannot be used with ints or floats; assuming always true", node, warning=True) + self.append('1') +@@ -1716,7 +1718,7 @@ + objexpr, ident, direct_call, method_call, constructor, parent_constr = analyze_callfunc(node) + target = funcs[0] # XXX + +- print_function = self.library_func(funcs, 'builtin', None, 'print') ++ print_function = self.library_func(funcs, 'builtin', None, '__print') + + castnull = False # XXX + if (self.library_func(funcs, 'random', None, 'seed') or \ +--- shedskin/shared.py (revision 1507) ++++ shedskin/shared.py (working copy) +@@ -764,7 +764,7 @@ + missing = formals[len(actuals):-len(func.defaults)] + + skip_defaults = True # XXX +- if not func.mv.module.builtin or func.mv.module.ident in ['random', 'itertools', 'datetime', 'ConfigParser', 'csv'] or (func.ident in ('sort','sorted', 'min', 'max', 'print')): ++ if not func.mv.module.builtin or func.mv.module.ident in ['random', 'itertools', 'datetime', 'ConfigParser', 'csv'] or (func.ident in ('sort','sorted', 'min', 'max', '__print')): + if not (func.mv.module.builtin and func.ident == 'randrange'): + skip_defaults = False + diff -r 75b5b4571466 -r 89434233adda setup.py.diff --- a/setup.py.diff Sun Jun 20 21:42:04 2010 +0200 +++ b/setup.py.diff Tue Jul 13 17:40:01 2010 +0200 @@ -1,10 +1,11 @@ --- setup.py 2010-06-20 20:55:37.000000000 +0200 +++ setup.py 2010-06-20 20:55:47.000000000 +0200 -@@ -7,6 +7,5 @@ +@@ -7,6 +7,6 @@ description='Shed Skin is an experimental compiler, that can translate pure, but implicitly statically typed Python programs into optimized C++. It can generate stand-alone programs or extension modules that can be imported and used in larger Python programs.', url='http://code.google.com/p/shedskin/', scripts=['scripts/shedskin'], - packages=['shedskin'], - package_data={'shedskin': ['lib/*.cpp', 'lib/*.hpp', 'lib/*.py', 'lib/os/*.cpp', 'lib/os/*.hpp', 'lib/os/*.py', 'FLAGS']}, -+ packages=['shedskin'] ++ packages=['shedskin'], ++ package_data={'shedskin': ['FLAGS']}, )