Skip to content

Instantly share code, notes, and snippets.

@shaneallcroft
Created September 13, 2021 07:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shaneallcroft/0cebe661ce9c6c9f61a3fa12bfc8f952 to your computer and use it in GitHub Desktop.
Save shaneallcroft/0cebe661ce9c6c9f61a3fa12bfc8f952 to your computer and use it in GitHub Desktop.
# Using the new guidelines: https://src.fedoraproject.org/rpms/pyproject-rpm-macros
# https://fedoraproject.org/wiki/Changes/PythonPackagingGuidelines202x
# Enabled by default
# If the package needs to download data for the test which cannot be done in
# koji, these can be disabled in koji by using `bcond_with` instead, but the
# tests must be validated in mock with network enabled like so:
# mock -r fedora-rawhide-x86_64 rebuild <srpm> --enable-network --rpmbuild-opts="--with tests"
%bcond_without tests
# Replace "pyplane" with the appropriate value using your editor's
# search and replace function. It is preferred to using macros like %{pypi_name}
# because they make the spec harder to read especially in cases where the
# canonical ("pretty name") of the module is different from its name on pypi
%global _description %{expand:
Phase plane analysis of nonlinear systems}
%global forgeurl https://github.com/TUD-RST/pyplane
%global commit e8b9b8d7bfb75aa9289c22f9ff180c1a17fb7868
%forgemeta
Name: python-pyplane
Version: 1.2.0
Release: 0%{?dist}
Summary: PyPlane is a free software for phase plane analysis of second order dynamical systems written in PYTHON and QT4. Comprable to MATLAB's pplane
# https://fedoraproject.org/wiki/Licensing:Main?rd=Licensing#Good_Licenses
License: GPLv3
URL: %{forgeurl}
Source0: %{forgesource}
BuildArch: noarch
%description %_description
%python3_version 3.8
%package -n python3-pyplane
Summary: %{summary}
BuildRequires: python3-devel
%description -n python3-pyplane %_description
%package doc
Summary: Documentation for %{name}
BuildRequires: make
BuildRequires: %{py3_dist sphinx}
%description doc
This package provides documentation for %{name}.
%prep
%forgesetup
# Comment out to remove /usr/bin/env shebangs
# Can use something similar to correct/remove /usr/bin/python shebangs also
# find . -type f -name "*.py" -exec sed -i '/^#![ ]*\/usr\/bin\/env.*$/ d' {} 2>/dev/null ';'
%generate_buildrequires
%pyproject_buildrequires
# can also use something like this
# %%pyproject_buildrequires -r %%{?with_tests:-x test}
%build
%pyproject_wheel
# Sometimes needed so sphinx can import the module
#PYTHONPATH=".:.." make -C doc SPHINXBUILD=sphinx-build-3 html
#rm -rf doc/_build/html/{.doctrees,.buildinfo} -vf
%install
%pyproject_install
%pyproject_save_files pyplane
%check
%if %{with tests}
%{pytest}
#%{tox}
%endif
# LICENSE/COPYING are included in the dist-info, so we do not need to
# explicitly list them again
%files -n python3-pyplane -f %{pyproject_files}
%doc README.rst
%files doc
%license COPYING
%doc doc/_build/html
%autochangelog
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment