Remove python2 from scons, libserf (#2264)

This commit is contained in:
Thomas Crain 2022-02-17 20:00:50 -08:00 коммит произвёл GitHub
Родитель 71ed8f4c72
Коммит d7a95c1193
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
3 изменённых файлов: 98 добавлений и 30 удалений

Просмотреть файл

@ -0,0 +1,60 @@
diff -up serf-1.3.9/SConstruct.python3 serf-1.3.9/SConstruct
--- serf-1.3.9/SConstruct.python3 2018-07-02 17:21:47.331685070 +0200
+++ serf-1.3.9/SConstruct 2018-07-02 17:27:12.316413515 +0200
@@ -20,6 +20,8 @@
# ====================================================================
#
+from __future__ import print_function
+
import sys
import os
import re
@@ -166,7 +168,7 @@ env.Append(BUILDERS = {
match = re.search('SERF_MAJOR_VERSION ([0-9]+).*'
'SERF_MINOR_VERSION ([0-9]+).*'
'SERF_PATCH_VERSION ([0-9]+)',
- env.File('serf.h').get_contents(),
+ env.File('serf.h').get_contents().decode('utf-8'),
re.DOTALL)
MAJOR, MINOR, PATCH = [int(x) for x in match.groups()]
env.Append(MAJOR=str(MAJOR))
@@ -183,7 +185,7 @@ CALLOUT_OKAY = not (env.GetOption('clean
unknown = opts.UnknownVariables()
if unknown:
- print 'Warning: Used unknown variables:', ', '.join(unknown.keys())
+ print('Warning: Used unknown variables:', ', '.join(unknown.keys()))
apr = str(env['APR'])
apu = str(env['APU'])
diff -uap serf-1.3.9/build/check.py.python3 serf-1.3.9/build/check.py
--- serf-1.3.9/build/check.py.python3 2015-09-17 13:46:24.000000000 +0100
+++ serf-1.3.9/build/check.py 2018-12-17 11:40:06.524901129 +0000
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/python3
#
# check.py : Run all the test cases.
#
@@ -52,16 +52,16 @@ if __name__ == '__main__':
# Find test responses and run them one by one
for case in glob.glob(testdir + "/testcases/*.response"):
- print "== Testing %s ==" % (case)
+ print("== Testing %s ==" % (case))
try:
subprocess.check_call([SERF_RESPONSE_EXE, case])
except subprocess.CalledProcessError:
- print "ERROR: test case %s failed" % (case)
+ print("ERROR: test case %s failed" % (case))
sys.exit(1)
- print "== Running the unit tests =="
+ print("== Running the unit tests ==")
try:
subprocess.check_call(TEST_ALL_EXE)
except subprocess.CalledProcessError:
- print "ERROR: test(s) failed in test_all"
+ print("ERROR: test(s) failed in test_all")
sys.exit(1)

Просмотреть файл

@ -1,13 +1,15 @@
Summary: A high performance C-based HTTP client library built upon the Apache Portable Runtime (APR) library
Name: libserf
Version: 1.3.9
Release: 7%{?dist}
Release: 8%{?dist}
License: ASL 2.0
URL: https://serf.apache.org/
Group: System Environment/Libraries
Vendor: Microsoft Corporation
Distribution: Mariner
Source0: https://www.apache.org/dist/serf/serf-%{version}.tar.bz2
# Enable building with python3 version of scons (patch courtesy of Fedora 35, license: MIT)
Patch0: %{name}-python3.patch
Requires: openldap
BuildRequires: apr-devel
BuildRequires: apr-util-devel
@ -30,7 +32,7 @@ Requires: %{name} = %{version}
It contains the libraries and header files to create serf applications.
%prep
%setup -q -n serf-%{version}
%autosetup -p1 -n serf-%{version}
%build
scons PREFIX=%{_prefix}
@ -72,19 +74,27 @@ scons check
%changelog
* Tue Nov 30 2021 Mateusz Malisz <mamalisz@microsoft.com> 1.3.9-7
- Add libdb as an explicit requires.
* Thu Feb 17 2022 Thomas Crain <thcrain@microsoft.com> - 1.3.9-8
- Add Fedora patch to enable build with python3
* Tue May 04 2021 Nicolas Ontiveros <niontive@microsoft.com> 1.3.9-6
- Disable test_ssl_handshake
* Mon Dec 07 2020 Andrew Phelps <anphel@microsoft.com> 1.3.9-5
- Fix check tests.
* Sat May 09 2020 Nick Samson <nisamson@microsoft.com> 1.3.9-4
- Added %%license line automatically
* Mon Apr 13 2020 Emre Girgin <mrgirgin@microsoft.com? 1.3.9-3
- Rename the package to libserf.
- Update license. License verified.
* Tue Sep 03 2019 Mateusz Malisz <mamalisz@microsoft.com> 1.3.9-2
- Initial CBL-Mariner import from Photon (license: Apache2).
* Mon Jan 22 2018 Xiaolin Li <xiaolinl@vmware.com> 1.3.9-1
- Initial build. First version
* Tue Nov 30 2021 Mateusz Malisz <mamalisz@microsoft.com> - 1.3.9-7
- Add libdb as an explicit requires.
* Tue May 04 2021 Nicolas Ontiveros <niontive@microsoft.com> - 1.3.9-6
- Disable test_ssl_handshake
* Mon Dec 07 2020 Andrew Phelps <anphel@microsoft.com> - 1.3.9-5
- Fix check tests.
* Sat May 09 2020 Nick Samson <nisamson@microsoft.com> - 1.3.9-4
- Added %%license line automatically
* Mon Apr 13 2020 Emre Girgin <mrgirgin@microsoft.com> - 1.3.9-3
- Rename the package to libserf.
- Update license. License verified.
* Tue Sep 03 2019 Mateusz Malisz <mamalisz@microsoft.com> - 1.3.9-2
- Initial CBL-Mariner import from Photon (license: Apache2).
* Mon Jan 22 2018 Xiaolin Li <xiaolinl@vmware.com> - 1.3.9-1
- Initial build. First version

Просмотреть файл

@ -1,7 +1,6 @@
%{!?python2_sitelib: %define python2_sitelib %(python2 -c "from distutils.sysconfig import get_python_lib;print(get_python_lib())")}
Name: scons
Version: 3.0.1
Release: 5%{?dist}
Release: 6%{?dist}
Summary: An Open Source software construction tool
Group: Development/Tools
License: MIT
@ -9,8 +8,8 @@ URL: http://scons.org
Source0: http://downloads.sourceforge.net/%{name}/%{name}-%{version}.tar.gz
Vendor: Microsoft Corporation
Distribution: Mariner
BuildRequires: python2
Requires: python2
BuildRequires: python3-devel
Requires: python3
BuildArch: noarch
%description
@ -20,27 +19,26 @@ with integrated functionality similar to autoconf/automake and compiler caches s
In short, SCons is an easier, more reliable and faster way to build software.
%prep
%setup -q
%autosetup
%build
python setup.py build
%py3_build
%install
python setup.py install \
--root=%{buildroot} \
--prefix=%{_prefix} \
--standard-lib \
--optimize=1 \
--install-data=%{_datadir}
%{py3_install "--prefix=%{_prefix}" "--standard-lib" "--install-data=%{_datadir}"}
%py3_shebang_fix %{buildroot}%{_bindir}/*
%files
%defattr(-,root,root,-)
%license LICENSE.txt
%{python2_sitelib}/*
%{python3_sitelib}/*
%{_bindir}/*
%{_datadir}/*
%changelog
* Thu Feb 17 2022 Thomas Crain <thcrain@microsoft.com> - 3.0.1-6
- Build with python3 instead of python2
* Thu Dec 16 2021 Pawel Winogrodzki <pawelwi@microsoft.com> - 3.0.1-5
- Removing the explicit %%clean stage.
- License verified.