Commit Graph

25 Commits

Author SHA1 Message Date
Emmanuel Briot
f8fc478441 Use execfile() with python 2.x, this might work better with 2.6
(the new version was working fine with 2.7 and 3.2)

git-svn-id: svn+ssh://svn.eu.adacore.com/Dev/trunk/gps@191211 936e1b1b-40f2-da11-902a-00137254ae57
2012-06-21 15:28:33 +00:00
Emmanuel Briot
275a5ad29f Add support for python3
The testsuite is now clean with either python2.7 or python3.2.
 Support for older versions of python has not changed, so we should
 still be compatible with 2.6
L619-031

git-svn-id: svn+ssh://svn.eu.adacore.com/Dev/trunk/gps@191207 936e1b1b-40f2-da11-902a-00137254ae57
2012-06-21 14:40:19 +00:00
Emmanuel Briot
aa09c2449f (Run_Command): cleanup handling of Hide_Output.
We now longer create and call our custom _gnatcoll class to redirect
 sys.stdout, sys.stderr and sys.displayhook. This method was fragile
 in the face of multi-tasking (L607-001). It was also hiding too
 much in fact, since it was often confusing for users that their
 "print" statements did not generate any output (L620-027).
Instead, we now compile with special flags with Py_CompileString,
 so that python does not generate the call to displayhook.
 Because of this, we cannot use __builtins__._ to look at the result
 of the previous command, but we get this output directly from
 PyEval_EvalCode when the code is an expression.
 One of the changes for users is that we can no longer execute a
 string containing a class or function definition or import statement,
 and expect to get its output (but in fact there is none, so the code
 was suspicious in the first place).
A few other optimizations in Run_Command (logging directly using the
 traces module, rather than through the console class), and avoid
 string manipulation when possible.
Provide support for logging exception messages in the log file, to
 help debug scripts.
Finally, this code is in preparation for support of python3 (L619-031)

git-svn-id: svn+ssh://svn.eu.adacore.com/Dev/trunk/gps@191180 936e1b1b-40f2-da11-902a-00137254ae57
2012-06-20 19:23:03 +00:00
Emmanuel Briot
0bac96eb9e Revamp the initialization of python.
The new implementation does more work directly in C, which also makes
 it easier to add support for python 3.
(configure): new switch --with-python-exec
 to force the use of python 3
Support for python3 now compiles, but resulting executables still do not
 work properly yet.

git-svn-id: svn+ssh://svn.eu.adacore.com/Dev/trunk/gps@191120 936e1b1b-40f2-da11-902a-00137254ae57
2012-06-19 15:51:12 +00:00
Emmanuel Briot
a4bd6fffd2 Prevent link errors when the python library is compiled without support
for threads.
L521-010 and L522-013

git-svn-id: svn+ssh://svn.eu.adacore.com/Dev/trunk/gps@189889 936e1b1b-40f2-da11-902a-00137254ae57
2012-05-22 10:34:49 +00:00
Emmanuel Briot
d7f735880d Fix missing 'return' statements in python_support.c, detected when
compiling with -Wall
(configure): use python-config --includes rather than --cflags, since
 the later also provides all the compilation flags used to build
 python itself, and which might not be compatible with the gcc version
 we use for gnatcoll. For instance, on linux python is now built with
 -fstack-protected, which apparently requires special linker switches
 as well.
(configure): export the include and lib flags needed to build python
 C files, in case the user needs to build some. L217-023
(configure): detect whether readline is supported on the system. This
 is currently unused by GNATCOLL, but is cheap to test and might be
 useful to users (for this, its result is exported in gnatcoll.gpr
 too). Also L217-023

git-svn-id: svn+ssh://svn.eu.adacore.com/Dev/trunk/gps@185922 936e1b1b-40f2-da11-902a-00137254ae57
2012-02-17 15:48:55 +00:00
Nicolas Setton
580a829968 Bump to GPL v3.
For KC20-012.



git-svn-id: svn+ssh://svn.eu.adacore.com/Dev/trunk/gps@182693 936e1b1b-40f2-da11-902a-00137254ae57
2011-12-20 10:11:08 +00:00
Emmanuel Briot
e95c9f9a84 (ada_PyUnicode_FromString): do nothing for old versions of python
In particular, this function did not exist in python 2.5, installed on
 kani where the CRM runs


git-svn-id: svn+ssh://svn.eu.adacore.com/Dev/trunk/gps@175303 936e1b1b-40f2-da11-902a-00137254ae57
2011-06-21 15:37:49 +00:00
Emmanuel Briot
f5c0170a2c Make unicode support work whether python was compiled with wide unicode
strings or not (UCS4 or UCS2)
K616-011

git-svn-id: svn+ssh://svn.eu.adacore.com/Dev/trunk/gps@175219 936e1b1b-40f2-da11-902a-00137254ae57
2011-06-20 11:50:30 +00:00
Emmanuel Briot
9dfd2e9399 Add support for python unicode objects.
The previous hack was that PyString_Check also returns True for unicode
 objects, but then the functions PyString_AsString always returned NULL
 for a unicode object. So now PyString_Check only returns true for strings,
 and a new function PyUnicode_Check was added.
(PyBaseString_Check): new function, with the old behavior of PyString_Check
(PyUnicode_*): new functions
For K616-011

