Skip to content
Snippets Groups Projects
Verified Commit 6fa0ffc8 authored by Eliot Berriot's avatar Eliot Berriot
Browse files

Working setup with pyinstaller

parent 34464f28
No related branches found
No related tags found
1 merge request!5Resolve "Provide precompiled binaries for easier install"
Pipeline #4174 passed
dist
build
...@@ -11,3 +11,12 @@ This cli requires python 3.6 or greater: ...@@ -11,3 +11,12 @@ This cli requires python 3.6 or greater:
# Usage # Usage
``funkwhale --help`` ``funkwhale --help``
# Build the binary
You can build the binarie for you platform using the following commands:
pip install .[dev]
pyinstaller cli.spec
This will output a binary in `./dist/funkwhale`.
cli.spec 0 → 100644
# -*- mode: python -*-
block_cipher = None
a = Analysis(
["funkwhale_cli/cli.py"],
pathex=["/home/eliotberriot/projects/funkwhale/cli"],
binaries=[],
datas=[],
hiddenimports=[],
hookspath=[],
runtime_hooks=[],
excludes=[],
win_no_prefer_redirects=False,
win_private_assemblies=False,
cipher=block_cipher,
noarchive=False,
)
pyz = PYZ(a.pure, a.zipped_data, cipher=block_cipher)
exe = EXE(
pyz,
a.scripts,
a.binaries,
a.zipfiles,
a.datas,
[],
name="funkwhale",
debug=False,
bootloader_ignore_signals=False,
strip=False,
upx=True,
runtime_tmpdir=None,
console=True,
)
...@@ -7,6 +7,14 @@ import datetime ...@@ -7,6 +7,14 @@ import datetime
import dotenv import dotenv
import functools import functools
import keyring import keyring
# importing the backends explicitely is required for PyInstaller to work
import keyring.backends.kwallet
import keyring.backends.Windows
import keyring.backends.OS_X
import keyring.backends.SecretService
import keyring.backends.chainer
import logging import logging
import math import math
import urllib.parse import urllib.parse
...@@ -16,11 +24,12 @@ import pathvalidate ...@@ -16,11 +24,12 @@ import pathvalidate
import pathlib import pathlib
import urllib.parse import urllib.parse
import tqdm import tqdm
from . import api
from . import config from funkwhale_cli import api
from . import exceptions from funkwhale_cli import config
from . import logs from funkwhale_cli import exceptions
from . import output from funkwhale_cli import logs
from funkwhale_cli import output
click_log.basic_config(logs.logger) click_log.basic_config(logs.logger)
...@@ -173,7 +182,12 @@ def set_server(ctx, url, token, use_auth=True): ...@@ -173,7 +182,12 @@ def set_server(ctx, url, token, use_auth=True):
@TOKEN_DECORATOR @TOKEN_DECORATOR
@click_log.simple_verbosity_option(logs.logger, expose_value=True) @click_log.simple_verbosity_option(logs.logger, expose_value=True)
@click.pass_context @click.pass_context
def cli(ctx, env_file, url, verbosity, token, quiet): def cli(ctx, env_file, url, verbosity, token, quiet, no_login):
# small hack to fix some weird issues with pyinstaller and keyring
# there seems to be a cache issue somewhere
del keyring.backend.get_all_keyring.__wrapped__.always_returns
keyring.core.init_backend()
# /end of hack
ctx.ensure_object(dict) ctx.ensure_object(dict)
logs.logger.disabled = quiet logs.logger.disabled = quiet
set_server(ctx, url, token, use_auth=not no_login) set_server(ctx, url, token, use_auth=not no_login)
......
...@@ -44,7 +44,7 @@ dev = ...@@ -44,7 +44,7 @@ dev =
pytest pytest
pytest-mock pytest-mock
pytest-env pytest-env
pyinstaller
[options.packages.find] [options.packages.find]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment