No edit summary |
No edit summary |
||
Line 3: | Line 3: | ||
Starting with Fedora 22, Python packages will have the option to install itself into buildroot via Python wheels.<ref>http://legacy.python.org/dev/peps/pep-0427/</ref> Wheels are the new binary distribution format for python modules, note that as such they are not suitable for use as Source archive. | Starting with Fedora 22, Python packages will have the option to install itself into buildroot via Python wheels.<ref>http://legacy.python.org/dev/peps/pep-0427/</ref> Wheels are the new binary distribution format for python modules, note that as such they are not suitable for use as Source archive. | ||
Unless you have a good reason to use this method of installation, please use the one specified in [[Packaging:Python]]. Currently, installing with wheels uses a fedora-specific pip option<ref>https://github.com/fedora-python/rewheel/blob/92fd4dd0f14fb007323d8032b3dc9e1bd6a662bd/python-pip-spec.patch#L100</ref> | Unless you have a good reason to use this method of installation, please use the one specified in [[Packaging:Python]]. Currently, installing with wheels uses a fedora-specific pip option<ref>https://github.com/fedora-python/rewheel/blob/92fd4dd0f14fb007323d8032b3dc9e1bd6a662bd/python-pip-spec.patch#L100</ref> that upstream may eventually implement in a different way. | ||
The text below describes the minimal specfile changes needed, if installation with wheel is desired. | The text below describes the minimal specfile changes needed, if installation with wheel is desired. |
Revision as of 10:54, 23 October 2014
Python Wheels in fedora
Starting with Fedora 22, Python packages will have the option to 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.
Unless you have a good reason to use this method of installation, please use the one specified in Packaging:Python. Currently, installing with wheels uses a fedora-specific pip option[2] that upstream may eventually implement in a different way.
The text below describes the minimal specfile changes needed, if installation with wheel is desired.
BuildRequires
The package has to BuildRequire python?-pip and python?-wheel:
BuildRequires: python-pip BuildRequires: python-wheel %if %{?with_python3} BuildRequires: python3-pip BuildRequires: python3-wheel %endif
Build section
The package has to 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
Tha package has to 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.[3]
Files section
Unless covered by an already existing glob, 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/