Blame python-pyscaffold.spec

a3fcda3
# Enabled by default
a3fcda3
# If the package needs to download data for the test which cannot be done in
a3fcda3
# koji, these can be disabled in koji by using `bcond_with` instead, but the
a3fcda3
# tests must be validated in mock with network enabled like so:
a3fcda3
# mock -r fedora-rawhide-x86_64 rebuild <srpm> --enable-network --rpmbuild-opts="--with tests"
a3fcda3
%bcond_without tests
a3fcda3
a3fcda3
%global pretty_name PyScaffold
a3fcda3
%global pypi_name pyscaffold
a3fcda3
a3fcda3
%global desc %{expand: \
a3fcda3
PyScaffold helps you setup a new Python project.
a3fcda3
a3fcda3
PyScaffold comes with a lot of elaborated features and configuration defaults
a3fcda3
to make the most common tasks in developing, maintaining and distributing your
a3fcda3
own Python package as easy as possible.
a3fcda3
}
a3fcda3
a3fcda3
Name:           python-%{pypi_name}
1f88c66
Version:        3.2.1
c28fb52
Release:        6%{?dist}
a3fcda3
Summary:        Template tool for putting up the scaffold of a Python project
a3fcda3
a3fcda3
License:        MIT
a3fcda3
URL:            https://pypi.python.org/pypi/%{pypi_name}
a3fcda3
Source0:        %pypi_source %{pretty_name}
a3fcda3
a3fcda3
BuildArch:      noarch
a3fcda3
a3fcda3
%{?python_enable_dependency_generator}
a3fcda3
a3fcda3
%description
a3fcda3
%{desc}
a3fcda3
a3fcda3
%package -n python3-%{pypi_name}
a3fcda3
Summary:        %{summary}
a3fcda3
BuildRequires:  python3-devel
a3fcda3
# For tests
a3fcda3
BuildRequires:  git
a3fcda3
BuildRequires:  %{py3_dist coverage}
a3fcda3
BuildRequires:  %{py3_dist cookiecutter}
a3fcda3
BuildRequires:  %{py3_dist django}
a3fcda3
BuildRequires:  %{py3_dist flake8}
a3fcda3
BuildRequires:  python3-setuptools
a3fcda3
BuildRequires:  python3-setuptools_scm
a3fcda3
BuildRequires:  %{py3_dist pytest}
a3fcda3
BuildRequires:  %{py3_dist pytest-cov}
a3fcda3
BuildRequires:  %{py3_dist pytest-runner}
a3fcda3
BuildRequires:  %{py3_dist pytest-virtualenv}
a3fcda3
BuildRequires:  %{py3_dist pytest-xdist}
a3fcda3
BuildRequires:  %{py3_dist wheel}
a3fcda3
# For documentation
a3fcda3
BuildRequires:  %{py3_dist sphinx}
1f88c66
BuildRequires:  %{py3_dist sphinx-rtd-theme}
a3fcda3
%{?python_provide:%python_provide python3-%{pypi_name}}
a3fcda3
a3fcda3
# Dep generator didn't pick them up
a3fcda3
Requires:  python3-setuptools
a3fcda3
Requires:  python3-setuptools_scm
a3fcda3
Requires:  %{py3_dist pytest-runner}
a3fcda3
a3fcda3
%description -n python3-%{pypi_name}
a3fcda3
%{desc}
a3fcda3
a3fcda3
%package doc
a3fcda3
Summary:        %{summary}
a3fcda3
a3fcda3
%description doc
a3fcda3
Documentation for %{name}.
a3fcda3
a3fcda3
%prep
a3fcda3
%autosetup -n %{pretty_name}-%{version}
a3fcda3
# Remove egg info
a3fcda3
rm -rf src/%{pretty_name}*.egg-info
a3fcda3
a3fcda3
# Remove bundled bits but leave configupdater
a3fcda3
# configupdater itself requires pyscaffold: cyclic dependency, so one of them
a3fcda3
# needs to bundle the other to begin with
a3fcda3
rm -rf src/pyscaffold/contrib/{__pycache__,setuptools_scm,ptr.py}
a3fcda3
a3fcda3
# Remove mention of non configupdater bundled bits
a3fcda3
sed -i 's/from pyscaffold.contrib.setuptools_scm/from setuptools_scm/' setup.py
a3fcda3
sed -i 's/from .contrib.setuptools_scm/from setuptools_scm/' src/pyscaffold/{utils,integration}.py
a3fcda3
sed -i 's/from .contrib import ptr/import ptr/' src/pyscaffold/{utils,integration}.py
a3fcda3
sed -i 's/from pyscaffold.contrib.setuptools_scm/from setuptools_scm/' tests/test_integration.py
a3fcda3
sed -i '/setuptools/ d' setup.cfg
a3fcda3
a3fcda3
# In tests, change invocations from python to python3
a3fcda3
find tests -name "*.py" -exec sed -i "s/'python'/'python3'/g" '{}' \;
a3fcda3
# Correct all shebangs in tests
a3fcda3
find tests -name "*.py" -exec sed -i 's|#!/usr/bin/env.*python|#!/usr/bin/python3|' '{}' \;
a3fcda3
a3fcda3
# In templates. replace /usr/bin/env python with /usr/bin/python3
a3fcda3
pushd src/pyscaffold/templates || exit -1
a3fcda3
for i in *.template; do
a3fcda3
    sed -i 's|#!/usr/bin/env.*python|#!/usr/bin/python3|' $i
