mirror of
https://github.com/Second-Hand-Friends/kleinanzeigen-bot.git
synced 2026-03-12 10:31:50 +01:00
support Python 3.12
This commit is contained in:
3
.actrc
3
.actrc
@@ -6,5 +6,4 @@
|
|||||||
-W .github/workflows/build.yml
|
-W .github/workflows/build.yml
|
||||||
-j build
|
-j build
|
||||||
--matrix os:ubuntu-latest
|
--matrix os:ubuntu-latest
|
||||||
--matrix PYTHON_VERSION:3.11
|
--matrix PYTHON_VERSION:3.12
|
||||||
|
|
||||||
|
|||||||
53
.github/workflows/build.yml
vendored
53
.github/workflows/build.yml
vendored
@@ -35,18 +35,21 @@ jobs:
|
|||||||
include:
|
include:
|
||||||
- os: macos-latest
|
- os: macos-latest
|
||||||
PYTHON_VERSION: "3.10"
|
PYTHON_VERSION: "3.10"
|
||||||
PUBLISH_RELEASE: true
|
PUBLISH_RELEASE: false
|
||||||
- os: ubuntu-latest
|
- os: ubuntu-latest
|
||||||
PYTHON_VERSION: "3.10"
|
PYTHON_VERSION: "3.10"
|
||||||
PUBLISH_RELEASE: false
|
PUBLISH_RELEASE: false
|
||||||
- os: windows-latest
|
- os: windows-latest
|
||||||
PYTHON_VERSION: "3.10"
|
PYTHON_VERSION: "3.10"
|
||||||
PUBLISH_RELEASE: false
|
PUBLISH_RELEASE: false
|
||||||
|
- os: macos-latest
|
||||||
|
PYTHON_VERSION: "3.12"
|
||||||
|
PUBLISH_RELEASE: true
|
||||||
- os: ubuntu-latest
|
- os: ubuntu-latest
|
||||||
PYTHON_VERSION: "3.11"
|
PYTHON_VERSION: "3.12"
|
||||||
PUBLISH_RELEASE: true
|
PUBLISH_RELEASE: true
|
||||||
- os: windows-latest
|
- os: windows-latest
|
||||||
PYTHON_VERSION: "3.11"
|
PYTHON_VERSION: "3.12"
|
||||||
PUBLISH_RELEASE: true
|
PUBLISH_RELEASE: true
|
||||||
|
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
@@ -85,9 +88,7 @@ jobs:
|
|||||||
|
|
||||||
python -m pip install --upgrade pip
|
python -m pip install --upgrade pip
|
||||||
|
|
||||||
# pin packaging to 21.3 for now to prevent: packaging.specifiers.InvalidSpecifier: Invalid specifier: '>=3.4.*'
|
pip install --upgrade pdm
|
||||||
# see https://github.com/pdm-project/pdm/issues/1556
|
|
||||||
pip install --upgrade pdm packaging==21.3
|
|
||||||
|
|
||||||
pdm install -v
|
pdm install -v
|
||||||
|
|
||||||
@@ -205,7 +206,7 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Git checkout
|
- name: Git checkout
|
||||||
# only required by "hub release create" to prevent "fatal: Not a git repository"
|
# only required by "gh release create" to prevent "fatal: Not a git repository"
|
||||||
uses: actions/checkout@v4 #https://github.com/actions/checkout
|
uses: actions/checkout@v4 #https://github.com/actions/checkout
|
||||||
|
|
||||||
- name: Generate GitHub access token
|
- name: Generate GitHub access token
|
||||||
@@ -227,28 +228,16 @@ jobs:
|
|||||||
uses: actions/download-artifact@v3
|
uses: actions/download-artifact@v3
|
||||||
|
|
||||||
- name: "Delete previous 'latest' release"
|
- name: "Delete previous 'latest' release"
|
||||||
run: |
|
env:
|
||||||
set -eu
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
RELEASE_NAME: latest
|
||||||
api_base_url="$GITHUB_API_URL/repos/$GITHUB_REPOSITORY"
|
# https://cli.github.com/manual/gh_release_delete
|
||||||
|
run: gh release delete "$RELEASE_NAME" --yes --cleanup-tag || true
|
||||||
# delete 'latest' github release
|
|
||||||
release_id=$(curl -fsL -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" https://api.github.com/repos/$GITHUB_REPOSITORY/releases | jq -r '.[] | select(.name == "latest") | .id')
|
|
||||||
if [[ -n $release_id ]]; then
|
|
||||||
echo "Deleting release [$api_base_url/releases/$release_id]..."
|
|
||||||
curl -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" -fsSL -X DELETE "$api_base_url/releases/$release_id"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# delete 'latest' git tag
|
|
||||||
tag_url="$api_base_url/git/refs/tags/latest"
|
|
||||||
if curl -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" -fsLo /dev/null --head "$tag_url"; then
|
|
||||||
echo "Deleting tag [$tag_url]..."
|
|
||||||
curl -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" -fsSL -X DELETE "$tag_url"
|
|
||||||
fi
|
|
||||||
|
|
||||||
- name: "Create 'latest' release"
|
- name: "Create 'latest' release"
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
RELEASE_NAME: latest
|
||||||
run: |
|
run: |
|
||||||
set -eux
|
set -eux
|
||||||
|
|
||||||
@@ -256,13 +245,15 @@ jobs:
|
|||||||
mv artifacts-ubuntu-latest/kleinanzeigen-bot kleinanzeigen-bot-linux-amd64
|
mv artifacts-ubuntu-latest/kleinanzeigen-bot kleinanzeigen-bot-linux-amd64
|
||||||
mv artifacts-windows-latest/kleinanzeigen-bot.exe kleinanzeigen-bot-windows-amd64.exe
|
mv artifacts-windows-latest/kleinanzeigen-bot.exe kleinanzeigen-bot-windows-amd64.exe
|
||||||
|
|
||||||
# https://hub.github.com/hub-release.1.html
|
# https://cli.github.com/manual/gh_release_create
|
||||||
hub release create "latest" \
|
gh release create "$RELEASE_NAME" \
|
||||||
|
--latest \
|
||||||
--prerelease \
|
--prerelease \
|
||||||
--message "latest" \
|
--target "${{ github.sha }}" \
|
||||||
--attach "kleinanzeigen-bot-darwin-amd64" \
|
--notes "$RELEASE_NAME" \
|
||||||
--attach "kleinanzeigen-bot-linux-amd64" \
|
kleinanzeigen-bot-darwin-amd64 \
|
||||||
--attach "kleinanzeigen-bot-windows-amd64.exe"
|
kleinanzeigen-bot-linux-amd64 \
|
||||||
|
kleinanzeigen-bot-windows-amd64.exe
|
||||||
|
|
||||||
- name: "Delete intermediate build artifacts"
|
- name: "Delete intermediate build artifacts"
|
||||||
uses: geekyeggo/delete-artifact@v2 # https://github.com/GeekyEggo/delete-artifact/
|
uses: geekyeggo/delete-artifact@v2 # https://github.com/GeekyEggo/delete-artifact/
|
||||||
|
|||||||
2
.github/workflows/codeql-analysis.yml
vendored
2
.github/workflows/codeql-analysis.yml
vendored
@@ -24,7 +24,7 @@ defaults:
|
|||||||
shell: bash
|
shell: bash
|
||||||
|
|
||||||
env:
|
env:
|
||||||
PYTHON_VERSION: "3.11"
|
PYTHON_VERSION: "3.11" # TODO don't upgrade to 3.12 yet, see https://github.com/github/codeql-action/issues/1933
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
analyze:
|
analyze:
|
||||||
|
|||||||
4
.github/workflows/update-python-deps.yml
vendored
4
.github/workflows/update-python-deps.yml
vendored
@@ -16,7 +16,7 @@ defaults:
|
|||||||
shell: bash
|
shell: bash
|
||||||
|
|
||||||
env:
|
env:
|
||||||
PYTHON_VERSION: "3.11"
|
PYTHON_VERSION: "3.12"
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
|
||||||
@@ -68,7 +68,7 @@ jobs:
|
|||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
exec 5>&1
|
exec 5>&1
|
||||||
updates=$(pdm update 2>&1 |tee /dev/fd/5)
|
updates=$(pdm update --update-all 2>&1 |tee /dev/fd/5)
|
||||||
|
|
||||||
if git diff --exit-code pdm.lock; then
|
if git diff --exit-code pdm.lock; then
|
||||||
echo "updates=" >> "$GITHUB_OUTPUT"
|
echo "updates=" >> "$GITHUB_OUTPUT"
|
||||||
|
|||||||
@@ -1,3 +1,7 @@
|
|||||||
|
#syntax=docker/dockerfile:1.4
|
||||||
|
# see https://docs.docker.com/build/dockerfile/frontend/#dockerfile-frontend
|
||||||
|
# see https://github.com/moby/buildkit/blob/master/frontend/dockerfile/docs/reference.md#syntax
|
||||||
|
# see https://docs.docker.com/engine/reference/builder/#syntax
|
||||||
#
|
#
|
||||||
# Copyright (C) 2022 Sebastian Thomschke and contributors
|
# Copyright (C) 2022 Sebastian Thomschke and contributors
|
||||||
# SPDX-License-Identifier: AGPL-3.0-or-later
|
# SPDX-License-Identifier: AGPL-3.0-or-later
|
||||||
@@ -8,45 +12,59 @@
|
|||||||
######################
|
######################
|
||||||
FROM debian:stable-slim as runtime-base-image
|
FROM debian:stable-slim as runtime-base-image
|
||||||
|
|
||||||
LABEL maintainer="Sebastian Thomschke"
|
|
||||||
|
|
||||||
ARG DEBIAN_FRONTEND=noninteractive
|
ARG DEBIAN_FRONTEND=noninteractive
|
||||||
ARG LC_ALL=C
|
ARG LC_ALL=C
|
||||||
|
|
||||||
RUN set -eu \
|
SHELL ["/bin/bash", "-euo", "pipefail", "-c"]
|
||||||
#
|
|
||||||
&& apt-get update -y \
|
RUN <<EOF
|
||||||
&& echo "#################################################" \
|
|
||||||
&& echo "Install Chromium + Driver..." \
|
apt-get update
|
||||||
&& echo "#################################################" \
|
|
||||||
&& apt-get install --no-install-recommends -y chromium chromium-driver \
|
echo "#################################################"
|
||||||
#
|
echo "Install Chromium + Driver..."
|
||||||
&& rm -rf \
|
echo "#################################################"
|
||||||
|
apt-get install --no-install-recommends -y chromium chromium-driver
|
||||||
|
|
||||||
|
apt-get clean autoclean
|
||||||
|
apt-get autoremove --purge -y
|
||||||
|
rm -rf \
|
||||||
/var/cache/{apt,debconf} \
|
/var/cache/{apt,debconf} \
|
||||||
/var/lib/apt/lists/* \
|
/var/lib/apt/lists/* \
|
||||||
/var/log/{apt,alternatives.log,bootstrap.log,dpkg.log} \
|
/var/log/{apt,alternatives.log,bootstrap.log,dpkg.log} \
|
||||||
/tmp/* /var/tmp/*
|
/tmp/* /var/tmp/*
|
||||||
|
|
||||||
|
EOF
|
||||||
|
|
||||||
######################
|
######################
|
||||||
# build image
|
# build image
|
||||||
######################
|
######################
|
||||||
|
|
||||||
# https://hub.docker.com/_/python?tab=tags&name=3-slim
|
# https://hub.docker.com/_/python/tags?name=3-slim
|
||||||
FROM python:3-slim AS build-image
|
FROM python:3.12-slim AS build-image
|
||||||
|
|
||||||
RUN apt-get update \
|
ARG DEBIAN_FRONTEND=noninteractive
|
||||||
# install required libraries
|
ARG LC_ALL=C
|
||||||
&& apt-get install --no-install-recommends -y \
|
|
||||||
|
SHELL ["/bin/bash", "-euo", "pipefail", "-c"]
|
||||||
|
|
||||||
|
RUN <<EOF
|
||||||
|
|
||||||
|
apt-get update
|
||||||
|
|
||||||
|
# install required libraries
|
||||||
|
apt-get install --no-install-recommends -y \
|
||||||
binutils `# required by pyinstaller` \
|
binutils `# required by pyinstaller` \
|
||||||
build-essential `# required by transitive dependency "wrapt"` \
|
build-essential `# required by transitive dependency "wrapt"` \
|
||||||
git `# required by pdm to generate app version` \
|
git `# required by pdm to generate app version` \
|
||||||
#
|
|
||||||
# upgrade pip
|
# upgrade pip
|
||||||
&& python -m pip install --upgrade pip \
|
python -m pip install --upgrade pip \
|
||||||
#
|
|
||||||
# install pdm
|
# install pdm
|
||||||
&& pip install pdm
|
pip install pdm
|
||||||
|
|
||||||
|
EOF
|
||||||
|
|
||||||
ENV PATH="/opt/upx:${PATH}"
|
ENV PATH="/opt/upx:${PATH}"
|
||||||
|
|
||||||
@@ -54,12 +72,16 @@ COPY kleinanzeigen_bot /opt/app/kleinanzeigen_bot
|
|||||||
COPY .git /opt/app/.git
|
COPY .git /opt/app/.git
|
||||||
COPY README.md pdm.lock pyinstaller.spec pyproject.toml /opt/app/
|
COPY README.md pdm.lock pyinstaller.spec pyproject.toml /opt/app/
|
||||||
|
|
||||||
RUN cd /opt/app \
|
RUN <<EOF
|
||||||
&& ls -la . \
|
|
||||||
&& pdm install -v \
|
cd /opt/app
|
||||||
&& ls -la kleinanzeigen_bot \
|
ls -la .
|
||||||
&& pdm run compile \
|
pdm install -v
|
||||||
&& ls -l dist
|
ls -la kleinanzeigen_bot
|
||||||
|
pdm run compile
|
||||||
|
ls -l dist
|
||||||
|
|
||||||
|
EOF
|
||||||
|
|
||||||
RUN /opt/app/dist/kleinanzeigen-bot --help
|
RUN /opt/app/dist/kleinanzeigen-bot --help
|
||||||
|
|
||||||
@@ -76,10 +98,16 @@ ARG GIT_COMMIT_DATE
|
|||||||
ARG GIT_REPO_URL
|
ARG GIT_REPO_URL
|
||||||
|
|
||||||
LABEL \
|
LABEL \
|
||||||
|
maintainer="Sebastian Thomschke" \
|
||||||
org.label-schema.schema-version="1.0" \
|
org.label-schema.schema-version="1.0" \
|
||||||
org.label-schema.build-date=$BUILD_DATE \
|
org.label-schema.build-date=$BUILD_DATE \
|
||||||
org.label-schema.vcs-ref=$GIT_COMMIT_HASH \
|
org.label-schema.vcs-ref=$GIT_COMMIT_HASH \
|
||||||
org.label-schema.vcs-url=$GIT_REPO_URL
|
org.label-schema.vcs-url=$GIT_REPO_URL \
|
||||||
|
org.opencontainers.image.authors="Sebastian Thomschke" \
|
||||||
|
org.opencontainers.image.vendor="Sebastian Thomschke" \
|
||||||
|
org.opencontainers.image.licenses="AGPL-3.0" \
|
||||||
|
org.opencontainers.image.title="kleinanzeigen-bot" \
|
||||||
|
org.opencontainers.image.description="CLI application to ease publishing of ads to kleinanzeigen.de"
|
||||||
|
|
||||||
# https://stackoverflow.com/a/59812588/5116073
|
# https://stackoverflow.com/a/59812588/5116073
|
||||||
ENV PYTHONUNBUFFERED=1
|
ENV PYTHONUNBUFFERED=1
|
||||||
|
|||||||
@@ -41,44 +41,52 @@ from sys import platform
|
|||||||
if platform != "darwin":
|
if platform != "darwin":
|
||||||
excluded_modules.append("_osx_support")
|
excluded_modules.append("_osx_support")
|
||||||
|
|
||||||
block_cipher = None
|
# https://github.com/pyinstaller/pyinstaller/blob/e7c252573f424ad9b79169ab01229d27599004b1/PyInstaller/building/build_main.py#L318
|
||||||
|
|
||||||
analysis = Analysis(
|
analysis = Analysis(
|
||||||
['kleinanzeigen_bot/__main__.py'],
|
['kleinanzeigen_bot/__main__.py'],
|
||||||
pathex = [],
|
# pathex = [],
|
||||||
binaries = [],
|
# binaries = [],
|
||||||
datas = datas,
|
datas = datas,
|
||||||
hiddenimports = ['pkg_resources'],
|
hiddenimports = ['pkg_resources'],
|
||||||
hookspath = [],
|
# hookspath = [],
|
||||||
hooksconfig = {},
|
# hooksconfig = {},
|
||||||
runtime_hooks = [],
|
|
||||||
excludes = excluded_modules,
|
excludes = excluded_modules,
|
||||||
win_no_prefer_redirects = False,
|
# runtime_hooks = [],
|
||||||
win_private_assemblies = False,
|
# noarchive = False,
|
||||||
cipher = block_cipher,
|
# module_collection_mode = None
|
||||||
noarchive = False
|
|
||||||
)
|
)
|
||||||
|
|
||||||
pyz = PYZ(analysis.pure, analysis.zipped_data, cipher = block_cipher)
|
# https://github.com/pyinstaller/pyinstaller/blob/e7c252573f424ad9b79169ab01229d27599004b1/PyInstaller/building/api.py#L51
|
||||||
|
pyz = PYZ(
|
||||||
|
analysis.pure, # tocs
|
||||||
|
analysis.zipped_data,
|
||||||
|
# name = None
|
||||||
|
)
|
||||||
|
|
||||||
import shutil
|
import shutil
|
||||||
|
|
||||||
|
# https://github.com/pyinstaller/pyinstaller/blob/e7c252573f424ad9b79169ab01229d27599004b1/PyInstaller/building/api.py#L338
|
||||||
exe = EXE(pyz,
|
exe = EXE(pyz,
|
||||||
analysis.scripts,
|
analysis.scripts,
|
||||||
analysis.binaries,
|
analysis.binaries,
|
||||||
analysis.zipfiles,
|
|
||||||
analysis.datas,
|
analysis.datas,
|
||||||
[],
|
# bootloader_ignore_signals = False,
|
||||||
|
# console = True,
|
||||||
|
# disable_windowed_traceback = False,
|
||||||
|
# debug = False,
|
||||||
name = 'kleinanzeigen-bot',
|
name = 'kleinanzeigen-bot',
|
||||||
debug = False,
|
# exclude_binaries = False,
|
||||||
bootloader_ignore_signals = False,
|
# icon = None,
|
||||||
|
# version = None,
|
||||||
|
# uac_admin = False,
|
||||||
|
# uac_uiaccess = False,
|
||||||
|
# argv_emulation = None,
|
||||||
|
# target_arch = None,
|
||||||
|
# codesign_identity = None,
|
||||||
|
# entitlements_file = None,
|
||||||
|
# contents_directory = "_internal",
|
||||||
strip = shutil.which("strip") is not None,
|
strip = shutil.which("strip") is not None,
|
||||||
upx = shutil.which("upx") is not None,
|
upx = shutil.which("upx") is not None,
|
||||||
upx_exclude = [],
|
upx_exclude = [],
|
||||||
runtime_tmpdir = None,
|
runtime_tmpdir = None,
|
||||||
console = True,
|
|
||||||
disable_windowed_traceback = False,
|
|
||||||
target_arch = None,
|
|
||||||
codesign_identity = None,
|
|
||||||
entitlements_file = None
|
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -24,14 +24,14 @@ classifiers = [ # https://pypi.org/classifiers/
|
|||||||
"License :: OSI Approved :: GNU Affero General Public License v3 or later (AGPLv3+)",
|
"License :: OSI Approved :: GNU Affero General Public License v3 or later (AGPLv3+)",
|
||||||
"Programming Language :: Python :: 3.10"
|
"Programming Language :: Python :: 3.10"
|
||||||
]
|
]
|
||||||
requires-python = ">=3.10,<3.12" # <3.12 required for pyinstaller
|
requires-python = ">=3.10,<3.13" # <3.12 required for pyinstaller
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"coloredlogs~=15.0",
|
"coloredlogs~=15.0",
|
||||||
"inflect~=7.0",
|
"inflect~=7.0",
|
||||||
"overrides~=7.4",
|
"overrides~=7.4",
|
||||||
"ruamel.yaml~=0.17",
|
"ruamel.yaml~=0.17",
|
||||||
"pywin32==303; sys_platform == 'win32'",
|
"pywin32==306; sys_platform == 'win32'",
|
||||||
"selenium~=4.12",
|
"selenium~=4.13",
|
||||||
"selenium_stealth~=1.0",
|
"selenium_stealth~=1.0",
|
||||||
"wcmatch~=8.5",
|
"wcmatch~=8.5",
|
||||||
"webdriver_manager~=4.0"
|
"webdriver_manager~=4.0"
|
||||||
@@ -56,12 +56,12 @@ dev = [
|
|||||||
"bandit~=1.7",
|
"bandit~=1.7",
|
||||||
"toml", # required by bandit
|
"toml", # required by bandit
|
||||||
"tomli", # required by bandit
|
"tomli", # required by bandit
|
||||||
"pydantic~=1.10", # inflect depends on pydantic > 1.9 which results in pydantic 2 being loaded, which however is not compatible with pyinstaller, so pinning to 1.x
|
"pydantic~=2.4",
|
||||||
"pytest~=7.4",
|
"pytest~=7.4",
|
||||||
"pyinstaller~=5.13",
|
"pyinstaller~=6.0",
|
||||||
"psutil",
|
"psutil",
|
||||||
"pylint~=2.17",
|
"pylint~=3.0",
|
||||||
"mypy~=1.5.1",
|
"mypy~=1.5",
|
||||||
]
|
]
|
||||||
|
|
||||||
[tool.pdm.scripts]
|
[tool.pdm.scripts]
|
||||||
|
|||||||
Reference in New Issue
Block a user