From Fedora Project Wiki

No edit summary
No edit summary
Line 6: Line 6:
== BuildRequires ==
== BuildRequires ==


Packages should now BuildRequire python-pip and python-wheel:
Packages will now BuildRequire python-pip and python-wheel:


<pre>
<pre>
Line 16: Line 16:
== Build section ==
== Build section ==


Packages should now use the ''bdist_wheel'' command, instead of ''install'', this will create a wheel in the ''dist'' directory. A minimal build section thus becomes:
Packages will now use the ''bdist_wheel'' command, instead of ''install'', this creates a wheel in the ''dist'' directory. A minimal build section thus becomes:


<pre>
<pre>
Line 31: Line 31:
== Install section ==
== Install section ==


Packages should now use ''pip'' to install the newly created wheel. A minimal install section
Packages will now use ''pip'' to install the newly created wheel. A minimal install section
thus becomes:
thus becomes:


Line 44: Line 44:
</pre>
</pre>


The --strip-file-prefix option is currently downstream only modification that strips given prefix from files in wheel RECORD<ref>https://github.com/pypa/pip/issues/1351</ref>
The --strip-file-prefix option is currently downstream only modification that strips given prefix from files in wheel RECORD.<ref>https://github.com/pypa/pip/issues/1351</ref>


{{Anchor|Files}}
{{Anchor|Files}}
Line 50: Line 50:
== Files section ==
== Files section ==


You may need to add the following entries to the files section:
You may also need to add the following entries to the files section:


<pre>
<pre>

Revision as of 14:30, 22 October 2014

Python Wheels in fedora

Starting with Fedora 22, Python packages will install itself into buildroot via Python wheels[1]. Wheels are the new binary distribution format for python modules, note that as such they are not suitable for use as Source archive. The text below describes the minimal specfile changes needed.

BuildRequires

Packages will now BuildRequire python-pip and python-wheel:

BuildRequires: python-pip
BuildRequires: python-wheel

Build section

Packages will now use the bdist_wheel command, instead of install, this creates a wheel in the dist directory. A minimal build section thus becomes:

%{__python2} setup.py bdist_wheel

%if 0%{?with_python3}
pushd %{py3dir}
%{__python3} setup.py bdist_wheel
popd
%endif

Install section

Packages will now use pip to install the newly created wheel. A minimal install section thus becomes:

%if 0%{?with_python3}
pushd %{py3dir}
pip3 install -I dist/%{python3_wheelname} --root %{buildroot} --strip-file-prefix
popd
%endif

pip2 install -I dist/%{python2_wheelname} --root %{buildroot} --strip-file-prefix

The --strip-file-prefix option is currently downstream only modification that strips given prefix from files in wheel RECORD.[2]

Files section

You may also need to add the following entries to the files section:

%{python2_sitelib}/%{name}-%{version}.dist-info/

%{python3_sitelib}/%{name}-%{version}.dist-info/