Commit 4835c901 authored by Kirill Smelkov's avatar Kirill Smelkov

pygolang: Accompany python-interpreter with gpython-interpreter to run gpython...

pygolang: Accompany python-interpreter with gpython-interpreter to run gpython instead of std python

With python-interpreter staying the default for pyprog, but possible to adjust.

We will need gpython-interpreter for ERP5 to use bstr+ustr as builting string types.

Remove [gpython] script in favour of gpython-interpreter since both provide the
same thing but via slightly different ways internally ([gpython] was generating
bin/gpython via setuptools and [gpython-interpreter] does it by hand with
user-visible result staying the same).

/cc @kazuhiko, @jerome
parent 749ed882
...@@ -8,7 +8,7 @@ extends = ...@@ -8,7 +8,7 @@ extends =
parts = parts =
pygolang pygolang
gpython gpython-interpreter
# pygolang is installed from git checkout # pygolang is installed from git checkout
...@@ -21,14 +21,6 @@ setup-eggs = ...@@ -21,14 +21,6 @@ setup-eggs =
setuptools-dso setuptools-dso
gevent gevent
# gpython program
[gpython]
recipe = zc.recipe.egg:scripts
eggs = ${pygolang:egg}
scripts = gpython
# convenience for gpython users
exe = ${buildout:bin-directory}/gpython
[pygolang-repository] [pygolang-repository]
recipe = slapos.recipe.build:gitclone recipe = slapos.recipe.build:gitclone
repository = https://lab.nexedi.com/nexedi/pygolang.git repository = https://lab.nexedi.com/nexedi/pygolang.git
...@@ -63,6 +55,16 @@ scripts = ${:interpreter} ...@@ -63,6 +55,16 @@ scripts = ${:interpreter}
exe = ${buildout:bin-directory}/${:interpreter} exe = ${buildout:bin-directory}/${:interpreter}
# gpython-interpreter is like python-interpreter, but runs gpython instead of standard python.
[gpython-interpreter]
<= python-interpreter
interpreter = gpython
initialization =
from gpython import main
main()
sys.exit(0)
# pyprog provides macro recipe to build python programs. # pyprog provides macro recipe to build python programs.
# #
# Contrary to zc.recipe.egg:scripts it generates scripts that are run with # Contrary to zc.recipe.egg:scripts it generates scripts that are run with
...@@ -77,6 +79,13 @@ exe = ${buildout:bin-directory}/${:interpreter} ...@@ -77,6 +79,13 @@ exe = ${buildout:bin-directory}/${:interpreter}
# exe = ${buildout:bin-directory}/myprog # exe = ${buildout:bin-directory}/myprog
# entry = my.py.mod:main # entry = my.py.mod:main
# eggs = ... # eggs = ...
#
# By default python interpreter defined in [python-interpreter] section is used
# to run the program. The default can be adjusted as illustrated below:
#
# [myprog]
# <= pyprog
# python-interpreter = gpython-interpreter # set to name of the section that defines the interpreter
[pyprog] [pyprog]
recipe = slapos.recipe.build recipe = slapos.recipe.build
initialization = initialization =
...@@ -88,6 +97,7 @@ init = ...@@ -88,6 +97,7 @@ init =
entry = options['entry'] entry = options['entry']
eggs = options['eggs'] eggs = options['eggs']
pyinit = options['initialization'] pyinit = options['initialization']
pyinterpreter = options.get('python-interpreter', 'python-interpreter')
options['depends'] += '$${.%s.pyprog:recipe}' % name options['depends'] += '$${.%s.pyprog:recipe}' % name
...@@ -114,7 +124,7 @@ init = ...@@ -114,7 +124,7 @@ init =
# .X.pyexe is python interpreter used by .X.pyprog # .X.pyexe is python interpreter used by .X.pyprog
[.%(name)s.pyexe] [.%(name)s.pyexe]
<= python-interpreter <= %(pyinterpreter)s
eggs += %(__eggs)s eggs += %(__eggs)s
interpreter = $${:_buildout_section_name_} interpreter = $${:_buildout_section_name_}
""" % locals()) """ % locals())
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment