#3 Make this buildable on Fedora 31
Merged 5 years ago by churchyard. Opened 5 years ago by churchyard.
rpms/ churchyard/python-fedora f31-build  into  master

file modified
+36 -46
@@ -3,10 +3,6 @@ 

  %global py3dir ../python3

  %endif

  

- %if 0%{?rhel} && 0%{?rhel} <= 6

- %{!?__python2:        %global __python2 /usr/bin/python2}

- %{!?python2_sitelib:  %global python2_sitelib %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")}

- %endif

  #%%global prerel c2

  

  %global desc Python modules that help with building Fedora Services.  The client module\
@@ -25,30 +21,31 @@ 

  URL:            https://github.com/fedora-infra/python-fedora

  Source0:        https://github.com/fedora-infra/%{name}/releases/download/%{version}/%{name}-%{version}.tar.gz

  

+ BuildRequires:  python2-devel

+ %if 0%{?fedora}

+ BuildRequires:  python2-lockfile

+ BuildRequires:  python2-munch

+ BuildRequires:  python2-openid

+ BuildRequires:  python2-openid-cla

+ BuildRequires:  python2-openid-teams

+ %else

  BuildRequires:  python-lockfile

  BuildRequires:  python-munch

  BuildRequires:  python-openid

  BuildRequires:  python-openid-cla

  BuildRequires:  python-openid-teams

- BuildRequires:  python2-devel

+ %endif

  

  %if 0%{?rhel} == 6

  BuildRequires:  python-sphinx10

  %else

- %if 0%{?fedora} >= 24

- BuildRequires:  python2-sphinx

- %else

+ %if 0%{?rhel} <= 7 && 0%{?fedora} <= 30

  BuildRequires:  python-sphinx

  %endif

  %endif

  

- %if 0%{?fedora} || (0%{?rhel} >= 7)

+ %if (0%{?fedora} && (0%{?fedora} <= 30)) || (0%{?rhel} >= 7)

  BuildRequires:  python-cherrypy2

- %else

- # Do not need TurboGears1 dependencies on epel7

- %if 0%{?rhel} && 0%{?rhel} < 7

- BuildRequires:  python-cherrypy

- %endif

  %endif

  

  # Needed for tests and for the way we build docs
@@ -57,25 +54,22 @@ 

  BuildRequires: TurboGears

  %endif

  

- %if 0%{?fedora} >= 24

+ %if 0%{?fedora}

  BuildRequires:  python2-babel

  BuildRequires:  python2-nose

  BuildRequires:  python2-requests >= 2.6.0

  BuildRequires:  python2-setuptools

- %if 0%{?fedora} >= 26

  BuildRequires:  python2-kitchen

  BuildRequires:  python2-six

  %else

- BuildRequires:  python-kitchen

- BuildRequires:  python-six

- %endif

- %else

  BuildRequires:  python-babel

  BuildRequires:  python-kitchen

  BuildRequires:  python-nose

  BuildRequires:  python-requests >= 2.6.0

  BuildRequires:  python-setuptools

  BuildRequires:  python-six

+ BuildRequires:  python-kitchen

+ BuildRequires:  python-six

  %endif

  

  %if 0%{?with_python3}
@@ -100,28 +94,30 @@ 

  %package -n python2-fedora

  Summary:        %{summary}

  

+ %if 0%{?fedora}

+ Requires:       python2-beautifulsoup4

+ Requires:       python2-lockfile

+ Requires:       python2-munch

+ %else

  Requires:       python-beautifulsoup4

  Requires:       python-lockfile

  Requires:       python-munch

+ %endif

+ 

  # These are now optional dependencies.  Some bodhi methods will not work if

  # they aren't installed but they aren't needed for most functionality of the

  # module.

  #Requires:       koji python-iniparse yum

  

- %if 0%{?fedora} >= 24

+ %if 0%{?fedora}

  Requires:       python2-openidc-client

  Requires:       python2-requests >= 2.6.0

- %if 0%{?fedora} >= 26

  Requires:       python2-kitchen

  Requires:       python2-six

  %else

- Requires:       python-kitchen

- Requires:       python-six

- %endif

- %else

- Requires:       python-kitchen

  Requires:       python-openidc-client

  Requires:       python-requests >= 2.6.0

+ Requires:       python-kitchen

  Requires:       python-six

  %endif

  
@@ -181,18 +177,8 @@ 

  Requires: python-bugzilla

  Requires: python-feedparser

  Requires: python2-fedora = %{version}-%{release}

- 

- %if 0%{?fedora} >= 24

- Requires: python2-decorator

- %if 0%{?fedora} >= 26

- Requires: python2-sqlalchemy

- %else

- Requires: python-sqlalchemy

- %endif

- %else

  Requires: python-decorator

  Requires: python-sqlalchemy

- %endif

  

  %{?python_provide:%python_provide python2-fedora-turbogears}

  
@@ -210,17 +196,20 @@ 

  Summary: Python modules for flask applications authing to Fedora Account System

  License:        LGPLv2+

  

+ %if 0%{?fedora}

+ Requires: python2-flask-wtf

+ Requires: python2-openid

+ Requires: python2-openid-cla

+ Requires: python2-openid-teams

+ Requires: python2-flask

+ %else

  Requires: python-flask-wtf

  Requires: python-openid

  Requires: python-openid-cla

  Requires: python-openid-teams

- Requires: python2-fedora = %{version}-%{release}

- 

- %if 0%{?fedora} >= 25

- Requires: python2-flask

- %else

  Requires: python-flask

  %endif

+ Requires: python2-fedora = %{version}-%{release}

  

  %{?python_provide:%python_provide python2-fedora-flask}

  
@@ -272,7 +261,8 @@ 

  %endif

  

  pushd python2

- %if 0%{?rhel} != 6

+ %if (0%{?rhel} != 6) && (0%{?fedora} < 31)

+ ## No docs. Sphinx 2 in Fedora 31+ doesn't support Python 2

  %{__python2} setup_docs.py build_sphinx

  %endif

  %{__python2} releaseutils.py build_catalogs
@@ -297,7 +287,7 @@ 

  DESTDIR=%{buildroot} %{__python2} releaseutils.py install_catalogs

  

  # Cleanup doc

- %if 0%{?rhel} != 6

+ %if (0%{?rhel} != 6) && (0%{?fedora} < 31)

  mv build/sphinx/html doc/

  if test -e doc/html/.buildinfo ; then

    rm doc/html/.buildinfo
@@ -315,7 +305,7 @@ 

  %files -f python2/%{name}.lang -n python2-fedora

  %license python2/COPYING

  %doc python2/NEWS python2/README.rst python2/AUTHORS

- %if 0%{?rhel} != 6

+ %if (0%{?rhel} != 6) && (0%{?fedora} < 31)

  %doc python2/doc

  %endif

  %{python2_sitelib}/fedora/
@@ -329,7 +319,7 @@ 

  %files -f python2/%{name}.lang -n python3-fedora

  %license python3/COPYING

  %doc python2/NEWS python2/README.rst python2/AUTHORS

- %if 0%{?rhel} != 6

+ %if (0%{?rhel} != 6) && (0%{?fedora} < 31)

  %doc python2/doc

  %endif

  %{python3_sitelib}/fedora/

I've tried to preserve the logic, but haven't tested this elsewhere.

(Honestly, this specfile is a jungle of ifs, commented out blocks and total madness.)

rebased onto 9089b39

5 years ago

Yeah, this spec is quite a maze. ;)

I'm fine with pushing this to at least rawhide and we can add further fixes on top... thanks for poking at it.

Pull-Request has been merged by churchyard

5 years ago