Skip to content

Commit

Permalink
clean up version number handling
Browse files Browse the repository at this point in the history
See #58
  • Loading branch information
Johann Bahl committed Oct 25, 2023
1 parent 996550a commit ce9c9d3
Show file tree
Hide file tree
Showing 9 changed files with 658 additions and 29 deletions.
12 changes: 3 additions & 9 deletions CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,10 @@ See the fragment files in the `changelog.d` directory.

.. scriv-insert-here
.. _changelog-2.5.0dev:
.. _changelog-2.5.0:

2.6 (unreleased)
================

- Nothing changed yet.


2.5.0dev (2023-10-11)
=====================
2.5.0 (2023-10-11)
==================

- Separate pool into fast and slow. According to our statistics 90% of jobs are
faster than 10 minutes and after that they might run for hours. We now run
Expand Down
9 changes: 3 additions & 6 deletions doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# All configuration values have a default; values that are commented out
# serve to show the default.

import os
import importlib.metadata

# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
Expand Down Expand Up @@ -50,10 +50,7 @@
# built documents.
#
# The short X.Y version.
with open(os.path.join(os.path.dirname(__file__), "..", "version.txt")) as v:
version = v.readline().strip()
# The full version, including alpha/beta/rc tags.
release = version
release = importlib.metadata.version("backy")

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand Down Expand Up @@ -113,7 +110,7 @@

# The name for this set of Sphinx documents. If None, it defaults to
# "<project> v<release> documentation".
html_title = "{} {}".format(project, version)
html_title = "{} {}".format(project, release)

# A shorter title for the navigation bar. Default is the same as html_title.
# html_short_title = None
Expand Down
38 changes: 33 additions & 5 deletions lib.nix
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
{
lib,
stdenv,
poetry2nix,
lzo,
python310,
mkShellNoCC,
poetry,
runCommand,
libiconv,
darwin,
rustPlatform,
...
}:
let
Expand Down Expand Up @@ -37,6 +42,29 @@ let
# replace poetry to avoid dependency on vulnerable python-cryptography package
nativeBuildInputs = [ super.poetry-core ] ++ builtins.filter (p: p.pname or "" != "poetry") old.nativeBuildInputs;
});
nh3 =
let
getCargoHash = version: {
"0.2.14" = "sha256-EzlwSic1Qgs4NZAde/KWg0Qjs+PNEPcnE8HyIPoYZQ0=";
}.${version} or (
lib.warn "Unknown nh3 version: '${version}'. Please update getCargoHash." lib.fakeHash
);
in
super.nh3.overridePythonAttrs (old: {
cargoDeps = rustPlatform.fetchCargoTarball {
inherit (old) src;
name = "${old.pname}-${old.version}";
hash = getCargoHash old.version;
};
nativeBuildInputs = (old.nativeBuildInputs or [ ]) ++ [
rustPlatform.cargoSetupHook
rustPlatform.maturinBuildHook
];
buildInputs = (old.buildInputs or [ ]) ++ lib.optional stdenv.isDarwin [
libiconv
darwin.apple_sdk.frameworks.Security
];
});
})
];
poetryEnv = poetry2nix.mkPoetryEnv {
Expand All @@ -48,11 +76,11 @@ let
};
};
poetryApplication = poetry2nix.mkPoetryApplication {
projectDir = ./.;
doCheck = true;
python = python310;
overrides = poetryOverrides;
};
projectDir = ./.;
doCheck = true;
python = python310;
overrides = poetryOverrides;
};
in
{
packages = {
Expand Down
590 changes: 589 additions & 1 deletion poetry.lock

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ categories = ""

[tool.poetry]
name = "backy"
version = "2.5.0dev"
version = "2.6.0.dev0"
description = ""
authors = [
"Christian Theune <ct@flyingcircus.io>",
Expand Down Expand Up @@ -64,6 +64,7 @@ pytest-cov = "^4.1.0"
pytest-flake8 = "^1.1.1"
pytest-timeout = "^2.1.0"
scriv = "^1.3.1"
zest-releaser = "^9.1.1"

[build-system]
requires = ["poetry-core>=1.0.0"]
Expand Down
21 changes: 21 additions & 0 deletions release_helper.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import subprocess


def update_poetry_version(context):
subprocess.check_call(
[
"poetry",
"version",
context.get("dev_version", context["new_version"]),
]
)


def ignore_history_file(context):
context["update_history"] = False


def scriv_collect(context):
subprocess.check_call(
["scriv", "collect", "--version", context["new_version"]]
)
6 changes: 6 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,9 @@ BLANK_LINE_BEFORE_NESTED_CLASS_OR_DEF = true
[flake8]
max-line-length = 80
extend-ignore = E203

[zest.releaser]
prereleaser.before = release_helper.ignore_history_file
prereleaser.middle = release_helper.update_poetry_version release_helper.scriv_collect
postreleaser.before = release_helper.ignore_history_file
postreleaser.middle = release_helper.update_poetry_version
7 changes: 1 addition & 6 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,9 @@ def long_desc():
return "\n".join(parts)


def version():
with open_project_path("version.txt") as f:
return f.read().strip()


setup(
name="backy",
version=version(),
version="2.6.0.dev0",
install_requires=[
"consulate",
"packaging",
Expand Down
1 change: 0 additions & 1 deletion version.txt

This file was deleted.

0 comments on commit ce9c9d3

Please sign in to comment.