remove rhel7 specific code

This commit is contained in:
Miroslav Suchý 2024-07-31 16:55:39 +02:00 committed by Pavel Raiskup
parent a2da091029
commit 15f514291d
2 changed files with 4 additions and 31 deletions

View file

@ -21,31 +21,13 @@ BuildRequires: systemd
Requires: httpd Requires: httpd
Requires: perl(Sys::Syslog) Requires: perl(Sys::Syslog)
%if 0%{?fedora} || 0%{?rhel} > 7
Requires: (dist-git-selinux if selinux-policy-targeted) Requires: (dist-git-selinux if selinux-policy-targeted)
%else
Requires: dist-git-selinux
%endif
Requires: git Requires: git
Requires: git-daemon Requires: git-daemon
Requires: mod_ssl Requires: mod_ssl
Requires: crudini Requires: crudini
Requires(pre): shadow-utils Requires(pre): shadow-utils
%if 0%{?rhel} && 0%{?rhel} < 8
Requires: python-requests
Requires: python-configparser
Requires: python-grokmirror
Requires: fedmsg
BuildRequires: python-nose
BuildRequires: python-nose-parameterized
BuildRequires: python-requests
BuildRequires: python-configparser
# temporary because global Requires doesn't work right now, see the comment below
Requires: moreutils
%else
Requires: python3-requests Requires: python3-requests
Recommends: python3-grokmirror Recommends: python3-grokmirror
Suggests: python3-fedmsg Suggests: python3-fedmsg
@ -60,7 +42,6 @@ BuildRequires: python3-requests
# this should be Requires but see https://bugzilla.redhat.com/show_bug.cgi?id=1833810 # this should be Requires but see https://bugzilla.redhat.com/show_bug.cgi?id=1833810
Recommends: moreutils Recommends: moreutils
%endif
%if 0%{?fedora} && 0%{?fedora} >= 41 %if 0%{?fedora} && 0%{?fedora} >= 41
# The `cgi` module was removed from the Python 3.13 standard library # The `cgi` module was removed from the Python 3.13 standard library

View file

@ -18,13 +18,7 @@ import time
import random import random
from configparser import ConfigParser from configparser import ConfigParser
PY2 = sys.version_info.major == 2 from parameterized import parameterized
if PY2:
NOSE_PARAMETERIZED_NO_WARN=1
from nose_parameterized import parameterized
else:
from parameterized import parameterized
# Path to the actual CGI script that should be tested # Path to the actual CGI script that should be tested
@ -38,9 +32,9 @@ from {http_package} import HTTPServer
from {cgi_package} import CGIHTTPRequestHandler from {cgi_package} import CGIHTTPRequestHandler
s = HTTPServer(('%s', %s), CGIHTTPRequestHandler) s = HTTPServer(('%s', %s), CGIHTTPRequestHandler)
s.handle_request() s.handle_request()
""".format(python="python2" if PY2 else "python3", """.format(python="python3",
http_package="BaseHTTPServer" if PY2 else "http.server", http_package="http.server",
cgi_package="CGIHTTPServer" if PY2 else "http.server") cgi_package="http.server")
# MD5 hash of "hello.txt" and "new.txt" strings used in a few tests # MD5 hash of "hello.txt" and "new.txt" strings used in a few tests
HASH = '2e54144ba487ae25d03a3caba233da71' HASH = '2e54144ba487ae25d03a3caba233da71'
@ -270,8 +264,6 @@ def _copy_tweak(source_file, dest_file, topdir):
with open(source_file) as source: with open(source_file) as source:
with open(dest_file, 'w') as dest: with open(dest_file, 'w') as dest:
for line in source: for line in source:
if PY2 and line == "#!/usr/bin/python3\n":
line = line.replace("python3", "python2")
m = regex.match(line) m = regex.match(line)
if m: if m: