feat: py 3.12 & cleanup
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/cron/woodpecker Pipeline was successful

This commit is contained in:
nyyu 2024-01-06 22:12:55 +01:00
parent b87b26a1e6
commit c3e3180191
4 changed files with 86 additions and 21 deletions

View file

@ -1,10 +1,11 @@
FROM ghcr.io/linuxserver/baseimage-alpine:3.19 FROM python:3.12.1-alpine
# set version label # set version label
ARG DOCKER_IMAGE_CREATED ARG DOCKER_IMAGE_CREATED
ARG VERSION ARG VERSION
LABEL build_version="pyload docker version:- ${VERSION} Build-date:- ${DOCKER_IMAGE_CREATED}" LABEL build_version="pyload docker version:- ${VERSION} Build-date:- ${DOCKER_IMAGE_CREATED}"
ENV HOME="/config" # add local files
COPY *.patch root/ /
RUN \ RUN \
wget https://nexus.nyyu.dev/repository/files/alpine/7zip-23.01-r0.apk && \ wget https://nexus.nyyu.dev/repository/files/alpine/7zip-23.01-r0.apk && \
@ -14,35 +15,32 @@ RUN \
apk add --no-cache --virtual=build-dependencies \ apk add --no-cache --virtual=build-dependencies \
build-base \ build-base \
curl-dev \ curl-dev \
libffi-dev \ patch && \
libjpeg-turbo-dev \
openssl-dev \
python3-dev \
zlib-dev && \
echo "**** install packages ****" && \ echo "**** install packages ****" && \
apk add --no-cache \ apk add --no-cache \
tini su-exec shadow \
curl \ curl \
ffmpeg \
libjpeg-turbo \
python3 \
py3-pip \
sqlite \
tesseract-ocr && \ tesseract-ocr && \
echo "**** install pyload ****" && \ echo "**** install pyload ****" && \
PYLOAD='https://github.com/pyload/pyload/archive/develop.zip#[all]' && \ PYLOAD='https://github.com/pyload/pyload/archive/develop.zip#[all]' && \
if [[ -n "${VERSION}" && "${VERSION}" != "dev" ]]; then \ if [[ -n "${VERSION}" && "${VERSION}" != "dev" ]]; then \
PYLOAD="pyload-ng[all]==${VERSION}"; \ PYLOAD="pyload-ng[all]==${VERSION}"; \
fi && \ fi && \
pip3 install --break-system-packages -U "${PYLOAD}" && \ pip3 install --no-cache-dir --break-system-packages -U "${PYLOAD}" && \
pip uninstall -y Js2Py && \
cd /usr/local/lib/python3.12/site-packages/ && patch -Np1 < /py3-12.patch && cd / \
echo "**** cleanup ****" && \ echo "**** cleanup ****" && \
apk del --purge \ apk del --purge \
build-dependencies && \ build-dependencies && \
rm -rf \ rm -rf \
/tmp/* /tmp/* \
/*.patch && \
# add local files echo "**** add user abc ****" && \
COPY root/ / adduser -D -u 911 -h /config abc
# ports and volumes # ports and volumes
EXPOSE 8000 EXPOSE 8000
VOLUME /config VOLUME /config
ENTRYPOINT ["/sbin/tini", "--"]
CMD ["/start.sh"]

57
py3-12.patch Normal file
View file

@ -0,0 +1,57 @@
diff --git a/pyload/core/utils/check.py b/pyload/core/utils/check.py
index 3c98fd490..4f135cf0b 100644
--- a/pyload/core/utils/check.py
+++ b/pyload/core/utils/check.py
@@ -1,6 +1,5 @@
# -*- coding: utf-8 -*-
-import imp
from collections.abc import Iterable, Mapping, Sequence
@@ -54,17 +53,6 @@ def is_mapping(obj):
return isinstance(obj, Mapping)
-def is_module(name, path=None):
- """Check if exists a module with given name."""
- try:
- fp, _, _ = imp.find_module(name, path)
- if fp is not None:
- fp.close()
- return True
- except ImportError:
- return False
-
-
def missing(iterable, start=None, end=None):
"""List all the values between 'start' and 'stop' that are missing from 'iterable'."""
iter_seq = set(map(int, iterable))
diff --git a/pyload/core/utils/misc.py b/pyload/core/utils/misc.py
index 6d2f23cc5..96d931108 100644
--- a/pyload/core/utils/misc.py
+++ b/pyload/core/utils/misc.py
@@ -3,11 +3,6 @@
import random
import string
-import js2py
-
-js2py.disable_pyimport()
-
-
def random_string(length):
seq = string.ascii_letters + string.digits + string.punctuation
return "".join(random.choice(seq) for _ in range(length))
@@ -23,8 +18,7 @@ def is_plural(value):
def eval_js(script, es6=False):
# return requests_html.HTML().render(script=script, reload=False)
- return (js2py.eval_js6 if es6 else js2py.eval_js)(script)
-
+ return None
def accumulate(iterable, to_map=None):
"""
--

View file

@ -1,4 +0,0 @@
#!/usr/bin/with-contenv bash
exec \
s6-setuidgid abc pyload --userdir /config --storagedir /downloads

14
root/start.sh Executable file
View file

@ -0,0 +1,14 @@
#!/bin/sh
set -e
PUID=${PUID:-911}
PGID=${PGID:-911}
groupmod -o -g "$PGID" abc 2>/dev/null
usermod -o -u "$PUID" abc 2>/dev/null
for f in /etc/cont-init.d/*; do
sh "$f"
done
exec su-exec abc pyload --userdir /config --storagedir /downloads