#5 Properly package flit-core and restore /usr/bin/flit (#1783610)
Merged a month ago by nonamedotc. Opened a month ago by churchyard.
rpms/ churchyard/python-flit core  into  master

file modified
+46 -29

@@ -1,17 +1,12 @@ 

- # These require packages that are built using this package itself.

- %global with_loop 0

- 

  # cannot enable tests at the moment.

  # Need to package requestes_download

  %global with_test 0

  

- %global python3_wheelname %{srcname}-%{version}-py3-none-any.whl

- 

  %global srcname flit

  

  Name:		python-%{srcname}

  Version:	2.1.0

- Release:	1%{?dist}

+ Release:	2%{?dist}

  Summary:	Simplified packaging of Python modules

  

  # ./flit/logo.py  under ASL 2.0 license

@@ -30,19 +25,20 @@ 

  BuildRequires:	python3-pytoml

  

  %if 0%{?with_test}

+ BuildRequires:	/usr/bin/python

  BuildRequires:	python3-pytest

  BuildRequires:	python3-responses

  

- 

  # Requires flit to build:

  BuildRequires:	python3-testpath

+ BuildRequires:	python3-requests-download

  %endif

  

  # https://pypi.python.org/pypi/tornado

  # ./flit/logo.py unkown version

  Provides:    bundled(python-tornado)

  

- %description

+ %global _description %{expand:

  Flit is a simple way to put Python packages and modules on PyPI.

  

  Flit only creates packages in the new 'wheel' format. People using older

@@ -53,35 +49,32 @@ 

  included automatically.

  

  Flit requires Python 3, but you can use it to distribute modules for Python 2,

- so long as they can be imported on Python 3.

+ so long as they can be imported on Python 3.}

+ 

+ %description %_description

  

  

  %package -n python3-%{srcname}

  Summary:	%{summary}

  %{?python_provide:%python_provide python3-%{srcname}}

+ Requires:	python3-%{srcname}-core = %{version}-%{release}

  

- Requires:	python3-requests

- Requires:	python3-docutils

- Requires:	python3-pytoml

- %if 0%{?with_loop}

- Requires:	python3-requests-download

- %endif

  

  # soft dependency: (WARNING) Cannot analyze code. Pygments package not found.

  Recommends:	python3-pygments

  

- %description -n python3-%{srcname}

- Flit is a simple way to put Python packages and modules on PyPI.

+ %description -n python3-%{srcname} %_description

  

- Flit only creates packages in the new 'wheel' format. People using older

- versions of pip (<1.5) or easy_install will not be able to install them.

  

- Flit packages a single importable module or package at a time, using the import

- name as the name on PyPI. All subpackages and data files within a package are

- included automatically.

+ %package -n python3-%{srcname}-core

+ Summary:	PEP 517 build backend for packages using Flit

+ %{?python_provide:%python_provide python3-%{srcname}-core}

+ Conflicts:	python3-%{srcname} < 2.1.0-2

  

- Flit requires Python 3, but you can use it to distribute modules for Python 2,

- so long as they can be imported on Python 3.

+ %description -n python3-%{srcname}-core

+ This provides a PEP 517 build backend for packages using Flit.

+ The only public interface is the API specified by PEP 517,

+ at flit_core.buildapi.

  

  

  %prep

@@ -89,27 +82,51 @@ 

  

  %build

  export FLIT_NO_NETWORK=1

- %py3_build

+ 

+ # first, build flit_core with self

+ # TODO do it in a less hacky way, this is reconstructed from pyoroject.toml

+ cd flit_core

+ PYTHONPATH=$(pwd) %{python3} -c 'from flit_core.build_thyself import build_wheel; build_wheel(".")'

+ 

+ # %%py3_install_wheel unfortunately hardcodes installing from dist/

+ mkdir ../dist

+ mv flit_core-%{version}-py2.py3-none-any.whl ../dist

+ cd -

+ 

+ PYTHONPATH=$(pwd):$(pwd)/flit_core %{python3} -m flit build --format wheel

  

  

  %install

- %py3_install

+ %py3_install_wheel flit_core-%{version}-py2.py3-none-any.whl

+ %py3_install_wheel flit-%{version}-py3-none-any.whl

  

  

  %if 0%{?with_test}

  %check

- py.test-3

+ export PYTHONPATH=%{buildroot}%{python3_sitelib}

