View previous topic :: View next topic |
Author |
Message |
EvanJohn
Joined: 20 Oct 2014 Posts: 4 Location: Melbourne, Australia
|
Posted: Thu Oct 23, 2014 7:25 am Post subject: Cython - grouping extension modules into packages |
|
|
I have read that Cython will allow extension modules to be combined into packages. I am having a lot of trouble doing this in the VMS environment.
This is hot helped by the fact that the setup() and cythonize() functions are useless in the VMS environment. Perhaps if I could get them working it would solve my problem. Personally I find it much easier to simply use build command lines and MMS.
When I use "$ python setup.py build_ext -v -n" the link command generated is not usable, and the C compiler is invoked via "mc cc" - which is really weird. This does not worry me too much so that I can create a package and link it using the "cython", "cc" and "link" commands "au naturel". |
|
Back to top |
|
 |
bisonmalembouche
Joined: 01 Jun 2005 Posts: 74
|
|
Back to top |
|
 |
EvanJohn
Joined: 20 Oct 2014 Posts: 4 Location: Melbourne, Australia
|
Posted: Mon Oct 27, 2014 2:48 am Post subject: Thenk you for the links |
|
|
I gather from the two links that starlet is a module and vms is a package.
I am interested in the package - which is vms, not starlet. My questions are:
Was the vmslib C code generated by Cython or was it hand coded? In either case I need to look at the source.
How are the individual modules - like starlet - linked to the vms package? Are they in the same image? It looks like they are not in the same C compilation (and the same object file) but I guess it is possible. If they are in separate images do they use the same "init..." symbol names? |
|
Back to top |
|
 |
EvanJohn
Joined: 20 Oct 2014 Posts: 4 Location: Melbourne, Australia
|
Posted: Mon Oct 27, 2014 7:48 am Post subject: I think I get it. |
|
|
I had a look at the VMS package a bit more carefully. This is how I think it works:
Each extension module has a straight PY wrapper. E.g. the ptd extension module is called _vmsptd and has a wrapper which is __init__.py in the directory python_root:[local.vms.ptd]. This __init__ defines the wrapper class "Ptd".
The extension, meanwhile, is called _vmsptd and is provided by _vmsptd.exe in the same directory, with the entry-point init_vmsptd.
I think, therefore, the answer to my question is that extension modules are grouped into packages using standard py - directories and classes. The standard py wraps the underlying extension modules which reside in the same directories. |
|
Back to top |
|
 |
bisonmalembouche
Joined: 01 Jun 2005 Posts: 74
|
|
Back to top |
|
 |
EvanJohn
Joined: 20 Oct 2014 Posts: 4 Location: Melbourne, Australia
|
Posted: Wed Oct 29, 2014 2:39 am Post subject: |
|
|
Thanks for that. I discovered that the main thing I was missing was the __init__.py file in the package directory. This allows the module shareable images to be found using the package (directory) name. (I am a complete beginner at Python, unfortunately.)
All cool. It works really well. Thanks for the help.
PS I have previously tried to export "native" functionality to PHP. This is extremely tedious. Cython makes this kind of thing possible - and efficient. |
|
Back to top |
|
 |
bisonmalembouche
Joined: 01 Jun 2005 Posts: 74
|
|
Back to top |
|
 |
|