a3fcda3
done
a3fcda3
popd
a3fcda3
a3fcda3
%build
a3fcda3
# It doesn't like the --executable option that's in %%py3_build
a3fcda3
%set_build_flags
a3fcda3
%{__python3} setup.py build
a3fcda3
a3fcda3
# Generate docs
a3fcda3
PYTHONPATH=src/ sphinx-build-3 docs html
a3fcda3
# Remove hidden files
a3fcda3
rm -f html/.buildinfo
a3fcda3
rm -rf html/.doctrees
a3fcda3
a3fcda3
%install
a3fcda3
%py3_install
a3fcda3
# setup.py does not install the template files
a3fcda3
install -p -m 0644 src/pyscaffold/templates/*.template -t %{buildroot}/%{python3_sitelib}/%{pypi_name}/templates/
a3fcda3
a3fcda3
%check
a3fcda3
%if %{with tests}
a3fcda3
# Required for a test
a3fcda3
git config --global user.email "jane@doe.com"
a3fcda3
git config --global user.name "jane doe"
a3fcda3
# remove tests that use network to do things with pip and git
a3fcda3
rm tests/test_install.py
a3fcda3
rm tests/system/test_common.py
a3fcda3
PYTHONPATH=%{buildroot}/%{python3_sitelib} pytest-3 . -k "not test_update_version_3_0_to_3_1 and not test_pipenv_works_with_pyscaffold and not test_create_project_with_cookiecutter and not test_cli_with_cookiecutter"
a3fcda3
%endif
a3fcda3
a3fcda3
%files -n python3-%{pypi_name}
a3fcda3
%license LICENSE.txt
a3fcda3
%doc README.rst AUTHORS.rst CHANGELOG.rst CONTRIBUTING.rst
49a2871
%{python3_sitelib}/%{pretty_name}-%{version}-py%{python3_version}.egg-info
a3fcda3
%{python3_sitelib}/%{pypi_name}
a3fcda3
%{_bindir}/putup
a3fcda3
a3fcda3
%files doc
a3fcda3
%license LICENSE.txt
a3fcda3
%doc html
a3fcda3
a3fcda3
%changelog
c28fb52
* Wed Jul 29 2020 Fedora Release Engineering <releng@fedoraproject.org> - 3.2.1-6
c28fb52
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
c28fb52
fd44984
* Tue May 26 2020 Miro Hrončok <mhroncok@redhat.com> - 3.2.1-5
fd44984
- Rebuilt for Python 3.9
fd44984
53d0262
* Thu Jan 30 2020 Fedora Release Engineering <releng@fedoraproject.org> - 3.2.1-4
53d0262
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
53d0262
6de17f3
* Thu Oct 03 2019 Miro Hrončok <mhroncok@redhat.com> - 3.2.1-3
6de17f3
- Rebuilt for Python 3.8.0rc1 (#1748018)
6de17f3
58fd06b
* Mon Aug 19 2019 Miro Hrončok <mhroncok@redhat.com> - 3.2.1-2
58fd06b
- Rebuilt for Python 3.8
58fd06b
1f88c66
* Mon Aug 05 2019 Ankur Sinha <ankursinha AT fedoraproject DOT org> - 3.2.1-1
1f88c66
- Update to 3.2.1
1f88c66
- Add rtd-theme
1f88c66
6c5a75d
* Fri Jul 26 2019 Fedora Release Engineering <releng@fedoraproject.org> - 3.1-3
6c5a75d
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
6c5a75d
84b76fd
* Sat Feb 02 2019 Fedora Release Engineering <releng@fedoraproject.org> - 3.1-2
84b76fd
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
84b76fd
a3fcda3
* Sun Jan 27 2019 Ankur Sinha <ankursinha AT fedoraproject DOT org> - 3.1-1
a3fcda3
- Initial build