Commit graph

53 commits

Author SHA1 Message Date
Olly Betts
0b9d4eff09 Update everything for dropping Python 3.2 support 2022-07-19 13:20:07 +12:00
luz paz
c8bec18554 Fix various typos
Found via `codespell -q 3 -L ans,anumber,ba,bae,chello,clos,cmo,coo,dout,fo,funktion,goin,inout,methid,nd,nin,nnumber,object,objekt,od,ois,packag,parm,parms,pres,statics,strack,struc,tempdate,te,thru,uint,upto,writen`
2022-04-11 07:59:36 +12:00
Olly Betts
c7af8eabb3 Default to running tests with Python 3
Specify PY2=1 to use Python 2.

See #1779
Closes #2235
2022-03-17 18:55:10 +13:00
William S Fulton
89bee6a7fa Modify examples to be both Python 2 and 3 compatible
For removing dependency on 2to3
2020-08-15 16:46:01 +01:00
Dmitry D. Chernov
f88ba7c182 Examples: Unify string quoting in the Python sources 2019-07-14 14:12:23 +10:00
William S Fulton
03323f5c8b The Python module import logic has changed to stop obfuscating real ImportError problems.
Only one import of the low-level C/C++ module from the pure Python module is
attempted now. Previously a second import of the low-level C/C++ module was attempted
after an ImportError occurred and was done to support 'split modules'. A 'split module' is
a configuration where the pure Python module is a module within a Python package and the
low-level C/C++ module is a global Python module. Now a 'split module' configuration is
no longer supported by default. This configuration can be supported with a simple
customization, such as:

  %module(package="mypackage", moduleimport="import $module") foo

or if using -builtin:

  %module(package="mypackage", moduleimport="from $module import *") foo

instead of

  %module(package="mypackage") foo

See the updated Python chapter titled "Location of modules" in the documentation.

Closes #848 #1343
2018-12-16 16:41:39 +00:00
William S Fulton
51dadaeacd Add example to test the Python module being renamed to __init__.py
This examples tests the SWIG generated module being placed into a directory and
then renamed __init__.py to convert the module into a package. This ability
stopped working in swig-3.0.9. However, only Python 2.7 or 3.3 and later work. If
Python 3.2 support is needed, use moduleimport in %module to customise the import
code.

Issue #1282
2018-12-08 22:31:26 +00:00
William S Fulton
ff93f2e26e Skip Python subprocess calls in import_packages testcase on Windows
Getting these kind of errors on Appveyor which uses mingw/cygwin to run
a Python interpreter:

Native windows Python 3.6 running under cygwin and mingw Python 3.7 running under mingw:
  Fatal Python error: _Py_HashRandomization_Init: failed to get random
  numbers to initialize Python

Cygwin Python 2.7 running under cygwin:
  0 [main] python2.7 496 child_info_fork::abort: address space needed by '_foo.dll' (0x6D0000)
  is already occupied
2018-12-06 06:50:57 +00:00
William S Fulton
604ae7186b Fix for running 'python -m' when using swig -builtin
Same as e05b5ea for -builtin.

Also added runtime tests to check 'python -m'.
2018-12-04 19:12:13 +00:00
William S Fulton
9e83d5d5d9 Fix nstest.py test
Use subprocess.check_call as os.system won't stop the test in case of
errors.
2018-12-04 06:49:55 +00:00
Olly Betts
728b8955bd Drop support for Python classic classes
There were only needed to support Python < 2.2, and we now require at
least Python 2.6.

 Conflicts:
	.travis.yml
	Examples/test-suite/python/autodoc_runme.py
	Source/Modules/python.cxx

