diff --git a/.fmf/version b/.fmf/version new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/.fmf/version @@ -0,0 +1 @@ +1 diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml new file mode 100644 index 0000000..3ec8054 --- /dev/null +++ b/.github/workflows/codeql.yml @@ -0,0 +1,39 @@ +name: "CodeQL" + +on: + push: + branches: [ "master" ] + pull_request: + branches: [ "master" ] + +jobs: + analyze: + name: Analyze + runs-on: ubuntu-latest + permissions: + actions: read + contents: read + security-events: write + + strategy: + fail-fast: false + matrix: + language: [ 'python' ] + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Initialize CodeQL + uses: github/codeql-action/init@v3 + with: + languages: ${{ matrix.language }} + queries: security-and-quality + + - name: Autobuild + uses: github/codeql-action/autobuild@v3 + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v3 + with: + category: "/language:${{matrix.language}}" diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml deleted file mode 100644 index 7f579af..0000000 --- a/.github/workflows/pre-commit.yml +++ /dev/null @@ -1,14 +0,0 @@ -name: pre-commit - -on: - pull_request: - push: - branches: [master] - -jobs: - pre-commit: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-python@v5 - - uses: pre-commit/action@v3.0.1 diff --git a/.packit.yaml b/.packit.yaml new file mode 100644 index 0000000..e0050a6 --- /dev/null +++ b/.packit.yaml @@ -0,0 +1,44 @@ +--- +# Basic configuration for Packit +# See documentation: https://packit.dev/docs/configuration/ + +specfile_path: python-configshell-fb.spec + +upstream_package_name: configshell-fb +# In Fedora, Python packages are prefixed with 'python-' +downstream_package_name: python3-configshell + +# Use hatch to create the source archive +actions: + create-archive: + - hatch build -t sdist + - bash -c "ls -1t ./dist/*.tar.gz | head -n 1" + +srpm_build_deps: + - python3-devel + - python3-pip + - hatch + - python3-hatchling + - python3-hatch-vcs + +jobs: + # Test PRs in COPR + - job: copr_build + trigger: pull_request + targets: + - fedora-latest-stable + - epel-9 + + # Run tests + - job: tests + trigger: pull_request + targets: + - fedora-latest-stable + - epel-9 + + # Sync with Fedora when a new release is created + - job: propose_downstream + trigger: release + dist_git_branches: + - fedora-all + - epel-9 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index a0e101f..aa4dea2 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,6 +1,6 @@ repos: - repo: https://github.com/charliermarsh/ruff-pre-commit - rev: v0.7.1 + rev: v0.11.11 hooks: - id: ruff args: [--fix] @@ -11,13 +11,21 @@ repos: - id: check-case-conflict - id: check-ast - id: check-docstring-first - - id: check-case-conflict - id: check-merge-conflict - id: check-builtin-literals - - id: check-docstring-first - - id: check-merge-conflict - id: check-toml - id: debug-statements - id: end-of-file-fixer - id: trailing-whitespace args: [--markdown-linebreak-ext=md] + + - repo: https://github.com/packit/pre-commit-hooks + rev: v1.3.0 + hooks: + - id: validate-config + +ci: + autofix_commit_msg: | + Auto fixes from pre-commit.com hooks + autofix_prs: false + autoupdate_schedule: monthly diff --git a/ci-tests/sts.fmf b/ci-tests/sts.fmf new file mode 100644 index 0000000..6632211 --- /dev/null +++ b/ci-tests/sts.fmf @@ -0,0 +1,4 @@ +plan: + import: + url: https://gitlab.com/rh-kernel-stqe/sts + name: /plans/lio/core diff --git a/configshell/__init__.py b/configshell/__init__.py index 9de7a25..8d61191 100644 --- a/configshell/__init__.py +++ b/configshell/__init__.py @@ -22,10 +22,10 @@ from .shell import ConfigShell __all__ = [ - 'Console', - 'Log', 'ConfigNode', + 'ConfigShell', + 'Console', 'ExecutionError', + 'Log', 'Prefs', - 'ConfigShell', ] diff --git a/python-configshell-fb.spec b/python-configshell-fb.spec new file mode 100644 index 0000000..19804d2 --- /dev/null +++ b/python-configshell-fb.spec @@ -0,0 +1,55 @@ +%global upstream_name configshell-fb +%global pkg_name configshell + +Name: python-%{pkg_name} +Version: 1.1.29 +Release: %autorelease +Summary: A framework to implement simple but nice CLIs +# Note: This is the fb version of configshell + +License: Apache-2.0 +URL: http://github.com/open-iscsi/%{upstream_name} +Source0: %{pypi_source %{upstream_name}} + +BuildArch: noarch +BuildRequires: python3-devel +BuildRequires: python3-pip +BuildRequires: hatch +BuildRequires: python3-hatchling +BuildRequires: python3-hatch-vcs + +%global _description %{expand: +configshell-fb is a Python library that provides a framework to implement simple +but nice CLI-based applications. +} + +%description +%{_description} + +%package -n python3-%{pkg_name} +Summary: %{summary} +%{?python_provide:%python_provide python3-%{pkg_name}} + +Requires: python3-pyparsing >= 2.4.7 + +%description -n python3-%{pkg_name} +%{_description} + +%prep +%autosetup -n %{upstream_name}-%{version} +ln -sf configshell configshell_fb +rm -rf %{upstream_name}.egg-info + +%build +%pyproject_wheel + +%install +%pyproject_install +%pyproject_save_files configshell configshell_fb + +%files -n python3-%{pkg_name} -f %{pyproject_files} +%license COPYING +%doc README.md + +%changelog +%autochangelog