Skip to content
  • Kirill Smelkov's avatar
    gpython: Print OS/ARCH in the banner · faaca97e
    Kirill Smelkov authored
    Before this patch:
    
        $ gpython
        Python 3.13.5 (main, Jun 25 2025, 18:55:22) [GCC 14.2.0] [GPython 0.1] [gevent 25.9.1] on linux
        Type "help", "copyright", "credits" or "license" for more information.
        >>>
    
    After this patch:
    
        $ gpython
        Python 3.13.5 (main, Jun 25 2025, 18:55:22) [GCC 14.2.0] [GPython 0.1] [gevent 25.9.1] on linux/riscv64
        Type "help", "copyright", "credits" or "license" for more information.
        >>>
    
    Note that we try not to use golang.runtime when ran not under gpython
    via plain pymain. There we use platform.machine() instead of
    runtime.ARCH, but the output can be different - e.g. aarch64 instead of
    arm64. In general when running under gpython we follow go convention for
    both OS and ARCH, e.g. android, not linux for an Android phone. But when
    running under plain python and pymain we stick to sys.platform and
    platform.machine() to avoid importing golang on workloads that do not
    use it. Plain pymain output for above example looks as:
    
        $ pymain
        Python 3.13.5 (main, Jun 25 2025, 18:55:22) [GCC 14.2.0] on linux/riscv64
        Type "help", "copyright", "credits" or "license" for more information.
        >>>
    
    /reviewed-by @jerome
    /reviewed-on !38
    faaca97e