Commit Graph

34 Commits

Author SHA1 Message Date
Pascal Obry
d940bd173b Fix link issue with gnatcoll_python on Windows.
To build a Windows DLL we do not want a single __declspec(dllexport) as
in this case only the routines marked with this attribute will be
exported from the DLL.

For P120-046.

Change-Id: I02ca24cebe2740728bfe6584ea9bbff1e4a9c86e
2016-02-03 12:13:52 +01:00
Emmanuel Briot
aa84b70853 Update copyright year
Change-Id: Ibc7640eaef7ae555da7e11b179d5b153ec98e4ea
2016-01-04 12:03:03 +01:00
Emmanuel Briot
6c0ff5384c Minor memory leak fix
for OB24-013
Add traces to help investigate python issues (list all callbacks from
python to Ada in the traces)

Change-Id: I38c7680a82a520f89f53f54ab06fe7fe3adbe25b
2015-11-24 17:34:20 +01:00
Vadim Godunko
b715307775 Raise exception when requested parameter is dictionary or set.
Part of O325-004.

Change-Id: I4359ed1ef3a2b08b110796c5190c3d4f866d542a
2015-03-31 18:03:19 +03:00
Emmanuel Briot
c4292f179e Update copyright notices to 2015 2015-01-05 11:16:11 +01:00
Emmanuel Briot
bf26694133 Update copyright notices to 2014
N103-019

git-svn-id: svn+ssh://svn.eu.adacore.com/Dev/trunk/gps@221487 936e1b1b-40f2-da11-902a-00137254ae57
2014-01-06 10:29:22 +00:00
Nicolas Setton
7ed540b28a (ada_is_subclass): Use PyObject_IsSubclass, which works
better than PyObject_TypeCheck for classes. Found in the
context of MA04-005.


git-svn-id: svn+ssh://svn.eu.adacore.com/Dev/trunk/gps@219329 936e1b1b-40f2-da11-902a-00137254ae57
2013-11-13 15:39:05 +00:00
Emmanuel Briot
9a5485d479 Update copyright notice to 2013
M103-015

git-svn-id: svn+ssh://svn.eu.adacore.com/Dev/trunk/gps@200402 936e1b1b-40f2-da11-902a-00137254ae57
2013-01-08 10:50:34 +00:00
Emmanuel Briot
d62e43bed5 Add support for python 3.1
We only supported python 3.2
L716-002

git-svn-id: svn+ssh://svn.eu.adacore.com/Dev/trunk/gps@192584 936e1b1b-40f2-da11-902a-00137254ae57
2012-07-23 15:06:21 +00:00
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