Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix is_frozen, get_core_path(), get_gui_path() when cx_freeze is used for building binaries #8001

Merged
merged 4 commits into from
Apr 24, 2024

Conversation

kozlovsky
Copy link
Contributor

@kozlovsky kozlovsky commented Apr 24, 2024

This PR fixes #8000.

First, it fixes the logic of is_frozen() and several functions that return base paths for resources (such as get_logger_config_path()).

Second, it fixes an issue with function naming: Currently, in Tribler we have two different functions with the same name get_base_path() that return different results:

  • One function is defined in tribler/core/utilities/install_dir.py and returns "some" base directory; that exact meaning of the directory is different when Tribler runs from sources and when it runs as a binary. It is only used by another function, get_lib_path(), which is defined in the same module.
  • Another function with the same name get_base_path() is defined in tribler/gui/utilities.py and returns base directory for GUI-related resources.

To avoid confusion and re-use the common logic, this PR renames and reactors the mentioned functions in the following way:

  • get_base_path() from tribler.core.utilities.install_dir keeps its name, but now it always returns the directory that contains core / gui subdirectories.
  • get_lib_path() is renamed to get_core_path() and returns the core directory as before.
  • get_base_path() from tribler/gui/utilities is renamed to get_gui_path() and returns the gui directory as before.

Now all three functions get_core_path(), get_gui_path(), get_logger_config_path() internally use get_base_path() to avoid code duplication.

@kozlovsky kozlovsky force-pushed the fix/cx_freeze_support branch from 6af13e0 to c1ad3e8 Compare April 24, 2024 04:31
@kozlovsky kozlovsky requested a review from xoriole April 24, 2024 04:53
@kozlovsky kozlovsky force-pushed the fix/cx_freeze_support branch from b8276f7 to 7af4492 Compare April 24, 2024 05:12
@kozlovsky kozlovsky force-pushed the fix/cx_freeze_support branch from 7af4492 to 61c0c08 Compare April 24, 2024 08:06
@kozlovsky kozlovsky merged commit 2ba7d6f into Tribler:release/7.14 Apr 24, 2024
15 of 16 checks passed
@kozlovsky kozlovsky deleted the fix/cx_freeze_support branch April 24, 2024 10:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants