]> git.ipfire.org Git - thirdparty/mkosi.git/commitdiff
Remove setup.py and use setuptools build backend in pyproject.toml
authorJoerg Behrmann <behrmann@physik.fu-berlin.de>
Fri, 30 Jun 2023 12:30:36 +0000 (14:30 +0200)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Tue, 8 Aug 2023 10:09:07 +0000 (12:09 +0200)
Also remove setup.cfg, since we don't use flake8 and everything else can be
handled by pyproject.toml

.github/workflows/ci.yml
README [deleted symlink]
action.yaml
pyproject.toml
setup.cfg [deleted file]
setup.py [deleted file]

index 5381279b414992dc62ec309b3265869ca2587bcb..426ef6f9505d5ab4c88bc78b338f66d8241a7faa 100644 (file)
@@ -21,6 +21,7 @@ jobs:
       run: |
         sudo apt-get update
         sudo apt-get install pandoc
+        python3 -m pip install --upgrade setuptools wheel pip
         python3 -m pip install pytest mypy types-cryptography isort pyflakes
         npm install -g pyright
 
@@ -48,33 +49,21 @@ jobs:
     - name: Test execution from current working directory (sudo call)
       run: sudo python3 -m mkosi -h
 
-    - name: Test user installation
-      run: |
-        python3 -m pip install --user .
-        $HOME/.local/bin/mkosi -h
-        python3 -m pip uninstall --yes mkosi
-
-    - name: Test editable user installation
-      run: |
-        python3 -m pip install --user --no-use-pep517 --editable .
-        $HOME/.local/bin/mkosi -h
-        python3 -m pip uninstall --yes mkosi
-
     - name: Test venv installation
       run: |
         python3 -m venv testvenv
+        testvenv/bin/python3 -m pip install --upgrade setuptools wheel pip
         testvenv/bin/python3 -m pip install .
         testvenv/bin/mkosi -h
+        rm -rf testenv
 
-    - name: Test venv installation (sudo call)
+    - name: Test editable venv installation
       run: |
-        sudo testvenv/bin/mkosi -h
-
-    - name: Test system installation
-      run: |
-        sudo python3 -m pip install .
-        sudo mkosi -h
-        sudo python3 -m pip uninstall --yes mkosi
+        python3 -m venv testvenv
+        testvenv/bin/python3 -m pip install --upgrade setuptools wheel pip
+        testvenv/bin/python3 -m pip install --editable .
+        testvenv/bin/mkosi -h
+        rm -rf testenv
 
     - name: Test zipapp creation
       run: |
@@ -118,12 +107,10 @@ jobs:
     - uses: actions/checkout@v3
     - uses: ./
 
-    - name: Install dependencies
-      run: sudo apt-get update && sudo apt-get install --no-install-recommends python3-pexpect python3-pytest
-
-    # Do a manual install so we have the latest changes from the pull request available.
+    # Make sure the latest changes from the pull request are used.
     - name: Install
-      run: sudo python3 -m pip install ..
+      run: sudo ln -svf $PWD/bin/mkosi /usr/bin/mkosi
+      working-directory: ./
 
     - name: Configure ${{ matrix.distro }}/${{ matrix.format }}
       run: |
@@ -136,7 +123,7 @@ jobs:
         EOF
 
     - name: Build ${{ matrix.distro }}/${{ matrix.format }}
-      run: python3 -m mkosi --debug build
+      run: mkosi --debug build
 
     # systemd-resolved is enabled by default in Arch/Debian/Ubuntu (systemd default preset) but fails to
     # start in a systemd-nspawn container with --private-users so we mask it out here to avoid CI failures.
@@ -147,8 +134,8 @@ jobs:
 
     - name: Boot ${{ matrix.distro }}/${{ matrix.format }} systemd-nspawn
       if: matrix.format == 'disk' || matrix.format == 'directory'
-      run: sudo python3 -m mkosi --debug boot
+      run: sudo mkosi --debug boot
 
     - name: Boot ${{ matrix.distro }}/${{ matrix.format }} UEFI
       if: matrix.format == 'disk'
-      run: timeout -k 30 10m python3 -m mkosi --debug qemu
+      run: timeout -k 30 10m mkosi --debug qemu
diff --git a/README b/README
deleted file mode 120000 (symlink)
index 42061c0..0000000
--- a/README
+++ /dev/null
@@ -1 +0,0 @@
-README.md
\ No newline at end of file
index 3b0395018e81933a64c8d8f04dce15020eab4ffd..2528693283d65a7819c7d223d0f5922afd108329 100644 (file)
@@ -92,4 +92,4 @@ runs:
 
   - name: Install
     shell: bash
-    run: sudo python3 -m pip install ${{ github.action_path }}
+    run: sudo ln -svf ${{ github.action_path }}/bin/mkosi /usr/bin/mkosi
index 5c4beea08628f471e3f81e54381c471f615aa499..4530d8387a20a4aaa488db2da0a0ba7ac2e51fe3 100644 (file)
@@ -1,5 +1,30 @@
+[build-system]
+requires = ["setuptools", "setuptools-scm"]
+build-backend = "setuptools.build_meta"
+
+[project]
+name = "mkosi"
+authors = [
+    {name = "mkosi contributors", email = "systemd-devel@lists.freedesktop.org"},
+]
+version = "14"
+description = "Build Bespoke OS Images"
+readme = "README.md"
+requires-python = ">=3.9"
+license = {file = "LICENSE"}
+
+[project.scripts]
+mkosi = "mkosi.__main__:main"
+
+[tool.setuptools]
+packages = ["mkosi"]
+
+[tool.setuptools.package-data]
+"*" = ["*.sh", "*.hook", "*.conf", "*.install"]
+
 [tool.isort]
 profile = "black"
+include_trailing_comma = true
 multi_line_output = 3
 py_version = "39"
 
@@ -8,3 +33,31 @@ pythonVersion = "3.9"
 
 [tool.pytest.ini_options]
 asyncio_mode = "auto"
+
+[tool.mypy]
+python_version = 3.9
+# belonging to --strict
+warn_unused_configs = true
+disallow_any_generics = true
+disallow_subclassing_any = true
+disallow_untyped_calls = true
+disallow_untyped_defs = true
+disallow_untyped_decorators = true
+disallow_incomplete_defs = true
+check_untyped_defs = true
+no_implicit_optional = true
+warn_redundant_casts = true
+warn_unused_ignores = false
+warn_return_any = true
+no_implicit_reexport = true
+# extra options not in --strict
+pretty = true
+show_error_codes = true
+show_column_numbers = true
+warn_unreachable = true
+allow_redefinition = true
+strict_equality = true
+
+[[tool.mypy.overrides]]
+module = ["argcomplete"]
+ignore_missing_imports = true
diff --git a/setup.cfg b/setup.cfg
deleted file mode 100644 (file)
index 93e00d7..0000000
--- a/setup.cfg
+++ /dev/null
@@ -1,30 +0,0 @@
-[flake8]
-max-line-length = 119
-[isort]
-multi_line_output = 3
-include_trailing_comma = True
-[mypy]
-python_version = 3.9
-# belonging to --strict
-warn_unused_configs = True
-disallow_any_generics = True
-disallow_subclassing_any = True
-disallow_untyped_calls = True
-disallow_untyped_defs = True
-disallow_untyped_decorators = True
-disallow_incomplete_defs = True
-check_untyped_defs = True
-no_implicit_optional = True
-warn_redundant_casts = True
-warn_unused_ignores = False
-warn_return_any = True
-no_implicit_reexport = True
-# extra options not in --strict
-pretty = True
-show_error_codes = True
-show_column_numbers = True
-warn_unreachable = True
-allow_redefinition = True
-strict_equality = True
-[mypy-argcomplete]
-ignore_missing_imports = True
diff --git a/setup.py b/setup.py
deleted file mode 100755 (executable)
index a455d28..0000000
--- a/setup.py
+++ /dev/null
@@ -1,29 +0,0 @@
-#!/usr/bin/python3
-# SPDX-License-Identifier: LGPL-2.1+
-
-from setuptools import setup, find_packages
-from setuptools.command.install import install
-
-
-class InstallCommand(install):
-    def run(self):
-        self.spawn(['pandoc', '-t', 'man', '-s', '-o', 'mkosi.1', 'mkosi.md'])
-        install.run(self)
-
-
-setup(
-    name="mkosi",
-    version="14",
-    description="Build Bespoke OS Images",
-    url="https://github.com/systemd/mkosi",
-    maintainer="mkosi contributors",
-    maintainer_email="systemd-devel@lists.freedesktop.org",
-    license="LGPLv2+",
-    python_requires=">=3.9",
-    packages = find_packages(".", exclude=["tests"]),
-    package_data = {"": ["*.sh", "*.hook", "*.conf", "*.install"]},
-    include_package_data = True,
-    entry_points = { "console_scripts": ["mkosi = mkosi.__main__:main"] },
-    cmdclass = { "install": InstallCommand },
-    data_files = [('share/man/man1', ["mkosi.1"])],
-)