Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
145 changes: 145 additions & 0 deletions .github/workflows/pyserv.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
name: pyserv RPMs

on:
workflow_dispatch:
pull_request:
push:
branches:
- master

jobs:
get_version:
name: Get version info
runs-on: ubuntu-latest
permissions:
contents: read
defaults:
run:
shell: bash
outputs:
version: ${{ steps.spec_ver.outputs.version }}

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Get package version
id: spec_ver
run: |
version=$(make version)
echo "version=${version}" >> $GITHUB_OUTPUT
echo Version from spec: $version
env:
NAME: python-pyserv

build_rpms:
name: pyserv-rpms
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
name: [rocky9]
include:
- name: rocky9
spec: python-pyserv
image: quay.io/rockylinux/rockylinux:9

runs-on: ubuntu-latest
needs: [get_version]
container:
image: ${{ matrix.image }}
permissions:
contents: read
defaults:
run:
shell: bash
env:
PYTHONIOENCODING: utf-8

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

# Work-around for https://github.com/actions/runner-images/issues/6775
- name: Change Owner of Container Working Directory
if: matrix.image
run: chown root.root .

- name: Check version and update spec
env:
VERSION: ${{ needs.get_version.outputs.version }}
run: |
echo Dev version from get_version step: $VERSION

- name: Install deps for rpm builds (centos/rocky)
run: |
bash scripts/install_deps_el9.sh
dnf install -y \
https://github.com/VCTLabs/el9-rpm-toolbox/releases/download/py3tftp-1.3.0/python3-py3tftp-1.3.0-1.el9.noarch.rpm \
https://github.com/VCTLabs/el9-rpm-toolbox/releases/download/picotui-1.2.3.1/python3-picotui-1.2.3.1-1.el9.noarch.rpm \
https://github.com/VCTLabs/el9-rpm-toolbox/releases/download/pygtail-0.14.0.2/python3-pygtail-0.14.0.2-1.el9.noarch.rpm \
https://github.com/VCTLabs/el9-rpm-toolbox/releases/download/tftpy-0.8.6.1/python3-tftpy-0.8.6.1-1.el9.noarch.rpm \
https://github.com/VCTLabs/el9-rpm-toolbox/releases/download/daemonizer-1.1.3/python3-daemonizer-1.1.3-1.el9.noarch.rpm

- name: Build bdist_rpm pkgs
run: |
NAME="${{ matrix.spec }}" make packages

