-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpycheese.spec
More file actions
90 lines (76 loc) · 2.79 KB
/
pycheese.spec
File metadata and controls
90 lines (76 loc) · 2.79 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
Name: pycheese
Version: 1.0.0
Release: 1%{?dist}
Summary: A PyQt6 Photo Booth with AI Background replacement
License: MIT
URL: https://github.com/tux-peng/PyCheese
# Direct URL to the specific tag tarball
Source0: https://github.com/tux-peng/PyCheese/archive/refs/tags/v1.0.tar.gz
BuildRequires: python3-devel
Requires: python3
# Do not generate 'Provides' or 'Requires' for files in the venv
%global __requires_exclude_from ^/opt/%{name}/venv/.*$
%global __provides_exclude_from ^/opt/%{name}/venv/.*$
# Disable debug info generation (stripping breaks venv python binaries)
%global _enable_debug_package 0
%global debug_package %{nil}
# Prevent automatic byte compiling of the venv (avoids build errors)
%global __os_install_post %{nil}
%description
A robust, feature-rich photo booth application built with Python, PyQt6, and OpenCV.
Uses a self-contained virtual environment to manage dependencie sand ensure
numpy compatibility. Background replacement unlikely to work.
%prep
# -n tells setup that the folder inside the tarball is named 'PyCheese-1.0'
%setup -q -n PyCheese-1.0
%build
# Nothing to compile, this is pure Python.
%install
# 1. Create Directory Structure
mkdir -p %{buildroot}/opt/%{name}
mkdir -p %{buildroot}/usr/bin
mkdir -p %{buildroot}/usr/share/applications
# 2. Copy the main script
install -m 644 pycheese.py %{buildroot}/opt/%{name}/pycheese.py
# 3. Create Virtual Environment inside the package
# Note: This requires network access during the 'rpmbuild' phase.
python3 -m venv %{buildroot}/opt/%{name}/venv
# 4. Install Dependencies
# We upgrade pip first, then install the app requirements
%{buildroot}/opt/%{name}/venv/bin/pip install --upgrade pip
%{buildroot}/opt/%{name}/venv/bin/pip install \
--no-cache-dir \
--ignore-installed \
"PyQt6" \
"opencv-python" \
"mediapipe" \
"numpy<2"
# 5. Fix Venv Paths (The "Relocation" Step)
# The venv currently thinks it lives in %{buildroot}/opt/...
# We must remove %{buildroot} from the scripts so they work on the target system.
find %{buildroot}/opt/%{name}/venv -type f -print0 | xargs -0 sed -i "s|%{buildroot}||g"
# 6. Create the Launcher Script
cat > %{buildroot}/usr/bin/%{name} <<EOF
#!/bin/bash
exec /opt/%{name}/venv/bin/python /opt/%{name}/pycheese.py "\$@"
EOF
chmod 755 %{buildroot}/usr/bin/%{name}
# 7. Create the Desktop Entry
cat > %{buildroot}/usr/share/applications/%{name}.desktop <<EOF
[Desktop Entry]
Version=1.0
Name=PyCheese
Comment=PyQt6 Photo Booth with Filters
Exec=/usr/bin/%{name}
Icon=camera-photo
Terminal=false
Type=Application
Categories=AudioVideo;Video;Recorder;
EOF
%files
/opt/%{name}
/usr/bin/%{name}
/usr/share/applications/%{name}.desktop
%changelog
* Sun Jan 25 2026 Tux Peng <jpenguin@duck.com> - 1.0.0-1
- Initial package with venv isolation