Skip to content

Commit 3d22037

Browse files
authored
Merge pull request #15 from VCTLabs/develop
package pyserv (really)
2 parents 44ef48d + 88c4ea3 commit 3d22037

File tree

3 files changed

+234
-0
lines changed

3 files changed

+234
-0
lines changed

.github/workflows/pyserv.yml

Lines changed: 145 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,145 @@
1+
name: pyserv RPMs
2+
3+
on:
4+
workflow_dispatch:
5+
pull_request:
6+
push:
7+
branches:
8+
- master
9+
10+
jobs:
11+
get_version:
12+
name: Get version info
13+
runs-on: ubuntu-latest
14+
permissions:
15+
contents: read
16+
defaults:
17+
run:
18+
shell: bash
19+
outputs:
20+
version: ${{ steps.spec_ver.outputs.version }}
21+
22+
steps:
23+
- uses: actions/checkout@v4
24+
with:
25+
fetch-depth: 0
26+
27+
- name: Get package version
28+
id: spec_ver
29+
run: |
30+
version=$(make version)
31+
echo "version=${version}" >> $GITHUB_OUTPUT
32+
echo Version from spec: $version
33+
env:
34+
NAME: python-pyserv
35+
36+
build_rpms:
37+
name: pyserv-rpms
38+
timeout-minutes: 30
39+
strategy:
40+
fail-fast: false
41+
matrix:
42+
name: [rocky9]
43+
include:
44+
- name: rocky9
45+
spec: python-pyserv
46+
image: quay.io/rockylinux/rockylinux:9
47+
48+
runs-on: ubuntu-latest
49+
needs: [get_version]
50+
container:
51+
image: ${{ matrix.image }}
52+
permissions:
53+
contents: read
54+
defaults:
55+
run:
56+
shell: bash
57+
env:
58+
PYTHONIOENCODING: utf-8
59+
60+
steps:
61+
- uses: actions/checkout@v4
62+
with:
63+
fetch-depth: 0
64+
65+
# Work-around for https://github.com/actions/runner-images/issues/6775
66+
- name: Change Owner of Container Working Directory
67+
if: matrix.image
68+
run: chown root.root .
69+
70+
- name: Check version and update spec
71+
env:
72+
VERSION: ${{ needs.get_version.outputs.version }}
73+
run: |
74+
echo Dev version from get_version step: $VERSION
75+
76+
- name: Install deps for rpm builds (centos/rocky)
77+
run: |
78+
bash scripts/install_deps_el9.sh
79+
dnf install -y \
80+
https://github.com/VCTLabs/el9-rpm-toolbox/releases/download/py3tftp-1.3.0/python3-py3tftp-1.3.0-1.el9.noarch.rpm \
81+
https://github.com/VCTLabs/el9-rpm-toolbox/releases/download/picotui-1.2.3.1/python3-picotui-1.2.3.1-1.el9.noarch.rpm \
82+
https://github.com/VCTLabs/el9-rpm-toolbox/releases/download/pygtail-0.14.0.2/python3-pygtail-0.14.0.2-1.el9.noarch.rpm \
83+
https://github.com/VCTLabs/el9-rpm-toolbox/releases/download/tftpy-0.8.6.1/python3-tftpy-0.8.6.1-1.el9.noarch.rpm \
84+
https://github.com/VCTLabs/el9-rpm-toolbox/releases/download/daemonizer-1.1.3/python3-daemonizer-1.1.3-1.el9.noarch.rpm
85+
86+
- name: Build bdist_rpm pkgs
87+
run: |
88+
NAME="${{ matrix.spec }}" make packages
89+
90+
- name: Upload rpm files
91+
uses: actions/upload-artifact@v4
92+
with:
93+
name: packages
94+
path: |
95+
tmp/RPMS/*/*.rpm
96+
tmp/SRPMS/*.rpm
97+
98+
create-release:
99+
name: Create pyserv Release
100+
runs-on: ubuntu-latest
101+
needs: [get_version, build_rpms]
102+
permissions:
103+
contents: write
104+
steps:
105+
- name: Checkout
106+
uses: actions/checkout@v4
107+
108+
- name: Download Artifacts
109+
uses: actions/download-artifact@v4
110+
111+
- name: List Artifacts
112+
run: ls -laR packages
113+
114+
- name: Fetch tags
115+
run: git fetch --tags --prune --quiet
116+
117+
- name: Tag Release
118+
id: tag_release
119+
if: ${{ github.event_name != 'pull_request' }}
120+
run: |
121+
set +e
122+
if git rev-list "pyserv-${{ needs.get_version.outputs.version }}" >/dev/null 2>&1 ; then
123+
echo "Tag for pyserv-${{ needs.get_version.outputs.version }} already exists. Skipping release creation."
124+
echo "NEW_RELEASE=false" >> $GITHUB_OUTPUT
125+
else
126+
git tag "pyserv-${{ needs.get_version.outputs.version }}"
127+
git push origin "pyserv-${{ needs.get_version.outputs.version }}"
128+
echo "NEW_RELEASE=true" >> $GITHUB_OUTPUT
129+
fi
130+
131+
- name: Create draft release
132+
id: create_release
133+
if: ${{ github.event_name != 'pull_request' && steps.tag_release.outputs.NEW_RELEASE == 'true' }}
134+
uses: softprops/action-gh-release@v2
135+
env:
136+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
137+
with:
138+
tag_name: pyserv-${{ needs.get_version.outputs.version }}
139+
name: RPM Release pyserv-${{ needs.get_version.outputs.version }}
140+
body: Latest RPMs for pyserv-${{ needs.get_version.outputs.version }}
141+
draft: false
142+
prerelease: false
143+
files: |
144+
packages/RPMS/*/*.rpm
145+
packages/SRPMS/*.rpm

README.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ following table.
4242
py3tftp |py3tftp|
4343
pygtail |pygtail|
4444
pyprctrl |pyprctrl|
45+
pyserv |pyserv|
4546
stoppy |stoppy|
4647
timed-count |timed-count|
4748
tftpy |tftpy|
@@ -80,6 +81,10 @@ following table.
8081
:target: https://pyprctl.readthedocs.io/en/latest
8182
:alt: pyprctrl RPM status
8283

84+
.. |pyserv| image:: https://github.com/VCTLabs/el9-rpm-toolbox/actions/workflows/pyserv.yml/badge.svg
85+
:target: https://sarnold.github.io/pyserv/
86+
:alt: pyserv RPM status
87+
8388
.. |stoppy| image:: https://github.com/VCTLabs/el9-rpm-toolbox/actions/workflows/stoppy.yml/badge.svg
8489
:target: https://github.com/morefigs/stoppy
8590
:alt: stoppy RPM status

specs/python-pyserv.spec

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
# Tests are disabled in RHEL 9 because really old tox
2+
# Specify --with tests to enable them.
3+
%bcond_with tests
4+
5+
%global pypi_name pyserv
6+
7+
Name: python-%{pypi_name}
8+
Version: 1.8.4
9+
Release: 1%{?dist}
10+
Summary: Threaded wsgi, http, tftp server classes, entry points and daemon scripts.
11+
12+
License: MIT
13+
URL: http://github.com/sarnold/pyserv
14+
Source0: %{url}/releases/download/%{version}/%{pypi_name}-%{version}.tar.gz
15+
BuildArch: noarch
16+
17+
%description
18+
Pyserv is a collection of threaded Python server bits, including custom
19+
HTTP server and WSGI classes, along with corresponding console entry
20+
points and some daemon scripts. The latest addition includes a new
21+
async daemon script based on the py3tftp package.
22+
23+
%package -n python%{python3_pkgversion}-%{pypi_name}
24+
Summary: %{summary}
25+
26+
BuildRequires: python%{python3_pkgversion}-devel
27+
BuildRequires: pyproject-rpm-macros
28+
BuildRequires: python%{python3_pkgversion}dist(tomli)
29+
BuildRequires: python%{python3_pkgversion}dist(wheel)
30+
BuildRequires: python%{python3_pkgversion}dist(setuptools)
31+
BuildRequires: python%{python3_pkgversion}dist(setuptools-scm[toml])
32+
# these are not really "extra"
33+
BuildRequires: python%{python3_pkgversion}dist(py3tftp)
34+
BuildRequires: python%{python3_pkgversion}dist(daemonizer)
35+
BuildRequires: python%{python3_pkgversion}dist(tftpy)
36+
BuildRequires: python%{python3_pkgversion}dist(picotui)
37+
BuildRequires: python%{python3_pkgversion}dist(pygtail)
38+
BuildRequires: python%{python3_pkgversion}dist(platformdirs)
39+
BuildRequires: python%{python3_pkgversion}-scapy
40+
%if %{with tests}
41+
BuildRequires: python%{python3_pkgversion}dist(pytest)
42+
%endif
43+
44+
%{?python_provide:%python_provide python%{python3_pkgversion}-%{pypi_name}}
45+
46+
%description -n python%{python3_pkgversion}-%{pypi_name}
47+
Pyserv is a collection of threaded Python server bits, including custom
48+
HTTP server and WSGI classes, along with corresponding console entry
49+
points and some daemon scripts. The latest addition includes a new
50+
async daemon script based on the py3tftp package.
51+
52+
%prep
53+
%autosetup -p1 -n %{pypi_name}-%{version}
54+
55+
# using pyproject macros
56+
%generate_buildrequires
57+
export SETUPTOOLS_SCM_PRETEND_VERSION=%{version}
58+
%pyproject_buildrequires
59+
60+
%build
61+
export SETUPTOOLS_SCM_PRETEND_VERSION=%{version}
62+
%pyproject_wheel
63+
64+
%install
65+
%pyproject_install
66+
67+
# Use -l to assert a %%license file is found (PEP 639).
68+
# note the last argument is the top-level module directory name
69+
%pyproject_save_files -l pyserv
70+
71+
%check
72+
%pyproject_check_import -e '*.export'
73+
%if %{with tests}
74+
%pytest -vv test/
75+
%endif
76+
77+
%files -n python%{python3_pkgversion}-pyserv -f %{pyproject_files}
78+
%doc README.rst CHANGELOG.rst
79+
%license LICENSE REUSE.toml
80+
%{_bindir}/*
81+
82+
%changelog
83+
* Mon Jul 21 2025 Stephen Arnold <nerdboy@gentoo.org> - 1.8.4
84+
- New package

0 commit comments

Comments
 (0)