%global pkgvers 0
%global scdate0 20241112
%global schash0 291376ef3b251d0629e048f8d5169299ac535662
%global branch0 main
%global source0 https://github.com/CyberAgentAILab/cmaes.git

%global sshort0 %{expand:%%{lua:print(('%{schash0}'):sub(1,8))}}

Name:           python-cmaes
Version:        0.11.1
Release:        %{scdate0}.%{pkgvers}.git%{sshort0}%{?dist}
Summary:        Covariance Matrix Adaptation Evolution Strategy
License:        MIT
BuildArch:      noarch

URL:            https://github.com/CyberAgentAILab/cmaes

BuildRequires:  git python3-devel python3-setuptools python3-numpy

%description
Covariance Matrix Adaptation Evolution Strategy implementation.


%package -n     python3-cmaes
Summary:        %{summary}
Provides:       python-cmaes

%description -n python3-cmaes
Covariance Matrix Adaptation Evolution Strategy implementation.


%prep
%setup -T -c -n %{name}
git clone --depth 1 -n -b %{branch0} %{source0} .
git fetch --depth 1 origin %{schash0}
git reset --hard %{schash0}
git log --format=fuller


%build
echo '[metadata]' >  setup.cfg
echo '  name = cmaes' >> setup.cfg
echo '  version = attr: cmaes.__version__' >> setup.cfg
echo '[options]' >>  setup.cfg
echo '[mypy]' >>  setup.cfg
echo "import setuptools; setuptools.setup(packages=['cmaes'])" > setup.py
%py3_build


%install
%py3_install
# workaround install (older setuptools)
if [ ! -d %{buildroot}/%{python3_sitelib}/cmaes ]; then
  mkdir %{buildroot}/%{python3_sitelib}/cmaes
  install -m644 cmaes/*.py %{buildroot}/%{python3_sitelib}/cmaes/
fi


%files -n python3-cmaes
%license LICENSE
%doc README.md
%{python3_sitelib}/cmaes/
%{python3_sitelib}/cmaes-%{version}-py%{python3_version}.egg-info/


%changelog
* Fri Mar 29 2019 Balint Cristian <cristian.balint@gmail.com>
- github update releases