git-svn-id: svn+ssh://svn.eu.adacore.com/Dev/trunk/gps@175218 936e1b1b-40f2-da11-902a-00137254ae57
2011-06-20 11:12:55 +00:00
Jerome Lambourg
86d80eaff8 (ada_pystring_check): Also accept unicode strings.
for K111-003


git-svn-id: svn+ssh://svn.eu.adacore.com/Dev/trunk/gps@168952 936e1b1b-40f2-da11-902a-00137254ae57
2011-01-11 08:18:09 +00:00
Emmanuel Briot
97e8141b28 Fix support for mingwin python when using gcc, on Windows
git-svn-id: svn+ssh://svn.eu.adacore.com/Dev/trunk/gps@167613 936e1b1b-40f2-da11-902a-00137254ae57
2010-11-30 12:00:49 +00:00
Emmanuel Briot
ad3a01f71d Add support for exporting properties to python and GPS shell.
Those properties basically provide a simpler syntax around two
 setter() and getter() functions (or possibly just one to make the
 property read-only or write-only).
JB17-022

git-svn-id: svn+ssh://svn.eu.adacore.com/Dev/trunk/gps@167236 936e1b1b-40f2-da11-902a-00137254ae57
2010-11-18 11:20:51 +00:00
Emmanuel Briot
57c659818e (pybool_is_true): minor cleanup.
Python now provides a better function, which preserves the usual python
 semantic. This is more portable than our previous approach.

git-svn-id: svn+ssh://svn.eu.adacore.com/Dev/trunk/gps@167112 936e1b1b-40f2-da11-902a-00137254ae57
2010-11-16 13:23:41 +00:00
Emmanuel Briot
f932142e8b (List_Instance): new type
(Nth_Arg): can now accept lists as parameters to script functions,
 in addition to the usual simple types
JB15-028

git-svn-id: svn+ssh://svn.eu.adacore.com/Dev/trunk/gps@167055 936e1b1b-40f2-da11-902a-00137254ae57
2010-11-15 17:33:14 +00:00
Emmanuel Briot
5ed6316a31 (GNATCOLL.Scripts): now generates new-style classes in python
JB15-010

git-svn-id: svn+ssh://svn.eu.adacore.com/Dev/trunk/gps@167037 936e1b1b-40f2-da11-902a-00137254ae57
2010-11-15 14:56:33 +00:00
Arnaud Charlet
1991ff772f Update copyright notice.
git-svn-id: svn+ssh://svn.eu.adacore.com/Dev/trunk/gps@162804 936e1b1b-40f2-da11-902a-00137254ae57
2010-07-23 09:32:24 +00:00
Arnaud Charlet
21297c153f Minor reformatting.
git-svn-id: svn+ssh://svn.eu.adacore.com/Dev/trunk/gps@162803 936e1b1b-40f2-da11-902a-00137254ae57
2010-07-23 09:32:05 +00:00
Emmanuel Briot
8fd89eac92 Added support for boolean types (supported in python since 2.5). This is
needed to better handle calling python functions from Ada when they
 return a "bool"

git-svn-id: svn+ssh://svn.eu.adacore.com/Dev/trunk/gps@152423 936e1b1b-40f2-da11-902a-00137254ae57
2009-11-18 08:34:26 +00:00
Olivier Ramonat
075a388512 Merge gnatpython changes
Add support for PyFloat
Add Py_Main function to start the python interpreter

git-svn-id: svn+ssh://svn.eu/Dev/trunk/gps@132647 936e1b1b-40f2-da11-902a-00137254ae57
2008-11-24 11:52:42 +00:00
Emmanuel Briot
9594a2968a Make use of Py_ssize_t optional, depending on python version
git-svn-id: svn+ssh://svn.eu/Dev/trunk/gps@128228 936e1b1b-40f2-da11-902a-00137254ae57
2008-09-01 13:53:06 +00:00
Emmanuel Briot
4750c182e4 (ada_PyEval_EvalCodeEx): fix types used to match python prototypes.
Fixes regression in the continuous builder in the hooks.1 test


git-svn-id: svn+ssh://svn.eu/Dev/trunk/gps@128188 936e1b1b-40f2-da11-902a-00137254ae57
2008-08-29 13:25:04 +00:00
Emmanuel Briot
f4252deb3b Redo previous check in, including compile.h instead since code.h
did not exist on older versions of python apparently


git-svn-id: svn+ssh://svn.eu/Dev/trunk/gps@126469 936e1b1b-40f2-da11-902a-00137254ae57
2008-07-08 08:03:01 +00:00
Emmanuel Briot
98e59381ba Added explicit #include for code.h, since on some versions of
python it doesn't seem to be included by default, which prevents
 compilation of this file (fails with Python 2.3.4)


git-svn-id: svn+ssh://svn.eu/Dev/trunk/gps@126467 936e1b1b-40f2-da11-902a-00137254ae57
2008-07-08 07:50:51 +00:00
Emmanuel Briot
0c34b8e20f Added support for "make install" (G706-003)
No source file has changed, but they were moved so that they are all under src/
 now (and possibly subdirectories for those sources that depend on optional
 external libraries).
We now support building both static and relocatable libraries at the same time,
 using separate lib and obj directories to avoid conflicts. Also both can be
 installed in the same prefix, the choice between the two can be done by the
 user application


git-svn-id: svn+ssh://svn.eu/Dev/trunk/gps@113225 936e1b1b-40f2-da11-902a-00137254ae57
2007-07-06 12:28:18 +00:00