- name: Upload rpm files
uses: actions/upload-artifact@v4
with:
name: packages
path: |
tmp/RPMS/*/*.rpm
tmp/SRPMS/*.rpm

create-release:
name: Create pyserv Release
runs-on: ubuntu-latest
needs: [get_version, build_rpms]
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Download Artifacts
uses: actions/download-artifact@v4

- name: List Artifacts
run: ls -laR packages

- name: Fetch tags
run: git fetch --tags --prune --quiet

- name: Tag Release
id: tag_release
if: ${{ github.event_name != 'pull_request' }}
run: |
set +e
if git rev-list "pyserv-${{ needs.get_version.outputs.version }}" >/dev/null 2>&1 ; then
echo "Tag for pyserv-${{ needs.get_version.outputs.version }} already exists. Skipping release creation."
echo "NEW_RELEASE=false" >> $GITHUB_OUTPUT
else
git tag "pyserv-${{ needs.get_version.outputs.version }}"
git push origin "pyserv-${{ needs.get_version.outputs.version }}"
echo "NEW_RELEASE=true" >> $GITHUB_OUTPUT
fi

- name: Create draft release
id: create_release
if: ${{ github.event_name != 'pull_request' && steps.tag_release.outputs.NEW_RELEASE == 'true' }}
uses: softprops/action-gh-release@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: pyserv-${{ needs.get_version.outputs.version }}
name: RPM Release pyserv-${{ needs.get_version.outputs.version }}
body: Latest RPMs for pyserv-${{ needs.get_version.outputs.version }}
draft: false
prerelease: false
files: |
packages/RPMS/*/*.rpm
packages/SRPMS/*.rpm
5 changes: 5 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ following table.
py3tftp |py3tftp|
pygtail |pygtail|
pyprctrl |pyprctrl|
pyserv |pyserv|
stoppy |stoppy|
timed-count |timed-count|
tftpy |tftpy|
Expand Down Expand Up @@ -80,6 +81,10 @@ following table.
:target: https://pyprctl.readthedocs.io/en/latest
:alt: pyprctrl RPM status

.. |pyserv| image:: https://github.com/VCTLabs/el9-rpm-toolbox/actions/workflows/pyserv.yml/badge.svg
:target: https://sarnold.github.io/pyserv/
:alt: pyserv RPM status

.. |stoppy| image:: https://github.com/VCTLabs/el9-rpm-toolbox/actions/workflows/stoppy.yml/badge.svg
:target: https://github.com/morefigs/stoppy
:alt: stoppy RPM status
Expand Down
84 changes: 84 additions & 0 deletions specs/python-pyserv.spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
# Tests are disabled in RHEL 9 because really old tox
# Specify --with tests to enable them.
%bcond_with tests

%global pypi_name pyserv

Name: python-%{pypi_name}
Version: 1.8.4
Release: 1%{?dist}
Summary: Threaded wsgi, http, tftp server classes, entry points and daemon scripts.

License: MIT
URL: http://github.com/sarnold/pyserv
Source0: %{url}/releases/download/%{version}/%{pypi_name}-%{version}.tar.gz
BuildArch: noarch

%description
Pyserv is a collection of threaded Python server bits, including custom
HTTP server and WSGI classes, along with corresponding console entry
points and some daemon scripts. The latest addition includes a new
async daemon script based on the py3tftp package.

%package -n python%{python3_pkgversion}-%{pypi_name}
Summary: %{summary}

BuildRequires: python%{python3_pkgversion}-devel
BuildRequires: pyproject-rpm-macros
BuildRequires: python%{python3_pkgversion}dist(tomli)
BuildRequires: python%{python3_pkgversion}dist(wheel)
BuildRequires: python%{python3_pkgversion}dist(setuptools)
BuildRequires: python%{python3_pkgversion}dist(setuptools-scm[toml])
# these are not really "extra"
BuildRequires: python%{python3_pkgversion}dist(py3tftp)
BuildRequires: python%{python3_pkgversion}dist(daemonizer)
BuildRequires: python%{python3_pkgversion}dist(tftpy)
BuildRequires: python%{python3_pkgversion}dist(picotui)
BuildRequires: python%{python3_pkgversion}dist(pygtail)
BuildRequires: python%{python3_pkgversion}dist(platformdirs)
BuildRequires: python%{python3_pkgversion}-scapy
%if %{with tests}
BuildRequires: python%{python3_pkgversion}dist(pytest)
%endif

%{?python_provide:%python_provide python%{python3_pkgversion}-%{pypi_name}}

%description -n python%{python3_pkgversion}-%{pypi_name}
Pyserv is a collection of threaded Python server bits, including custom
HTTP server and WSGI classes, along with corresponding console entry
points and some daemon scripts. The latest addition includes a new
async daemon script based on the py3tftp package.

%prep
%autosetup -p1 -n %{pypi_name}-%{version}

# using pyproject macros
%generate_buildrequires
export SETUPTOOLS_SCM_PRETEND_VERSION=%{version}
%pyproject_buildrequires

%build
export SETUPTOOLS_SCM_PRETEND_VERSION=%{version}
%pyproject_wheel

%install
%pyproject_install

# Use -l to assert a %%license file is found (PEP 639).
# note the last argument is the top-level module directory name
%pyproject_save_files -l pyserv

%check
%pyproject_check_import -e '*.export'
%if %{with tests}
%pytest -vv test/
%endif

%files -n python%{python3_pkgversion}-pyserv -f %{pyproject_files}
%doc README.rst CHANGELOG.rst
%license LICENSE REUSE.toml
%{_bindir}/*

%changelog
* Mon Jul 21 2025 Stephen Arnold <nerdboy@gentoo.org> - 1.8.4
- New package