8000 Update fedora.spec for python2 and python3 handling by nkadel · Pull Request #103 · openSUSE/py2pack · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Update fedora.spec for python2 and python3 handling #103

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 27 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
aa6aca4
Add el.spec template, for RHEL and CentOS
8000 nkadel Jul 21, 2018
7c2bcff
Add template for "el", or CentOS or RHEL, .spec files
nkadel Jul 21, 2018
5e93176
Activate with_python2 and with_python3 settings
nkadel Oct 11, 2018
9a20ac5
Disable Suggests unless dnf exists in fedora.spec
nkadel Oct 11, 2018
a409d3d
Enable split of python2 and python3 packages for RHEL and fedora
nkadel Oct 11, 2018
79a8d1c
Discard el.spec file, simply use fedora.spec
nkadel Oct 11, 2018
f675705
Correct python* naming, activate has_ext_modules checks
nkadel Oct 13, 2018
b2094ca
Re-arrange bin lists of ${script}2, ${script}3, ${script} so python2 …
nkadel Oct 13, 2018
18a0399
fix tests for fedora updates
sebix Oct 13, 2018
9687485
Merge pull request #1 from sebix/nkadel-el
nkadel Oct 14, 2018
6456b94
Do not create python2 links in fedora.spec if python3 is enabled
nkadel Oct 18, 2018
d4d66b0
Update examples/py2pack-fedora.spec to match python2/ython3 split han…
nkadel Oct 18, 2018
637d51d
Lower release number in fedora.spec back to zero
nkadel Oct 18, 2018
c72a852
Restore correct py3_build to fedora.spec
nkadel Oct 18, 2018
4d38d1b
Restore py3_build to test template for fedoraa.spec
nkadel Oct 18, 2018
9ecde89
Use "%{with" consistently
nkadel Oct 18, 2018
be4dfe1
Correct handling of python-provide for fedora.spec and python3
nkadel Oct 21, 2018
8332b28
Add python-setuptools requirements to fedora.spec
nkadel Oct 21, 2018
9c553ff
Replace erroneous srcname with name macro in fedora.spec
nkadel Oct 21, 2018
7f201eb
Snip version python-devel requirements for multiple versions until pr…
nkadel Oct 21, 2018
a2bc558
Add ?dist to release for fedora.spec
nkadel Oct 22, 2018
b2170f7
Use python-, not python2-, for RHEL in fedora.spec
nkadel Nov 10, 2018
3cb8e32
Activate with_python2 settings
nkadel Jul 3, 2019
9b4c8f8
Update python2 and python3 split to only Require components for speci…
nkadel Jul 5, 2019
25bda66
Merge branch 'master' of https://github.com/nkadel/nkadel-py2pack
nkadel Jul 5, 2019
542dc4d
Merge remote-tracking branch 'origin/master' into nkadel-el
nkadel Jul 5, 2019
117bc0f
Merge branch 'master' into nkadel-el
nkadel Jul 5, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
180 changes: 163 additions & 17 deletions py2pack/templates/fedora.spec
Original file line number Diff line number Diff line change
Expand Up @@ -4,59 +4,205 @@
# Copyright (c) {{ year }} {{ user_name }}.
#

Name: python-{{ name }}
# python3_pkgversion macro for EPEL in older RHEL
%{!?python3_pkgversion:%global python3_pkgversion 3}

# Fedora and RHEL split python2 and python3
# Older RHEL requires EPEL and python34 or python36
%global with_python3 1

# Fedora >= 38 no longer publishes python2 by default
%if 0%{?fedora} >= 30
%global with_python2 0
%else
%global with_python2 1
%endif

# Older RHEL does not use dnf, does not support "Suggests"
%if 0%{?fedora} || 0%{?rhel} > 7
%global with_dnf 1
%else
%global with_dnf 0
%endif

%global pypi_name {{ name }}

# Descriptions can get long and clutter .spec file
%global common_description %{expand:
{{ description }}
}

# Common SRPM package
Name: python-%{pypi_name}
Version: {{ version }}
Release: 0
Release: 0%{?dist}
Url: {{ home_page }}
Summary: {{ summary }}
License: {{ license }}
Group: Development/Languages/Python
Source: {{ source_url|replace(version, '%{version}') }}
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildRequires: python-devel {%- if requires_python %} = {{ requires_python }} {% endif %}
# Stop using py2pack macros, use local macros published by Fedora
Source0: https://files.pythonhosted.org/packages/source/%(n=%{pypi_name}; echo ${n:0:1})/%{pypi_name}/%{pypi_name}-%{version}.tar.gz
{%- if not has_ext_modules %}
BuildArch: noarch
{%- endif %}

%description
{{ description }}

%if %{with_python2}
%package -n python2-%{pypi_name}
Version: {{ version }}
Release: 0%{?dist}
Url: {{ home_page }}
Summary: {{ summary }}
License: {{ license }}

