adrienverge / keyboard-stickers

Localize your keyboard!
GNU General Public License v3.0
5 stars 0 forks source link

add a requirements.txt and fix a python version #2

Open dlyongemallo opened 1 month ago

dlyongemallo commented 1 month ago

I'm trying to use this under Ubuntu 24.04 which has python3.12. When I run make, I get the error: gen-sheet.py:20: DeprecationWarning: 'cgi' is deprecated and slated for removal in Python 3.13.

I used pyenv to install successively lower versions of python, then pip install (e.g., pysvg) to fix the missing package errors, but I could not locate which version of python you originally used as every version I tried threw an error (depending on the version).

For example, under 3.7, this was the error:

  File "keyboard-stickers/.venv/lib/python3.7/site-packages/pysvg/builders.py", line 294
    if value <> None and value <> '':
              ^
SyntaxError: invalid syntax
make: *** [Makefile:4: keyboard-stickers.svg] Error 1

Would you please add a requirements.txt and specify a Python version so that users can replicate your environment? Thanks.

adrienverge commented 1 month ago

Hello, could you test the latest version I just pushed on master? I tested it with Python 3.12.6 and pysvg-py3 0.2.2: it works on my computer. I also added a "requirements" section in the README (no need for requirements.txt for 1 dependency).

dlyongemallo commented 1 month ago

Okay, I've created an environment with Python 3.12.6 and pysvg-py3 0.2.2 and was able to generate the SVG.

In order to generate the PDF, the Makefile uses convert so ImageMagick is another requirement. (So you might want to put that requirement in the README.rst also.) Running make fails with a message ending in:

convert keyboard-stickers.svg -resize 2480x3507 -units PixelsPerInch -density 300x300 keyboard-stickers.pdf
convert-im6.q16: image type not supported `vim.svg' @ error/draw.c/DrawPrimitive/5482.
make: *** [Makefile:7: keyboard-stickers.pdf] Error 1

I tried installing librsvg2-2 and librsvg2-bin and using rsvg-convert -f pdf -o keyboard-stickers.svg, but that failed with the error:

Error reading SVG stdin: XML parse error: Input file is too short

I can clearly view the SVG using eog, for example, so I don't think the file is somehow incorrect or corrupt.

I was also able to produce the PDF using Inkscape, though not with the correct margins for printing.

If converting the SVG to PDF is out of scope for this issue, feel free to close it. I'll fiddle around with the SVG to get a PDF somehow. Thanks for your help.

adrienverge commented 1 month ago

Thanks, I've pushed 2 new commits about ImageMagick. Other the other problems, I don't know, sorry.