Aloha!

I just stumbled over some curious behaviour trying to fix python-2-style
source code (yes, i know..).

OpenRAM fails to build in the 'compile-bytecode phase due to some
Python2 style source code.  So, naturally, I try to patch that in a
phase¹.  Which fails with this output:

--8<---------------cut here---------------start------------->8---
error: in phase 'fix-python-code': uncaught exception:
decoding-error "peek-char" "input decoding error" 84 #<input: 
compiler/gdsMill/pyx/deformer.py 11> 
phase `fix-python-code' failed after 0.0 seconds
Backtrace:
          14 (primitive-load "/gnu/store/x5jl2vavmg3zp5fz3ivmnhxvgdv…")
In guix/build/gnu-build-system.scm:
    972:2 13 (gnu-build #:source _ #:outputs _ #:inputs _ #:phases . #)
In ice-9/boot-9.scm:
  1752:10 12 (with-exception-handler _ _ #:unwind? _ # _)
In srfi/srfi-1.scm:
    634:9 11 (for-each #<procedure 7fffee7816a0 at guix/build/gnu-b…> …)
In ice-9/boot-9.scm:
  1752:10 10 (with-exception-handler _ _ #:unwind? _ # _)
In guix/build/gnu-build-system.scm:
   993:23  9 (_)
In ice-9/boot-9.scm:
  1752:10  8 (with-exception-handler _ _ #:unwind? _ # _)
In ice-9/ports.scm:
   433:17  7 (call-with-input-file _ _ #:binary _ #:encoding _ # _)
In guix/build/utils.scm:
   909:26  6 (_ #<input: compiler/gdsMill/pyx/deformer.py 11>)
   980:22  5 (loop "# Copyright (C) 2003-2006 Michael Schindler <m-s…")
In ice-9/rdelim.scm:
   195:24  4 (read-line _ _)
In unknown file:
           3 (%read-line #<input: compiler/gdsMill/pyx/deformer.py 11>)
In ice-9/boot-9.scm:
  1685:16  2 (raise-exception _ #:continuable? _)
  1685:16  1 (raise-exception _ #:continuable? _)
  1685:16  0 (raise-exception _ #:continuable? _)

ice-9/boot-9.scm:1685:16: In procedure raise-exception:
Throw to key `decoding-error' with args `("peek-char" "input decoding error" 84 
#<input: compiler/gdsMill/pyx/deformer.py 11>)'.
build process 18 exited with status 256
builder for `/gnu/store/3l72a4yaskjppahgmsvv17yr3z7m2j99-openram-1.2.48.drv' 
failed with exit code 1
--8<---------------cut here---------------end--------------->8---

When I try just the (substitute* ) part from a `guix repl` and the
manually downloaded file² the substitution works just fine.

yelninei on #guix tells me that the builder sets LC_ALL=C.UTF-8, so I
guess this would explain the bahaviour (the second author line contains
an é).  Is this a bug in the builder?


How can I resolve this?  Of course the best way would be to not include
Python 2 code in a package.  I guess patching the sources would work
(but I'd like to refrain from that).  Can and should I convert the
file's encoding before substitute*ing?


Thanks for your input in advance!
gabber


¹ https://codeberg.org/guix/guix/pulls/7103
² 
https://raw.githubusercontent.com/VLSIDA/OpenRAM/refs/heads/stable/compiler/gdsMill/pyx/deformer.py

Reply via email to