BuildRequires: python2-devel
BuildRequires: python2-setuptools
# requires stanza of py2pack
{%- for req in requires %}
BuildRequires: python-{{ req|replace('(','')|replace(')','') }}
Requires: python-{{ req|replace('(','')|replace(')','') }}
BuildRequires: python2-{{ req|replace('(','')|replace(')','') }}
Requires: python2-{{ req|replace('(','')|replace(')','') }}
{%- endfor %}
# install_requires stanza of py2pack
{%- for req in install_requires %}
BuildRequires: python-{{ req|replace('(','')|replace(')','') }}
Requires: python-{{ req|replace('(','')|replace(')','') }}
BuildRequires: python2-{{ req|replace('(','')|replace(')','') }}
Requires: python2-{{ req|replace('(','')|replace(')','') }}
{%- endfor %}
%if %{with_dnf}
{%- if extras_require %}
{%- for reqlist in extras_require.values() %}
{%- for req in reqlist %}
Suggests: python-{{ req|replace('(','')|replace(')','') }}
Suggests: python2-{{ req|replace('(','')|replace(')','') }}
{%- endfor %}
{%- endfor %}
{%- endif %}
%endif # with_dnf
%{?python_provide:%python_provide python2-%{pypi_name}}

%description
%description -n python2-%{pypi_name}
{{ description }}

%endif # with_python2

%if %{with_python3}
%package -n python%{python3_pkgversion}-%{pypi_name}
Version: {{ version }}
Release: 0%{?dist}
Url: {{ home_page }}
Summary: {{ summary }}
License: {{ license }}

# requires stanza of py2pack
{%- for req in requires %}
BuildRequires: python%{python3_pkgversion}-{{ req|replace('(','')|replace(')','') }}
Requires: python%{python3_pkgversion}-{{ req|replace('(','')|replace(')','') }}
{%- endfor %}
# install_requires stanza of py2pack
{%- for req in install_requires %}
BuildRequires: python%{python3_pkgversion}-{{ req|replace('(','')|replace(')','') }}
Requires: python%{python3_pkgversion}-{{ req|replace('(','')|replace(')','') }}
{%- endfor %}
%if %{with_dnf}
{%- if extras_require %}
{%- for reqlist in extras_require.values() %}
{%- for req in reqlist %}
Suggests: python%{python3_pkgversion}-{{ req|replace('(','')|replace(')','') }}
{%- endfor %}
{%- endfor %}
{%- endif %}
%endif # with_dnf
%{?python_provide:%python_provide python%{python3_pkgversion}-%{pypi_name}}

%description -n python%{python3_pkgversion}-%{pypi_name}
{{ description }}

%endif # with_python3

%prep
%setup -q -n {{ name }}-%{version}
%setup -q -n %{pypi_name}-%{version}

%build
{%- if is_extension %}
export CFLAGS="%{optflags}"
{%- endif %}
python setup.py build
%if %{with_python2}
%py2_build
%endif # with_python2

%if %{with_python3}
%py3_build
%endif # with_python3

%install
python setup.py install --prefix=%{_prefix} --root=%{buildroot}
%if %{with_python2}
%py2_install
{%- if scripts %}
{%- for script in scripts %}
%{__mv} $RPM_BUILD_ROOT%{_bindir}/{{ script }} $RPM_BUILD_ROOT%{_bindir}/{{ script }}-%{python2_version}
{%- endfor %}

%if ! %{with_python3}
{%- for script in scripts %}
%{__ln_s} {{ script }}-%{python2_version} $RPM_BUILD_ROOT%{_bindir}/{{ script }}
{%- endfor %}
%endif # ! with_python3
{%- endif %}
%endif # with_python2

%if %{with_python3}
%py3_install
{%- for script in scripts %}
%{__mv} $RPM_BUILD_ROOT%{_bindir}/{{ script }} $RPM_BUILD_ROOT%{_bindir}/{{ script }}-%{python3_version}
%{__ln_s} {{ script }}-%{python3_version} $RPM_BUILD_ROOT%{_bindir}/{{ script }}
{%- endfor %}
%endif # with_python3

%clean
rm -rf %{buildroot}

%files
%if %{with_python2}
%files -n python2-%{pypi_name}
%defattr(-,root,root,-)
{%- if doc_files %}
%doc {{ doc_files|join(" ") }}
{%- endif %}
{%- for script in scripts %}
%{_bindir}/{{ script }}-%{python2_version}
{%- endfor %}
{%- if is_extension %}

%if ! %{with_python3}
# Symlinks for binaries to script-2, only if with_python3 is not enabled
{%- for script in scripts %}
%{_bindir}/{{ script }}
{%- endfor %}
%endif # with_python3
%{python2_archlib}/*
{%- endif %}
{%- if not is_extension %}
%{python2_sitelib}/*
{%- endif %}
%endif # with_python2

%if %{with_python3}
%files -n python%{python3_pkgversion}-%{pypi_name}
%defattr(-,root,root,-)
{%- if doc_files %}
%doc {{ doc_files|join(" ") }}
{%- endif %}
{%- for script in scripts %}
%{_bindir}/{{ script }}-%{python3_version}
{%- endfor %}
{%- for script in scripts %}
%{_bindir}/{{ script }}
{%- endfor %}
%{python_sitelib}/*
{%- if is_extension %}
%{python3_archlib}/*
{%- endif %}
{%- if not is_extension %}
%{python3_sitelib}/*
{%- endif %}
%endif # with_python3

%changelog

Loading
0