This is a cherry-pick and merge from patch in #1261
2018-10-12 07:10:47 +01:00
William S Fulton
0d588d19ad Fix out of source clean target in import_packages Makefile 2018-01-07 00:57:23 +00:00
William S Fulton
3066f8950c Minor tweaks in import_packages Makefile 2018-01-06 23:19:04 +00:00
William S Fulton
b0c910ac96 Fix out of source import_packages Makefile 2018-01-06 23:12:52 +00:00
William S Fulton
830422a87b Fix Makefile and skip testing python-2.4 for import_packages test 2018-01-05 20:17:08 +00:00
William S Fulton
aedc3c3eaf Replace assert in Python import examples with code that always runs. 2017-08-13 21:32:44 +01:00
William S Fulton
dd40a25349 Add missing print statements to the Python import_packages tests 2016-06-06 22:12:56 +01:00
William S Fulton
53ff928688 Examples readme file tweak 2016-06-05 11:23:58 +01:00
Mike Romberg
2ea01f349d remove builtin tests as they are already covered. 2016-06-04 14:12:33 -06:00
Mike Romberg
0cc3c78abf Apply patch to cleanup whitespace from wsfulton 2016-06-04 14:07:50 -06:00
Mike Romberg
906564d97c and... remove all the .py files that were copied over from the source tree. 2016-06-03 20:20:33 -06:00
Mike Romberg
055ddc6dfc remove -py3 related tests. Move py3 specific code to it's own module 2016-06-03 18:11:07 -06:00
Mike Romberg
f102d587bc copy everything with a .py extension into the build tree (creating dirs if needed) 2016-06-03 17:30:01 -06:00
Mike Romberg
f1aea15cf7 debug 2016-06-03 13:26:12 -06:00
Mike Romberg
f3c373a584 avoid the shell checks involving __init__.py 2016-06-03 03:17:19 -06:00
Mike Romberg
621325a7dd Something optimizes out empty files and breaks the tests. Put something in. 2016-06-03 01:30:43 -06:00
Mike Romberg
ddc9fc1eb9 split_wrapper -> split_modules to avoid conflict with clean rule 2016-06-02 22:45:59 -06:00
Mike Romberg
355e4b4903 Add cases for tests without the -py3 flag even when PY3 is set. 2016-06-02 17:29:05 -06:00
Mike Romberg
3a459b3f27 Tests/Examples for the use case of splitting the wrapper.
Half of the wrapper in a package and 1/2 is global.
2016-06-02 14:17:38 -06:00
Mike Romberg
5ceef0a813 use %inline for test 2016-05-24 22:46:45 +01:00
Mike Romberg
32304449f9 disable namespace package build 2016-04-05 11:10:04 -06:00
Mike Romberg
6f1c0e3725 Attempt to calm the testing gods... 2016-04-05 11:10:03 -06:00
Mike Romberg
b6c93a14e4 use whatever name winders uses for .so files. 2016-04-05 11:09:14 -06:00
Mike Romberg
0a81b76b31 Examples (and tests) for python namespace packages 2016-04-05 11:06:02 -06:00
Mike Romberg
70a2a11f29 disable namespace package build 2016-04-05 10:58:51 -06:00
Mike Romberg
6f4aa4faf5 spelling 2016-04-05 10:58:50 -06:00
Mike Romberg
ce04d0cdf3 Attempt to calm the testing gods... 2016-04-05 10:58:50 -06:00
Mike Romberg
afc91fe923 use whatever name winders uses for .so files. 2016-04-05 10:58:50 -06:00
Mike Romberg
c0cc731ca8 Don't run example for old pythons 2016-04-05 10:58:50 -06:00
Mike Romberg
ba158e7919 Examples (and tests) for python namespace packages 2016-04-05 10:58:50 -06:00
Alec Cooper
acbe04b548 Support checking names of old-style classic classes 2016-02-04 15:27:54 -05:00
William S Fulton
8e2bc595c6 Remove use of preinst-swig script
Complete the prototype removal in ca1431.

The script prevents SWIGTOOL=gdb from working as gdb can't be used to
debug a shell script, it requires a binary.

Add support for SWIGTOOL in all the examples.

SWIG_LIB_DIR and SWIGEXE must now instead be set by all Makefiles.

See issue #473.
2015-08-21 22:43:17 +01:00
William S Fulton
4ef3507e8b Remove realpath from python/import_packages example 2015-08-20 06:19:12 +01:00
Jon Schlueter
7770715457 autopep8 cleanup of Examples/python whitespace
automated cleanup only of the Examples/python example code
2015-05-08 08:46:06 -04:00
William S Fulton
f6e25f5786 PY3 fixes for import_package example 2015-04-04 02:17:57 +01:00
William S Fulton
a9c6196f71 Display testname when running the import_packages Python examples
For easier identification of what is running in these examples.
2014-10-07 20:58:40 +01:00
William S Fulton
9834a69c18 Fix Python 3 import_packages/relativeimport2 example clean
runme3.py files are generated and should not be checked in
2014-10-07 20:58:40 +01:00
Johan Hake
de4f30bd3c Small fixes to the relative import fix.
-- Now the tests actually runs
  -- Corrected the syntax for the fix in the yacc file
2014-09-29 17:37:41 +02:00
Johan Hake
1dd297ad9d Fix issue with relative import when using single header file import.
-- The commit propagates the package option to the newly create
     module node so it is recognized by SWIG
  -- Added a relativeimport test for this combination
     (in lack of py3 I was not able to test it with py3 but it
      "should just work")
2014-08-12 21:48:26 +02:00
Karl Wette
cc0738bbda Fully clean Python examples and test-suite 2014-05-29 02:29:27 +02:00