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

Various version related fixes #8135

Merged
merged 2 commits into from
Sep 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions build/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,13 @@ def read_requirements(file_name: str, directory: str = ".") -> list[str]:
version_numbers = [str(value) for value in map(int, re.findall(r"\d+", raw_version))]
version = Version(".".join(version_numbers))

# cx_Freeze does not automatically make the package metadata
os.mkdir("tribler.dist-info")
with open("tribler.dist-info/METADATA", "w") as metadata_file:
metadata_file.write(f"""Metadata-Version: 2.3
Name: Tribler
Version: {str(version)}""")

setup(
name="tribler",
version=str(version),
Expand Down
8 changes: 8 additions & 0 deletions build/tribler.spec
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,13 @@ raw_version = os.getenv("GITHUB_TAG")
version_numbers = [str(value) for value in map(int, re.findall(r"\d+", raw_version))]
version_str = str(Version(".".join(version_numbers)))

# PyInstaller can automatically generate metadata but I don't trust it (Quinten)
os.mkdir("tribler.dist-info")
with open("tribler.dist-info/METADATA", "w") as metadata_file:
metadata_file.write(f"""Metadata-Version: 2.3
Name: Tribler
Version: {version_str}""")

# On macOS, we always show the console to prevent the double-dock bug (although the OS does not actually show the console).
# See https://github.com/Tribler/tribler/issues/3817
show_console = os.environ.get('SHOW_CONSOLE', 'false') == 'true'
Expand All @@ -42,6 +49,7 @@ data_to_copy = [
(os.path.join(src_dir, "tribler", "core"), 'tribler_source/tribler/core'),
(os.path.join(src_dir, "tribler", "ui"), 'tribler_source/tribler/ui'),
(os.path.join(root_dir, "build", "win", "resources"), 'tribler_source/resources'),
(os.path.join(root_dir, "tribler.dist-info", "METADATA"), 'tribler.dist-info/METADATA'),

(os.path.dirname(aiohttp_apispec.__file__), 'aiohttp_apispec')
]
Expand Down
1 change: 1 addition & 0 deletions build/win/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ def get_freeze_build_options():
("src/tribler/ui/public", "tribler_source/tribler/ui/public"),
("src/tribler/ui/dist", "tribler_source/tribler/ui/dist"),
("build/win/resources", "tribler_source/resources"),
"tribler.dist-info/METADATA"
]

# These packages will be excluded from the build
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
from tribler.core.libtorrent.torrentdef import MetainfoDict, TorrentDef, TorrentDefNoMetainfo
from tribler.core.libtorrent.uris import unshorten, url_to_path
from tribler.core.notifier import Notification, Notifier
from tribler.tribler_config import VERSION_SUBDIR

if TYPE_CHECKING:
from tribler.core.libtorrent.download_manager.dht_health_manager import DHTHealthManager
Expand Down Expand Up @@ -299,13 +300,12 @@ def create_session(self, hops: int = 0) -> lt.session: # noqa: PLR0915
libtorrent_port = self.config.get("libtorrent/port")
logger.info("Libtorrent port: %d", libtorrent_port)
if hops == 0:
settings["user_agent"] = "Tribler/Experimental"
settings["user_agent"] = 'Tribler/' + VERSION_SUBDIR
enable_utp = self.config.get("libtorrent/utp")
settings["enable_outgoing_utp"] = enable_utp
settings["enable_incoming_utp"] = enable_utp
settings["prefer_rc4"] = True
settings["listen_interfaces"] = f"0.0.0.0:{libtorrent_port or 6881}"
settings["handshake_client_version"] = "Tribler/Experimental"
else:
settings["enable_outgoing_utp"] = True
settings["enable_incoming_utp"] = True
Expand Down