Skip to content

Commit

Permalink
Hope this fixes for linux and macos too.
Browse files Browse the repository at this point in the history
  • Loading branch information
ozankaraali committed May 20, 2024
1 parent 7260c8d commit 5fe64ba
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 44 deletions.
18 changes: 14 additions & 4 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,14 @@ jobs:
run: |
pip install pyinstaller
pyinstaller qitv-macos.spec
- name: Ad-Hoc Sign the app
- name: Rename the executable
run: mv dist/qitv.app/Contents/MacOS/qitv dist/qitv.app/Contents/MacOS/qitv_cli
- name: Create launcher script
run: |
codesign --force --deep --sign - dist/qitv.app
echo '#!/bin/bash\nopen -n /Applications/qitv.app/Contents/MacOS/qitv_cli' > dist/qitv.app/Contents/MacOS/qitv
chmod +x dist/qitv.app/Contents/MacOS/qitv
- name: Ad-Hoc Sign the app
run: codesign --force --deep --sign - dist/qitv.app
- name: Zip macOS App
run: |
cd dist
Expand Down Expand Up @@ -99,9 +104,14 @@ jobs:
run: |
pip install pyinstaller
pyinstaller qitv-macos.spec
- name: Ad-Hoc Sign the app
- name: Rename the executable
run: mv dist/qitv.app/Contents/MacOS/qitv dist/qitv.app/Contents/MacOS/qitv_cli
- name: Create launcher script
run: |
codesign --force --deep --sign - dist/qitv.app
echo '#!/bin/bash\nopen -n /Applications/qitv.app/Contents/MacOS/qitv_cli' > dist/qitv.app/Contents/MacOS/qitv
chmod +x dist/qitv.app/Contents/MacOS/qitv
- name: Ad-Hoc Sign the app
run: codesign --force --deep --sign - dist/qitv.app
- name: Zip macOS App
run: |
cd dist
Expand Down
68 changes: 39 additions & 29 deletions qitv-linux.spec
Original file line number Diff line number Diff line change
@@ -1,52 +1,62 @@
import site
# -*- mode: python ; coding: utf-8 -*-

import os
from PyInstaller.building.build_main import Analysis, PYZ, EXE, BUNDLE

PACKAGES_PATH = site.getsitepackages()[0]
# Attempt to locate VLC library files in common directories
VLC_PATHS = [
'/usr/lib/x86_64-linux-gnu',
'/usr/lib', # Try this common path as a fallback
'/usr/lib64' # Another common path on some distributions
]
found_vlc_paths = []
VLC_PATH = '/usr/lib/x86_64-linux-gnu' # Default path on Ubuntu

# Check if the VLC libraries exist in any of the specified paths
for path in VLC_PATHS:
if os.path.exists(os.path.join(path, 'libvlc.so')):
found_vlc_paths.append((os.path.join(path, 'libvlc.so'), '.'))
if os.path.exists(os.path.join(path, 'libvlccore.so')):
found_vlc_paths.append((os.path.join(path, 'libvlccore.so'), '.'))
# Find the exact versions of libvlc and libvlccore
libvlc_version = "libvlc.so"
libvlccore_version = "libvlccore.so"

block_cipher = None
# Check if versioned libraries exist; use `ls` to find versions if not directly known
for file in os.listdir(VLC_PATH):
if file.startswith("libvlc.so"):
libvlc_version = file
if file.startswith("libvlccore.so"):
libvlccore_version = file

a = Analysis(
['main.py'],
pathex=[],
binaries=found_vlc_paths,
datas=[
('assets/qitv.png', 'assets/qitv.png')
pathex=[VLC_PATH],
binaries=[
(os.path.join(VLC_PATH, 'vlc/plugins/*'), 'plugins'),
],
datas=[],
hiddenimports=[],
hookspath=[],
hooksconfig={},
runtime_hooks=[],
excludes=[],
win_no_prefer_redirects=False,
win_private_assemblies=False,
cipher=block_cipher,
noarchive=False
noarchive=False,
# If using a custom path for VLC, ensure you include the libvlc libraries
module_collection_mode={
'vlc': 'py',
}
)
pyz = PYZ(a.pure, a.zipped_data, cipher=block_cipher)

pyz = PYZ(a.pure)

exe = EXE(
pyz,
a.scripts,
a.binaries,
a.zipfiles,
a.binaries + [
(libvlc_version, os.path.join(VLC_PATH, libvlc_version), "BINARY"),
(libvlccore_version, os.path.join(VLC_PATH, libvlccore_version), "BINARY")
],
a.datas,
[],
name='qitv',
debug=False,
bootloader_ignore_signals=False,
strip=False,
upx=True,
console=False,
icon='assets/qitv.png'
upx_exclude=[],
runtime_tmpdir=None,
console=True, # Set to False if you want to suppress the console
disable_windowed_traceback=False,
argv_emulation=False,
target_arch=None,
codesign_identity=None,
entitlements_file=None,
)
11 changes: 0 additions & 11 deletions qitv-macos.spec
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,4 @@ app = BUNDLE(
name='qitv.app',
icon='assets/qitv.icns',
bundle_identifier=None,
info_plist={
'CFBundleName': 'qitv',
'CFBundleDisplayName': 'qitv',
'CFBundleIdentifier': 'com.ozankaraali.qitv',
'CFBundleVersion': '1.0',
'CFBundleExecutable': 'qitv',
'CFBundleIconFile': 'qitv.icns',
'NSPrincipalClass': 'NSApplication',
'LSUIElement': True,
},
version='0.0.1'
)

0 comments on commit 5fe64ba

Please sign in to comment.