mirror of
https://github.com/Second-Hand-Friends/kleinanzeigen-bot.git
synced 2026-03-12 02:31:45 +01:00
use more predictable version numbers
This commit is contained in:
@@ -71,7 +71,7 @@ ENV PATH="/opt/upx:${PATH}"
|
|||||||
|
|
||||||
COPY kleinanzeigen_bot /opt/app/kleinanzeigen_bot
|
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 version.py /opt/app/
|
||||||
|
|
||||||
RUN <<EOF
|
RUN <<EOF
|
||||||
|
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ class KleinanzeigenBot(SeleniumMixin):
|
|||||||
self.webdriver = None
|
self.webdriver = None
|
||||||
|
|
||||||
def get_version(self) -> str:
|
def get_version(self) -> str:
|
||||||
return importlib.metadata.version(__package__)
|
return importlib.metadata.version(__package__).removesuffix(".editable")
|
||||||
|
|
||||||
def run(self, args:list[str]) -> None:
|
def run(self, args:list[str]) -> None:
|
||||||
self.parse_args(args)
|
self.parse_args(args)
|
||||||
|
|||||||
@@ -5,9 +5,9 @@
|
|||||||
# SPDX-ArtifactOfProjectHomePage: https://github.com/Second-Hand-Friends/kleinanzeigen-bot/
|
# SPDX-ArtifactOfProjectHomePage: https://github.com/Second-Hand-Friends/kleinanzeigen-bot/
|
||||||
#
|
#
|
||||||
|
|
||||||
[build-system]
|
[build-system] # https://backend.pdm-project.org/
|
||||||
requires = ["pdm-pep517"]
|
requires = ["pdm-backend"]
|
||||||
build-backend = "pdm.pep517.api"
|
build-backend = "pdm.backend"
|
||||||
|
|
||||||
[project]
|
[project]
|
||||||
name = "kleinanzeigen-bot"
|
name = "kleinanzeigen-bot"
|
||||||
@@ -52,8 +52,9 @@ Issues = "https://github.com/Second-Hand-Friends/kleinanzeigen-bot/issues"
|
|||||||
#####################
|
#####################
|
||||||
# pdm https://github.com/pdm-project/pdm/
|
# pdm https://github.com/pdm-project/pdm/
|
||||||
#####################
|
#####################
|
||||||
[tool.pdm]
|
[tool.pdm.version] # https://backend.pdm-project.org/metadata/#dynamic-project-version
|
||||||
version = {use_scm = true}
|
source = "call"
|
||||||
|
getter = "version:get_version"
|
||||||
|
|
||||||
[tool.pdm.dev-dependencies]
|
[tool.pdm.dev-dependencies]
|
||||||
dev = [
|
dev = [
|
||||||
|
|||||||
13
version.py
Normal file
13
version.py
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
"""
|
||||||
|
SPDX-FileCopyrightText: © Sebastian Thomschke and contributors
|
||||||
|
SPDX-License-Identifier: AGPL-3.0-or-later
|
||||||
|
SPDX-ArtifactOfProjectHomePage: https://github.com/Second-Hand-Friends/kleinanzeigen-bot/
|
||||||
|
"""
|
||||||
|
from datetime import datetime
|
||||||
|
import subprocess
|
||||||
|
|
||||||
|
|
||||||
|
# used in pyproject.toml [tool.pdm.version]
|
||||||
|
def get_version() -> str:
|
||||||
|
commit_hash = subprocess.check_output(['git', 'rev-parse', '--short', 'HEAD']).decode().strip()
|
||||||
|
return f"{datetime.now().year}+{commit_hash}"
|
||||||
Reference in New Issue
Block a user