Python 3.14.7 for MorphOS (libnix build, no ixemul)
===================================================

*** IMPORTANT: if the Shell says the file is not executable, run
***     Protect Python3.14/bin/python3.14 +e
*** (needed after unpacking the .tar.gz; harmless otherwise).

What it is
----------

A standalone build of CPython 3.14.7 for MorphOS 3.x (PowerPC), compiled
with the MorphOS SDK 3.20 GCC 9 in -noixemul mode (libnix runtime).

  - no ixemul.library, no SDK and no GG: assign needed at run time;
  - the interpreter finds its standard library from its own location
    (PROGDIR:), so the directory can live anywhere;
  - tested on MorphOS 3.21 (exec 51.67) on a Power Mac G5.

This is a community port, not an official python.org release.


Contents
--------

  Python3.14/
    bin/python3.14         the interpreter (stripped)
    lib/python3.14/        the standard library (.py and precompiled .pyc)
    lib/python3.14/lib-dynload/   empty: all C modules are built in
    ssl/cert.pem           root certificates (Mozilla CA bundle)
    tests/morphos_smoke.py smoke test
    LICENSES/              licence texts of everything included
    README_EN.txt          this file
    README_FR.txt          the same in French


Installation
------------

1. Unpack the archive anywhere, e.g. in Work: (gives Work:Python3.14).
2. Make the interpreter executable if your unpacker lost the flag:

     Protect Work:Python3.14/bin/python3.14 +e

3. Optional:

     Assign Python: Work:Python3.14
     Path Python:bin ADD

   (put these lines in S:User-Startup to keep them).

IMPORTANT: if the MorphOS SDK is installed, GG:bin contains the SDK's
own python3.14 (an ixemul build).  Run this one by its full path
(Work:Python3.14/bin/python3.14 or Python:bin/python3.14), or make sure
its bin directory comes BEFORE GG:bin in the shell path, otherwise the
SDK's interpreter is started instead.


Smoke test
----------

  cd Work:Python3.14
  bin/python3.14 tests/morphos_smoke.py

It checks paths, files, environment variables, sockets, SSL, the
compression modules, sqlite3, threads, etc. and ends with
"N/N checks passed".  If something fails, keep the full output:

  bin/python3.14 tests/morphos_smoke.py >RAM:smoke.txt *>>RAM:smoke.txt


Paths: Unix style inside Python
-------------------------------

Python sees Unix paths, translated to AmigaDOS paths like ixemul does:

  /Work/dir/file    = Work:dir/file
  /RAM Disk/T       = RAM Disk:T
  /tmp              = T:
  /dev/null         = NIL:
  /dev/tty          = * (the current console)
  /dev/stdin, /dev/stdout, /dev/stderr   the standard streams
  /                 virtual root listing the volumes and assigns
  ../x              parent directory (Unix meaning)

Native AmigaDOS paths ("Work:x", "PROGDIR:lib") are accepted too.
Note that a path starting with "/" is ALWAYS Unix-absolute: "/x" means
the volume "x:", not the AmigaDOS parent directory.

A missing volume never opens a "Please insert volume" requester:
Python just gets FileNotFoundError.  /dev/urandom and the other /dev
entries do not exist; os.urandom() uses random.library.

Seeking past the end of a file, reading there (returns EOF) and
writing there (zero-fills the gap) work as on Unix.


Environment variables
---------------------

os.environ contains the shell's local variables (Set) followed by the
global ones from ENV: (SetEnv).  Assigning os.environ["X"] creates a
local variable of the Python process.

  SSL_CERT_FILE           CA file to use (default: <Python dir>/ssl/cert.pem)
  PYTHONHOME              force the installation directory
  PYMORPHOS_SQLITE_TRACE  if set, sqlite3 prints every failing file
                          operation (SQLite code, errno, AmigaDOS IoErr)
                          to stderr
  CODEPAGE                character set of file names (default ISO-8859-1)


Included modules
----------------

All built into the executable (85 C modules), among them:
  os/posix, io, socket (IPv4), select, ssl and hashlib (OpenSSL 4.0.0),
  zlib, bz2, lzma, compression.zstd (via the MorphOS z/bz2/lzma/zstd
  libraries), sqlite3 (SQLite 3.54.1 built in), decimal, datetime,
  zoneinfo, json, csv, pickle, struct, array, math/cmath, unicodedata,
  CJK codecs, pyexpat/ElementTree, threading, asyncio, multiprocessing
  (no fork: limited), fcntl (no locks), grp, pwd, locale, faulthandler.

System libraries used (all part of MorphOS 3.x): dos, intuition,
locale, bsdsocket, usergroup, random, z, bz2, lzma, zstd.


Limitations
-----------

  - no fork()/exec(): subprocess, os.system() and os.popen() pipes do
    not work;
  - no mmap, no ctypes (no libffi), no curses, no readline (basic line
    input only), no termios, resource, syslog, dbm, tkinter;
  - networking is IPv4 only;
  - sqlite3: file locking uses a "<database>.lock" directory, the WAL
    journal mode and loadable extensions are disabled;
  - no pip / ensurepip: pure-Python packages can be copied into
    lib/python3.14/site-packages by hand;
  - file names are ISO-8859-1 (no system UTF-8).


Building from source
--------------------

The build scripts, the MorphOS patches (the MorphOS SDK's own Python
patches plus the libnix ones) and the libnix compatibility layer
(libmorphoscompat: POSIX functions, Unix/AmigaDOS path translation,
seek past EOF, requester suppression) are in the archive
Python3.14.7-MorphOS-src.tar.gz.  They apply to the unmodified
CPython 3.14.7 sources from python.org and are built on Linux/WSL with
the MorphOS SDK 3.20 cross compiler (build.sh).

To embed Python in your own MorphOS (libnix, GCC 9) program, see the
developer archive Python3.14.7-MorphOS-dev.tar.gz.


Credits
-------

  - Python: the Python Software Foundation and contributors.
  - The MorphOS SDK Python patches: the MorphOS development team.
  - SQLite, OpenSSL, expat, libmpdec, HACL*: their respective authors.
  - libnix port, compatibility layer and packaging: Digitally.


Licences
--------

Python is distributed under the PSF License Agreement.  The MorphOS port
(the libnix compatibility layer libmorphoscompat and the porting patches)
is also distributed under the PSF License Agreement.

The executable statically links runtime libraries from the MorphOS SDK
3.20 (libnix, libauto, libabox, libpthread and the *_shared library
stubs).  They are redistributed as in every -noixemul MorphOS program and
remain under the MorphOS SDK's terms and their authors' copyright.

The texts of all licences that apply to this package are in the LICENSES
directory (see LICENSES/INDEX.txt).
