fix: use Python script to filter requirements.txt instead of sed
Replace brittle sed patch with a Python script that: 1. Removes Windows/macOS-only packages (pywin32, pyobjc, etc.) 2. Unpins versions to let pip resolve with system packages from apt
This commit is contained in:
+20
-2
@@ -33,8 +33,26 @@ RUN export SABNZBD_VERSION=3.7.2 PAR2CMDLINE_VERSION=v0.6.14-mt1 && \
|
|||||||
curl -SL -o /tmp/sabnzbd.tar.gz https://github.com/sabnzbd/sabnzbd/releases/download/${SABNZBD_VERSION}/SABnzbd-${SABNZBD_VERSION}-src.tar.gz && \
|
curl -SL -o /tmp/sabnzbd.tar.gz https://github.com/sabnzbd/sabnzbd/releases/download/${SABNZBD_VERSION}/SABnzbd-${SABNZBD_VERSION}-src.tar.gz && \
|
||||||
tar xzf /tmp/sabnzbd.tar.gz && \
|
tar xzf /tmp/sabnzbd.tar.gz && \
|
||||||
mv SABnzbd-* sabnzbd && \
|
mv SABnzbd-* sabnzbd && \
|
||||||
sed -i 's/==.*//' /sabnzbd/requirements.txt && \
|
python3 -c "
|
||||||
sed -i '/pywin32/d' /sabnzbd/requirements.txt && \
|
import re
|
||||||
|
with open('/sabnzbd/requirements.txt') as f:
|
||||||
|
lines = f.readlines()
|
||||||
|
filtered = []
|
||||||
|
for line in lines:
|
||||||
|
stripped = line.strip()
|
||||||
|
# Keep comments and blank lines
|
||||||
|
if not stripped or stripped.startswith('#'):
|
||||||
|
filtered.append(line)
|
||||||
|
continue
|
||||||
|
# Remove platform-specific packages (Windows, macOS)
|
||||||
|
if re.search(r'platform_system\s*==\s*[\"\\'](Windows|Darwin)[\"\\']', stripped):
|
||||||
|
continue
|
||||||
|
# Unpin to let pip resolve with system versions
|
||||||
|
line = re.sub(r'(==|>=|<=|!=|~=|<|>)[\d\.\*\+\-a-zA-Z]+', '', line, count=1)
|
||||||
|
filtered.append(line)
|
||||||
|
with open('/sabnzbd/requirements.txt', 'w') as f:
|
||||||
|
f.writelines(filtered)
|
||||||
|
" && \
|
||||||
pip3 install -r /sabnzbd/requirements.txt && \
|
pip3 install -r /sabnzbd/requirements.txt && \
|
||||||
chown -R sabnzbd: sabnzbd && \
|
chown -R sabnzbd: sabnzbd && \
|
||||||
curl -o /tmp/par2cmdline-mt.tar.gz https://codeload.github.com/jkansanen/par2cmdline-mt/tar.gz/${PAR2CMDLINE_VERSION} && \
|
curl -o /tmp/par2cmdline-mt.tar.gz https://codeload.github.com/jkansanen/par2cmdline-mt/tar.gz/${PAR2CMDLINE_VERSION} && \
|
||||||
|
|||||||
Reference in New Issue
Block a user