Blob Blame History Raw
# Created by pyp2rpm-3.2.2
%global pypi_name black

Name:           python-%{pypi_name}
Version:        18.4a4
Release:        1%{?dist}
Summary:        The uncompromising code formatter

License:        MIT
URL:            https://github.com/ambv/black
Source0:        https://files.pythonhosted.org/packages/source/b/%{pypi_name}/%{pypi_name}-%{version}.tar.gz
Source1:        black.1
BuildArch:      noarch
 
BuildRequires:  python3-devel
BuildRequires:  python3-setuptools
BuildRequires:  python3-click
BuildRequires:  python3-attrs >= 17.4.0
BuildRequires:  python3-appdirs

%description
Black is the uncompromising Python code formatter. By using it, you agree to
cease control over minutiae of hand-formatting. In return, Black gives you
speed, determinism, and freedom from pycodestyle nagging about formatting.
You will save time and mental energy for more important matters.

%package -n     python3-%{pypi_name}
Summary:        %{summary}
%{?python_provide:%python_provide python3-%{pypi_name}}
 
Requires:       python3-click
Requires:       python3-attrs >= 17.4.0
Requires:       python3-appdirs
Requires:       python3-setuptools
%description -n python3-%{pypi_name}
Black is the uncompromising Python code formatter. By using it, you agree to
cease control over minutiae of hand-formatting. In return, Black gives you
speed, determinism, and freedom from pycodestyle nagging about formatting.
You will save time and mental energy for more important matters.


%prep
%autosetup -n %{pypi_name}-%{version}
# Remove bundled egg-info
rm -rf %{pypi_name}.egg-info

%build
%py3_build

%install
%py3_install
cp %{buildroot}/%{_bindir}/black %{buildroot}/%{_bindir}/black-%{python3_version}
# ln -s {_bindir}/black-{python3_version} {buildroot}/{_bindir}/black-3

# Remove shebang
for pyfile in %{buildroot}%{python3_sitelib}/blib2to3/pgen2/token.py %{buildroot}%{python3_sitelib}/%{pypi_name}.py; do
 sed '1{\@^#!\s*/usr/bin/env python@d}' ${pyfile} > ${pyfile}.new &&
 touch -r ${pyfile} ${pyfile}.new &&
 mv ${pyfile}.new ${pyfile}
done

install -D -m 644 %{SOURCE1} %{buildroot}%{_mandir}/man1/black.1

%check
%{__python3} setup.py test

%files -n python3-%{pypi_name}
%license LICENSE
%doc README.md
%{_bindir}/black
# {_bindir}/black-3
%{_bindir}/black-%{python3_version}
%{_mandir}/man1/black.1*

%{python3_sitelib}/__pycache__/*
%{python3_sitelib}/%{pypi_name}.py
%{python3_sitelib}/blib2to3
%{python3_sitelib}/%{pypi_name}-%{version}-py?.?.egg-info

%changelog
* Wed May 02 2018 Christian Heimes <cheimes@redhat.com> - 18.4a4-1
- Initial package.