+ pytest-3

  %endif

  

  

  %files -n python3-%{srcname}

  %license LICENSE

  %doc README.rst

- %{python3_sitelib}/%{srcname}*egg-info

- %{python3_sitelib}/%{srcname}/

+ %{python3_sitelib}/flit-*.dist-info/

+ %{python3_sitelib}/flit/

+ %{_bindir}/flit

+ 

+ 

+ %files -n python3-%{srcname}-core

+ %license LICENSE

+ %doc flit_core/README.rst

+ %{python3_sitelib}/flit_core-*.dist-info/

+ %{python3_sitelib}/flit_core/

  

  

  %changelog

+ * Sat Dec 14 2019 Miro Hrončok <mhroncok@redhat.com> - 2.1.0-2

+ - Properly package flit-core and restore /usr/bin/flit (#1783610)

+ 

  * Tue Dec 03 2019 Mukundan Ragavan <nonamedotc@fedoraproject.org> - 2.1.0-1

  - Update to 2.1.0

  

no initial comment

Is there a typo in the package name?

What is the point of using %{srcname}? This only makes the code hard to read, pointlessly.

rebased onto 7e0378b

a month ago

BTW when I get the missing test requirements from pypi:

+ py.test-3
============================= test session starts ==============================
platform linux -- Python 3.8.1rc1, pytest-4.6.7, py-1.8.0, pluggy-0.13.0
rootdir: /builddir/build/BUILD/flit-2.1.0
collected 111 items                                                            

flit_core/flit_core/tests/test_build_thyself.py ...                      [  2%]
flit_core/flit_core/tests/test_buildapi.py ....                          [  6%]
flit_core/flit_core/tests/test_common.py .............                   [ 18%]
flit_core/flit_core/tests/test_inifile.py ....................           [ 36%]
flit_core/flit_core/tests/test_sdist.py ...                              [ 38%]
flit_core/flit_core/tests/test_versionno.py .                            [ 39%]
tests/test_build.py ..                                                   [ 41%]
tests/test_command.py ..                                                 [ 43%]
tests/test_find_python_executable.py ....                                [ 46%]
tests/test_inifile.py F.                                                 [ 48%]
tests/test_init.py ........                                              [ 55%]
tests/test_install.py ................                                   [ 70%]
tests/test_installfrom.py .                                              [ 71%]
tests/test_sdist.py .s......                                             [ 78%]
tests/test_tomlify.py .                                                  [ 79%]
tests/test_upload.py .....                                               [ 83%]
tests/test_validate.py .......                                           [ 90%]
tests/test_vcs.py .                                                      [ 90%]
tests/test_wheel.py ..........                                           [100%]

=================================== FAILURES ===================================
___________________________ test_invalid_classifier ____________________________

    def test_invalid_classifier():
        with pytest.raises(ConfigError):
>           read_flit_config(samples_dir / 'invalid_classifier.ini')
E           Failed: DID NOT RAISE <class 'flit_core.inifile.ConfigError'>

tests/test_inifile.py:10: Failed
------------------------------ Captured log call -------------------------------
WARNING  flit_core.inifile:inifile.py:63 The flit.ini metadata format is deprecated; please use a pyproject.toml file instead. Convert with: python3 -m flit.tomlify
WARNING  flit.validate:validate.py:97 Couldn't get list of valid classifiers to check against
=============== 1 failed, 109 passed, 1 skipped in 2.15 seconds ================

I think that's good for now. Will look at @zbyszek's comments.

rebased onto 077a0a0

a month ago

pytest-3 while we're at it.

rebased onto 33c7910

a month ago

As I am rebasing, pagure no longer shows me what you comment.

"as long as"

where was this?

$PWD

for tests? we need to test what we install and pwd doesn't have the proper structure, flit_core is nested (project/module).

rebased onto b940a9d

a month ago

Pull-Request has been merged by nonamedotc

a month ago

As I am rebasing, pagure no longer shows me what you comment.

"as long as"

where was this?

That was in the existing %description.

$PWD
for tests? we need to test what we install and pwd doesn't have the proper structure, flit_core is nested (project/module).

$PWD is a bit nicer and simpler than forking out to pwd with $(pwd). The shell automatically updates the variable.

Probably correct. Not worth bikeshedding.

Yeah, that's why I put a question mark at the end ;)