Migrate to python3; rhbz#1533306

This commit is contained in:
Christopher Tubbs 2018-07-18 01:59:18 -04:00
parent dc4d73bb49
commit 4cdd59c42d
2 changed files with 103 additions and 22 deletions

72
python3.patch Normal file
View File

@ -0,0 +1,72 @@
diff --git a/contrib/fb303/py/fb303_scripts/fb303_simple_mgmt.py b/contrib/fb303/py/fb303_scripts/fb303_simple_mgmt.py
index 4b1c257..df1c8cc 100644
--- a/contrib/fb303/py/fb303_scripts/fb303_simple_mgmt.py
+++ b/contrib/fb303/py/fb303_scripts/fb303_simple_mgmt.py
@@ -57,24 +57,24 @@ def service_ctrl(
msg = fb_status_string(status)
if (len(status_details)):
msg += " - %s" % status_details
- print msg
+ print(msg)
if (status == fb_status.ALIVE):
return 2
else:
return 3
except:
- print "Failed to get status"
+ print("Failed to get status")
return 3
# scalar commands
if command in ["version", "alive", "name"]:
try:
result = fb303_wrapper(command, port, trans_factory, prot_factory)
- print result
+ print(result)
return 0
except:
- print "failed to get ", command
+ print("failed to get ", command)
return 3
# counters
@@ -82,10 +82,10 @@ def service_ctrl(
try:
counters = fb303_wrapper('counters', port, trans_factory, prot_factory)
for counter in counters:
- print "%s: %d" % (counter, counters[counter])
+ print("%s: %d" % (counter, counters[counter]))
return 0
except:
- print "failed to get counters"
+ print("failed to get counters")
return 3
# Only root should be able to run the following commands
@@ -96,19 +96,19 @@ def service_ctrl(
fb303_wrapper(command, port, trans_factory, prot_factory)
return 0
except:
- print "failed to tell the service to ", command
+ print("failed to tell the service to ", command)
return 3
else:
if command in ["stop", "reload"]:
- print "root privileges are required to stop or reload the service."
+ print("root privileges are required to stop or reload the service.")
return 4
- print "The following commands are available:"
+ print("The following commands are available:")
for command in ["counters", "name", "version", "alive", "status"]:
- print "\t%s" % command
- print "The following commands are available for users with root privileges:"
+ print("\t%s" % command)
+ print("The following commands are available for users with root privileges:")
for command in ["stop", "reload"]:
- print "\t%s" % command
+ print("\t%s" % command)
return 0

View File

@ -1,7 +1,7 @@
%global php_extdir %(php-config --extension-dir 2>/dev/null || echo "undefined") %global php_extdir %(php-config --extension-dir 2>/dev/null || echo "undefined")
%{?perl_default_filter} %{?perl_default_filter}
%global __provides_exclude_from ^(%{python2_sitearch}/.*\\.so|%{php_extdir}/.*\\.so)$ %global __provides_exclude_from ^(%{python3_sitearch}/.*\\.so|%{php_extdir}/.*\\.so)$
%global have_mongrel 0 %global have_mongrel 0
@ -50,7 +50,7 @@
Name: thrift Name: thrift
Version: 0.10.0 Version: 0.10.0
Release: 13%{?dist} Release: 14%{?dist}
Summary: Software framework for cross-language services development Summary: Software framework for cross-language services development
# Parts of the source are used under the BSD and zlib licenses, but # Parts of the source are used under the BSD and zlib licenses, but
@ -81,6 +81,9 @@ Patch3: fix-ppc64le-builds.patch
# fix for s390x build; incorporates fix for THRIFT-4177 with some code from THRIFT-4136 # fix for s390x build; incorporates fix for THRIFT-4177 with some code from THRIFT-4136
Patch4: THRIFT-4177.patch Patch4: THRIFT-4177.patch
# Update fb303 for python3
Patch5: python3.patch
Group: Development/Libraries Group: Development/Libraries
# BuildRequires for language-specific bindings are listed under these # BuildRequires for language-specific bindings are listed under these
@ -141,15 +144,16 @@ Requires: %{name}%{?_isa} = %{version}-%{release}
%description glib %description glib
The %{name}-qt package contains GLib bindings for %{name}. The %{name}-qt package contains GLib bindings for %{name}.
%package -n python2-%{name} %package -n python3-%{name}
Summary: Python 2 support for %{name} Summary: Python 3 support for %{name}
BuildRequires: python2-devel BuildRequires: python3-devel
Requires: %{name}%{?_isa} = %{version}-%{release} Requires: %{name}%{?_isa} = %{version}-%{release}
Requires: python2 Requires: python3
Obsoletes: python-%{name} < 0.10.0-1%{?dist} Obsoletes: python-%{name} < 0.10.0-1%{?dist}
Obsoletes: python2-%{name} < 0.10.0-14%{?dist}
%description -n python2-%{name} %description -n python3-%{name}
The python2-%{name} package contains Python bindings for %{name}. The python3-%{name} package contains Python bindings for %{name}.
%package -n perl-%{name} %package -n perl-%{name}
Summary: Perl support for %{name} Summary: Perl support for %{name}
@ -278,14 +282,15 @@ Requires: fb303%{?_isa} = %{version}-%{release}
%description -n fb303-devel %description -n fb303-devel
The fb303-devel package contains header files for fb303 The fb303-devel package contains header files for fb303
%package -n python2-fb303 %package -n python3-fb303
Summary: Python 2 bindings for fb303 Summary: Python 3 bindings for fb303
Requires: fb303%{?_isa} = %{version}-%{release} Requires: fb303%{?_isa} = %{version}-%{release}
BuildRequires: python2-devel BuildRequires: python3-devel
Obsoletes: python-fb303 < 0.10.0-1%{?dist} Obsoletes: python-fb303 < 0.10.0-1%{?dist}
Obsoletes: python2-fb303 < 0.10.0-14%{?dist}
%description -n python2-fb303 %description -n python3-fb303
The python2-fb303 package contains Python bindings for fb303. The python3-fb303 package contains Python bindings for fb303.
%package -n fb303-java %package -n fb303-java
Summary: Java bindings for fb303 Summary: Java bindings for fb303
@ -369,7 +374,8 @@ install: build/libfb303.jar
sh ./bootstrap.sh sh ./bootstrap.sh
# use unversioned doc dirs where appropriate (via _pkgdocdir macro) # use unversioned doc dirs where appropriate (via _pkgdocdir macro)
%configure --disable-dependency-tracking --disable-static --with-boost=/usr %{ruby_configure} %{erlang_configure} %{golang_configure} %{php_configure} --docdir=%{?_pkgdocdir}%{!?_pkgdocdir:%{_docdir}/%{name}-%{version}} export PYTHON=%{_bindir}/python3
%configure --disable-dependency-tracking --disable-static --with-boost=/usr %{ruby_configure} %{erlang_configure} %{golang_configure} %{php_configure} --with-py3 --docdir=%{?_pkgdocdir}%{!?_pkgdocdir:%{_docdir}/%{name}-%{version}}
# eliminate unused direct shlib dependencies # eliminate unused direct shlib dependencies
sed -i -e 's/ -shared / -Wl,--as-needed\0/g' libtool sed -i -e 's/ -shared / -Wl,--as-needed\0/g' libtool
@ -381,7 +387,7 @@ make %{?_smp_mflags}
cd contrib/fb303 cd contrib/fb303
sed -i '/^[.][/]configure.*/d' bootstrap.sh sed -i '/^[.][/]configure.*/d' bootstrap.sh
sh bootstrap.sh sh bootstrap.sh
%configure --disable-static --with-java --without-php --libdir=%{_libdir} %configure --disable-static --with-java --without-php --with-py3 --libdir=%{_libdir}
make %{?_smp_mflags} make %{?_smp_mflags}
( (
cd java cd java
@ -495,9 +501,9 @@ find %{buildroot} -name \*.py -exec grep -q /usr/bin/env {} \; -print | xargs -r
%doc LICENSE NOTICE %doc LICENSE NOTICE
%endif %endif
%files -n python2-%{name} %files -n python3-%{name}
%{python2_sitearch}/%{name} %{python3_sitearch}/%{name}
%{python2_sitearch}/%{name}-%{version}-py%{python2_version}.egg-info %{python3_sitearch}/%{name}-%{version}-py%{python3_version}.egg-info
%doc LICENSE NOTICE %doc LICENSE NOTICE
%files -n lib%{name}-javadoc %files -n lib%{name}-javadoc
@ -516,16 +522,19 @@ find %{buildroot} -name \*.py -exec grep -q /usr/bin/env {} \; -print | xargs -r
%{_includedir}/thrift/fb303 %{_includedir}/thrift/fb303
%doc LICENSE NOTICE %doc LICENSE NOTICE
%files -n python2-fb303 %files -n python3-fb303
%{python2_sitelib}/fb303 %{python3_sitelib}/fb303
%{python2_sitelib}/fb303_scripts %{python3_sitelib}/fb303_scripts
%{python2_sitelib}/%{name}_fb303-%{version}-py%{python2_version}.egg-info %{python3_sitelib}/%{name}_fb303-%{version}-py%{python3_version}.egg-info
%doc LICENSE NOTICE %doc LICENSE NOTICE
%files -n fb303-java -f .mfiles-fb303 %files -n fb303-java -f .mfiles-fb303
%doc LICENSE NOTICE %doc LICENSE NOTICE
%changelog %changelog
* Wed Jul 18 2018 Christopher Tubbs <ctubbsii@fedoraproject.org> - 0.10.0-14
- Migrate to python3; rhbz#1533306
* Sat Jul 14 2018 Fedora Release Engineering <releng@fedoraproject.org> - 0.10.0-13 * Sat Jul 14 2018 Fedora Release Engineering <releng@fedoraproject.org> - 0.10.0-13
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild - Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild