Alexey-T / Python-for-Lazarus

Fork of Python4Delphi for Lazarus, supports Windows/Linux/macOS/*BSD/Solaris
MIT License
127 stars 42 forks source link

Different Python versions etc. #28

Closed MarkMLl closed 3 years ago

MarkMLl commented 3 years ago

Three related questions:

The last one is the result of my casually trying Python 2.7.

Alexey-T commented 3 years ago

3)

  PyNumberMethods = {$IFNDEF CPUX64}packed{$ENDIF} record

Some defintions are used. but most are not. It is legacy from Py4D.

Alexey-T commented 3 years ago

Lazarus Demo projects haven't yet been converted?

They are Laz projects, why they need to be converted.

Alexey-T commented 3 years ago

Am I correct in noting that the library name has (at present) to be hardcoded in e.g. Python_Console/FormMain.pas?

Yes, no autodetection. It's impossible on Linux

MarkMLl commented 3 years ago
  PyNumberMethods = {$IFNDEF CPUX64}packed{$ENDIF} record

Some defintions are used. but most are not. It is legacy from Py4D.

OK. So PYTHON27 etc. aren't used anywhere.

MarkMLl commented 3 years ago

Lazarus Demo projects haven't yet been converted?

They are Laz projects, why they need to be converted.

Demo01 etc. still refer to P4DLaz and don't compile.

Alexey-T commented 3 years ago

If you tell to @pyscripter to remove old defines, and he will do, I will sync my definitions.inc

pyscripter commented 3 years ago

I have removed all unused definitions.

Alexey-T commented 3 years ago
MarkMLl commented 3 years ago

Am I correct in noting that the library name has (at present) to be hardcoded in e.g. Python_Console/FormMain.pas?

Yes, no autodetection. It's impossible on Linux

"Impossible" and "Linux" are words that are rarely heard together. At the very least and noting that on Debian the choices are

/usr/lib/x86_64-linux-gnu/libpython3.7m.so -> libpython3.7m.so.1 /usr/lib/x86_64-linux-gnu/libpython3.7m.so.1 -> libpython3.7m.so.1.0 /usr/lib/x86_64-linux-gnu/libpython3.7m.so.1.0

I think you'd make life easier if you used the less-specific libpython3.7m.so in preference to the fully-embellished libpython3.7m.so.1.0 at least until you had good reason.

In any event I notice that the original python4delphi project now claims FPC support, so I'm planning to check how they deal with things.

Alexey-T commented 3 years ago

Shortened path to remove '.1.0' in it

MarkMLl commented 3 years ago

But Python_Console already does this path define w/o folder path

const
  cPyLibraryWindows = 'python37.dll';
  cPyLibraryLinux = 'libpython3.8.so.1.0'; //default in Ubuntu 20.x
  cPyLibraryMac = '/Library/Frameworks/Python.framework/Versions/3.7/lib/libpython3.7.dylib';
  cPyZipWindows = 'python37.zip';

Full path was simply because it was ls output to illustrate that the various names were symlinked rather than being distinct files. This is of course exactly the issue which causes so much grief for people using databases etc.: Debian not actually creating the symlinks until a -dev package is installed...

MarkMLl commented 3 years ago

Shortened path to remove '.1.0' in it

I've just checked another system and you might want to consider (partially) reverting that (sorry, my fault). A system with limited development packages installed has

/usr/lib/x86_64-linux-gnu/libpython3.7m.so.1 -> libpython3.7m.so.1.0 /usr/lib/x86_64-linux-gnu/libpython3.7m.so.1.0

i.e. the .so (no digit suffix) might only be created when the Python development packages are installed at least on Debian.

Alexey-T commented 3 years ago

Reverted