Modernize buildsystem (#199)

* flake.lock: Update

Flake lock file updates:

• Updated input 'flake-parts':
    'github:hercules-ci/flake-parts/59cf3f1447cfc75087e7273b04b31e689a8599fb' (2023-08-01)
  → 'github:hercules-ci/flake-parts/7f53fdb7bdc5bb237da7fefef12d099e4fd611ca' (2023-09-01)
• Updated input 'nixpkgs':
    'github:NixOS/nixpkgs/cf73a86c35a84de0e2f3ba494327cf6fb51c0dfd' (2023-08-10)
  → 'github:NixOS/nixpkgs/517501bcf14ae6ec47efd6a17dda0ca8e6d866f9' (2023-09-27)
• Updated input 'treefmt-nix':
    'github:numtide/treefmt-nix/19dee4bf6001849006a63f3435247316b0488e99' (2023-08-12)
  → 'github:numtide/treefmt-nix/720bd006d855b08e60664e4683ccddb7a9ff614a' (2023-09-27)

* nix-update: convert to pyproject

* drop old pkgs.nixVersions.stable fallback

* add create-release.sh script
This commit is contained in:
Jörg Thalheim 2023-09-30 10:04:21 +01:00 committed by GitHub
parent e7208a47b5
commit 2732363f42
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 76 additions and 58 deletions

38
bin/create-release.sh Executable file
View File

@ -0,0 +1,38 @@
#!/usr/bin/env bash
set -eu -o pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null && pwd)"
cd "$SCRIPT_DIR/.."
version=${1:-}
if [[ -z "$version" ]]; then
echo "USAGE: $0 version" >&2
exit 1
fi
if [[ "$(git symbolic-ref --short HEAD)" != "master" ]]; then
echo "must be on master branch" >&2
exit 1
fi
# ensure we are up-to-date
uncommitted_changes=$(git diff --compact-summary)
if [[ -n "$uncommitted_changes" ]]; then
echo -e "There are uncommitted changes, exiting:\n${uncommitted_changes}" >&2
exit 1
fi
git pull git@github.com:Mic92/nix-update master
unpushed_commits=$(git log --format=oneline origin/master..master)
if [[ "$unpushed_commits" != "" ]]; then
echo -e "\nThere are unpushed changes, exiting:\n$unpushed_commits" >&2
exit 1
fi
sed -i -e "s!^version = \".*\"\$!version = \"${version}\"!" pyproject.toml default.nix
git add pyproject.toml default.nix
nix flake check -vL
nix develop -c pytest -s .
git commit -m "bump version ${version}"
git tag -e "${version}"
echo "now run 'git push --tags origin master'"

View File

@ -3,13 +3,16 @@
pkgs.python311.pkgs.buildPythonApplication { pkgs.python311.pkgs.buildPythonApplication {
name = "nix-update"; pname = "nix-update";
version = "0.19.3";
src = ./.; src = ./.;
format = "pyproject";
buildInputs = [ pkgs.makeWrapper ]; buildInputs = [ pkgs.makeWrapper ];
nativeBuildInputs = [ pkgs.python311.pkgs.setuptools ];
nativeCheckInputs = [ nativeCheckInputs = [
pkgs.python311.pkgs.pytest pkgs.python311.pkgs.pytest
# technically not test inputs, but we need it for development in PATH # technically not test inputs, but we need it for development in PATH
pkgs.nixVersions.stable or pkgs.nix_2_4 pkgs.nixVersions.stable
pkgs.nix-prefetch-git pkgs.nix-prefetch-git
]; ];
checkPhase = '' checkPhase = ''

View File

@ -7,11 +7,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1690933134, "lastModified": 1693611461,
"narHash": "sha256-ab989mN63fQZBFrkk4Q8bYxQCktuHmBIBqUG1jl6/FQ=", "narHash": "sha256-aPODl8vAgGQ0ZYFIRisxYG5MOGSkIczvu2Cd8Gb9+1Y=",
"owner": "hercules-ci", "owner": "hercules-ci",
"repo": "flake-parts", "repo": "flake-parts",
"rev": "59cf3f1447cfc75087e7273b04b31e689a8599fb", "rev": "7f53fdb7bdc5bb237da7fefef12d099e4fd611ca",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -22,11 +22,11 @@
}, },
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1691709280, "lastModified": 1695837737,
"narHash": "sha256-zmfH2OlZEXwv572d0g8f6M5Ac6RiO8TxymOpY3uuqrM=", "narHash": "sha256-KcqmJ5hNacLuE7fkz5586kp/vt4NLo6+Prq3DMgrxpQ=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "cf73a86c35a84de0e2f3ba494327cf6fb51c0dfd", "rev": "517501bcf14ae6ec47efd6a17dda0ca8e6d866f9",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -50,11 +50,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1691833704, "lastModified": 1695822946,
"narHash": "sha256-ASGhgGduEgcD3gQZhGr8xtmZ3PlVY+m2HuPnIZDbu78=", "narHash": "sha256-IQU3fYo0H+oGlqX5YrgZU3VRhbt2Oqe6KmslQKUO4II=",
"owner": "numtide", "owner": "numtide",
"repo": "treefmt-nix", "repo": "treefmt-nix",
"rev": "19dee4bf6001849006a63f3435247316b0488e99", "rev": "720bd006d855b08e60664e4683ccddb7a9ff614a",
"type": "github" "type": "github"
}, },
"original": { "original": {

View File

@ -1,3 +1,26 @@
[build-system]
requires = ["setuptools"]
build-backend = "setuptools.build_meta"
[project]
name = "nix-update"
description = "Swiss-knife for updating nix packages"
version = "0.19.3"
authors = [{ name = "Jörg Thalheim", email = "joerg@thalheim.io" }]
license = { text = "MIT" }
classifiers = [
"Development Status :: 5 - Production/Stable",
"Environment :: Console",
"Topic :: Utilities",
"Intended Audience :: Developers",
]
[project.urls]
Homepage = "https://github.com/Mic92/nix-update"
[project.scripts]
nix-update = "nix_update:main"
[tool.ruff] [tool.ruff]
target-version = "py311" target-version = "py311"
line-length = 88 line-length = 88
@ -7,6 +30,7 @@ ignore = [ "E501" ]
[tool.mypy] [tool.mypy]
python_version = "3.11" python_version = "3.11"
pretty = true
warn_redundant_casts = true warn_redundant_casts = true
disallow_untyped_calls = true disallow_untyped_calls = true
disallow_untyped_defs = true disallow_untyped_defs = true

View File

@ -1,42 +0,0 @@
[metadata]
name = nix-update
version = 0.0.0
author = Jörg Thalheim
author-email = joerg@thalheim.io
home-page = https://github.com/Mic92/nix-update
description = Update Nix packages like it is 2020
long-description = file: README.rst
license = MIT
license-file = LICENSE.rst
platform = any
classifiers =
Development Status :: 5 - Production/Stable
Environment :: Console
Topic :: Utilities
License :: OSI Approved :: MIT License
Operating System :: OS Independent
Programming Language :: Python
Programming Language :: Python :: 3.6
Programming Language :: Python :: 3.7
Programming Language :: Python :: 3.8
[options]
zip_safe = true
include_package_data = true
python_requires = >= 3.6
packages = find:
setup_requires =
setuptools
[options.entry_points]
console_scripts =
nix-update = nix_update:main
[bdist_wheel]
universal = true
[check]
metadata = true
restructuredtext = true
strict = true[wheel]
universal = 1

View File

@ -1,5 +0,0 @@
#!/usr/bin/env python
from setuptools import setup
setup()