Accepting request 945128 from home:bnavigator:branches:devel:languages:python

- Back to bootstrap without pip

OBS-URL: https://build.opensuse.org/request/show/945128
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-flit-core?expand=0&rev=19
This commit is contained in:
Benjamin Greiner 2022-01-09 14:56:17 +00:00 committed by Git OBS Bridge
parent 9ebd211418
commit 5b2c36e178
3 changed files with 34 additions and 7 deletions

17
build_dists.py Normal file
View File

@ -0,0 +1,17 @@
"""Build flit_core to upload to PyPI.
Normally, this should only be used by me when making a release.
"""
import os
from flit_core import buildapi
os.chdir(os.path.dirname(os.path.abspath(__file__)))
print("Building sdist")
sdist_fname = buildapi.build_sdist('dist/')
print(os.path.join('dist', sdist_fname))
print("\nBuilding wheel")
whl_fname = buildapi.build_wheel('dist/')
print(os.path.join('dist', whl_fname))

View File

@ -1,3 +1,8 @@
-------------------------------------------------------------------
Sun Jan 9 14:53:21 UTC 2022 - Ben Greiner <code@bnavigator.de>
- Back to bootstrap without pip
-------------------------------------------------------------------
Sun Jan 9 11:38:59 UTC 2022 - Ben Greiner <code@bnavigator.de>

View File

@ -31,10 +31,10 @@ Version: 3.6.0
Release: 0
Summary: Distribution-building parts of Flit
License: BSD-3-Clause
URL: https://github.com/takluyver/flit
Source: https://files.pythonhosted.org/packages/source/f/flit-core/flit_core-%{version}.tar.gz
URL: https://github.com/pypa/flit
Source0: https://files.pythonhosted.org/packages/source/f/flit-core/flit_core-%{version}.tar.gz
Source1: https://github.com/pypa/flit/raw/%{version}/flit_core/build_dists.py
BuildRequires: %{python_module base >= 3.6}
BuildRequires: %{python_module pip}
%if %{with test}
BuildRequires: %{python_module flit-core = %{version}}
BuildRequires: %{python_module pytest}
@ -52,13 +52,19 @@ Flit is a simple way to put Python packages and modules on PyPI.
%prep
%setup -q -n flit_core-%{version}
cp %{SOURCE1} .
%build
%pyproject_wheel
# https://flit.readthedocs.io/en/latest/bootstrap.html
python3 build_dists.py
%if !%{with test}
%install
%pyproject_install
%{python_expand # do manually what pip would do
mkdir -p %{buildroot}%{$python_sitelib}
unzip dist/flit_core-%{version}-py3-none-any.whl -d %{buildroot}%{$python_sitelib}
rm -r %{buildroot}%{$python_sitelib}/flit_core/tests
}
%{python_expand # debundle after the bootstrap. See vendor/README
sed -i 's/from .vendor import tomli/import tomli/' %{buildroot}%{$python_sitelib}/flit_core/config.py
rm -r %{buildroot}%{$python_sitelib}/flit_core/vendor
@ -69,7 +75,7 @@ rm -r %{buildroot}%{$python_sitelib}/flit_core/vendor
%if %{with test}
%check
# make sure we do not test the debundled sources
# make sure we do not test the sources but the debundled package
rm flit_core/*.py pyproject.toml
%pytest -rfEs
%endif
@ -78,7 +84,6 @@ rm flit_core/*.py pyproject.toml
%files %{python_files}
%{python_sitelib}/flit_core
%{python_sitelib}/flit_core-%{version}*-info
%exclude %{python_sitelib}/flit_core/tests
%endif
%changelog