mijorus / smile

An emoji picker for linux, with custom tags support and localization. I'll also put some random emojis here πŸ¦πŸΎπŸ¦”πŸ¦‡
https://mijorus.it/projects/smile
GNU General Public License v3.0
237 stars 13 forks source link

FileNotFoundError: emoji_list.py #3

Closed yochananmarqos closed 2 years ago

yochananmarqos commented 2 years ago

I tried building 1.1.5 from source, but the generate_emoji_dict.py script failed:

Running custom install script '/usr/bin/python /build/smile/src/smile-1.1.5/build-aux/meson/emoji_list/generate_emoji_dict.py'
--- stdout ---

--- stderr ---
Traceback (most recent call last):
  File "/build/smile/src/smile-1.1.5/build-aux/meson/emoji_list/generate_emoji_dict.py", line 72, in <module>
    output_file = open(f"{datadir}/emoji_list.py", 'w+')
FileNotFoundError: [Errno 2] No such file or directory: '/usr/share/smile/smile/assets/emoji_list.py'

FAILED: install script '/usr/bin/python /build/smile/src/smile-1.1.5/build-aux/meson/emoji_list/generate_emoji_dict.py' exit code 1, stopped
mijorus commented 2 years ago

Hi @yochananmarqos Are you trying to built it directly with meson, or you are building the Flatpak?

yochananmarqos commented 2 years ago

I'm building it with Meson.

mijorus commented 2 years ago

I'm building it with Meson.

As this is my first Linux app, I am quite inexperienced and just targeted flatpak: I didn't test the building process outside of it.

However, that seems to be a problem with python not creating the file on the first run.

Could you please share the python version/os that you are using so I can spin up a VM and possibly push a fix?

Thank you

yochananmarqos commented 2 years ago

I'm using Manjaro (unstable branch) with Python 3.10.2 and Meson 0.61.1. Here's my PKGBUILD. It's probably missing a few dependencies as I haven't been able to determine them yet due to the failed build.

mijorus commented 2 years ago

I was working on a fix but then I remembered that this app heavily relies on gnome's org.gnome.Sdk:41 runtime in order to display emojis correctly.

This is because some of the latest emojis (like skin tones or flags) are displayed as two different emojis on unsupported systems, like this one for example.

This would break the symmetry of the table and would look awful. In other words, unless i re-write the app to use some built-in images Smile is unusable outside of a flatpak.

yochananmarqos commented 2 years ago

That's not the point. The files should be available to Meson, not referencing something you already have installed in your system during build.

mijorus commented 2 years ago

That's not the point. The files should be available to Meson, not referencing something you already have installed in your system during build.

Which version of python are you using? In the error, it looks like it complaints about a file not found, while it should be creating it (note the 'w+' syntax).

yochananmarqos commented 2 years ago

I'm using Python 3.10.4.

yochananmarqos commented 2 years ago

The file structure doesn't look right in /usr/share/smile/. The meson.build should not be installed and there should not be a /usr/share/smile/smile/ directory:

.
└── usr
    └── share
        └── smile
            β”œβ”€β”€ assets
            β”‚Β Β  β”œβ”€β”€ meson.build
            β”‚Β Β  └── NotoColorEmoji.ttf
            β”œβ”€β”€ smile
            β”‚Β Β  β”œβ”€β”€ AboutDialog.py
            β”‚Β Β  β”œβ”€β”€ assets
            β”‚Β Β  β”‚Β Β  β”œβ”€β”€ smile.autostart.desktop
            β”‚Β Β  β”‚Β Β  └── style.css
            β”‚Β Β  β”œβ”€β”€ CustomTagEntry.py
            β”‚Β Β  β”œβ”€β”€ __init__.py
            β”‚Β Β  β”œβ”€β”€ lib
            β”‚Β Β  β”‚Β Β  β”œβ”€β”€ custom_tags.py
            β”‚Β Β  β”‚Β Β  β”œβ”€β”€ emoji_history.py
            β”‚Β Β  β”‚Β Β  └── user_config.py
            β”‚Β Β  β”œβ”€β”€ main.py
            β”‚Β Β  β”œβ”€β”€ meson.build
            β”‚Β Β  β”œβ”€β”€ Picker.py
            β”‚Β Β  β”œβ”€β”€ Settings.py
            β”‚Β Β  β”œβ”€β”€ ShortcutsWindow.py
            β”‚Β Β  β”œβ”€β”€ smile.gresource
            β”‚Β Β  β”œβ”€β”€ smile.gresource.xml
            β”‚Β Β  β”œβ”€β”€ smile.in
            β”‚Β Β  β”œβ”€β”€ ui
            β”‚Β Β  β”‚Β Β  β”œβ”€β”€ menu.xml
            β”‚Β Β  β”‚Β Β  β”œβ”€β”€ settings.glade
            β”‚Β Β  β”‚Β Β  β”œβ”€β”€ settings.glade~
            β”‚Β Β  β”‚Β Β  └── shortcuts.xml
            β”‚Β Β  └── utils.py
            └── smile.gresource
eli-schwartz commented 2 years ago

Which version of python are you using? In the error, it looks like it complaints about a file not found, while it should be creating it (note the 'w+' syntax).

Python reports "File Not Found" when it cannot find the directory the created file needs to be created in. So, the directory /usr/share/smile/smile/assets/ does not exist.

This makes sense, since https://mesonbuild.com/Reference-manual_builtin_meson.html#mesonadd_install_script documents that you should use MESON_INSTALL_DESTDIR_PREFIX but you are using MESON_INSTALL_PREFIX instead.

The actual file that is supposed to be getting created is:

/build/smile/pkg/smile/usr/share/smile/smile/assets/emoji_list.py
yochananmarqos commented 2 years ago

@eli-schwartz Aha! That does the trick.

mijorus commented 2 years ago

lol I am so noob with this.

Btw I fully recognize that "building" a python file is not actually the cleanest thing ever, but hey that works

eli-schwartz commented 2 years ago

Well, you might want to create it using custom_target() instead.

Independent of how you create it, it's probably not completely ideal to close the ticket so quickly.