# Created by pyp2rpm-3.3.2
%global pypi_name cocotb
Name: python-%{pypi_name}
Version: 1.3.1
Release: 1%{?dist}
Summary: Coroutine Co-simulation Test Bench
License: BSD
URL: https://github.com/cocotb/cocotb
Source0: https://github.com/cocotb/cocotb/archive/v%{version}/%{pypi_name}-%{version}.tar.gz
BuildRequires: python2-devel
BuildRequires: python2-setuptools
BuildRequires: gcc, gcc-c++, make
# iverilog and ghdl are the FOSS simulators. cocotb supports both.
# We need them to run the tests.
# I think ghdl is not in EPEL so let's not BR it for now (especially
# since there is a bug with those tests anyway).
BuildRequires: iverilog
# So this package doesn't actually contain compiled code (at the moment).
# But it does contain source code that users compile when running a
# simulator. So maybe arguably it should be arched.
# Future versions of cocotb may contain the option to have precompiled
# libraries.
BuildArch: noarch
# On EPEL7, ship python2-cocotb rather than python3-cocotb.
%package -n python2-%{pypi_name}
Summary: %{summary}
%{?python_provide:%python_provide python2-%{pypi_name}}
# Provide "cocotb", as that's the upstream name and this is
# a framework end-users would use directly.
Provides: cocotb = %{version}-%{release}
# EPEL doesn't have weak deps (I think).
# ghdl isn't currently in EPEL, but iverilog is, so require it.
Requires: iverilog
#Requires: ghdl
Requires: python2-setuptools
%description
cocotb is a coroutine based cosimulation library for writing VHDL
and Verilog testbenches in Python.
%description -n python2-%{pypi_name}
cocotb is a coroutine based cosimulation library for writing VHDL
and Verilog testbenches in Python.
%prep
%autosetup -n %{pypi_name}-%{version}
# Only run the tests, not the examples.
# Examples require /usr/bin/cocotb-config already installed.
sed "/\$(MAKE) -k -C examples/d" -i Makefile
# Fix the 'combine_results.py' script to not use env.
sed 's/env python/python2/g' -i bin/combine_results.py
# Should remove chbangs from non-script library files.
sed "/env python/d" -i cocotb/*.py
sed "/env python/d" -i cocotb/drivers/*.py
sed "/env python/d" -i cocotb/generators/*.py
sed "/env python/d" -i cocotb/monitors/*.py
%build
%py2_build
%install
%py2_install
%check
# Run tests with the FOSS simulators.
export PYTHON_BIN=python2
make SIM=icarus
%files -n python2-%{pypi_name}
%doc README.md
%license LICENSE
%{_bindir}/cocotb-config
%{python2_sitelib}/%{pypi_name}
%{python2_sitelib}/%{pypi_name}-%{version}-py*.*.egg-info
%changelog
* Fri Mar 27 2020 Ben Rosser <rosser.bjr@gmail.com> - 1.3.1-1
- Update to latest upstream release.
* Tue Jan 21 2020 Ben Rosser <rosser.bjr@gmail.com> - 1.3.0-1
- Update to latest upstream release.
* Tue Sep 24 2019 Ben Rosser <rosser.bjr@gmail.com> - 1.2.0-3
- Move Recommends on iverilog/ghdl into python3 subpackage.
* Fri Jul 26 2019 Ben Rosser <rosser.bjr@gmail.com> - 1.2.0-1
- Initial package for EPEL 7, shipping python2 version of cocotb.