From 359c9122a3e653eef7bdc03df9a029ffb71a2062 Mon Sep 17 00:00:00 2001 From: Pavel Raiskup Date: Fri, 22 Jul 2016 12:22:15 +0200 Subject: [PATCH 1/2] try to package as SCL There are still python2 issues, but it works as an example. Version: 0.11-7.git3459d --- pybugz-0.11-7.git3459d-python2.patch | 62 ++++++++++++++++++++++++++++ pybugz.spec | 47 +++++++++++++++------ 2 files changed, 97 insertions(+), 12 deletions(-) create mode 100644 pybugz-0.11-7.git3459d-python2.patch diff --git a/pybugz-0.11-7.git3459d-python2.patch b/pybugz-0.11-7.git3459d-python2.patch new file mode 100644 index 0000000..8670f06 --- /dev/null +++ b/pybugz-0.11-7.git3459d-python2.patch @@ -0,0 +1,62 @@ +diff --git a/bin/bugz b/bin/bugz +index c7b6c46..1e09412 100755 +--- a/bin/bugz ++++ b/bin/bugz +@@ -19,7 +19,7 @@ Classes + """ + + import argparse +-import configparser ++from six.moves import configparser + import sys + + from bugz.argparsers import make_parser +diff --git a/bugz/cli.py b/bugz/cli.py +index 94842f2..8f7a862 100644 +--- a/bugz/cli.py ++++ b/bugz/cli.py +@@ -4,7 +4,7 @@ import re + import subprocess + import sys + import textwrap +-import xmlrpc.client ++from six.moves import xmlrpc_client + + try: + import readline +diff --git a/bugz/configfile.py b/bugz/configfile.py +index 9d54946..f5d4ea5 100644 +--- a/bugz/configfile.py ++++ b/bugz/configfile.py +@@ -1,4 +1,4 @@ +-import configparser ++from six.moves import configparser + import glob + import os + import sys +diff --git a/bugz/connection.py b/bugz/connection.py +index bdf5734..934a523 100644 +--- a/bugz/connection.py ++++ b/bugz/connection.py +@@ -1,8 +1,8 @@ + import os + import sys +-import urllib.error +-import urllib.parse +-import xmlrpc.client ++from six.moves import urllib_error ++from six.moves import urllib_parse ++from six.moves import xmlrpc_client + + from bugz.configfile import get_config_option + from bugz.errhandling import BugzError +diff --git a/bugz/tokens.py b/bugz/tokens.py +index b39e3b5..59d2ccd 100644 +--- a/bugz/tokens.py ++++ b/bugz/tokens.py +@@ -1,4 +1,4 @@ +-import configparser ++from six.moves import configparser + import os + + diff --git a/pybugz.spec b/pybugz.spec index b0c691b..99df1e0 100644 --- a/pybugz.spec +++ b/pybugz.spec @@ -1,20 +1,29 @@ +%{?scl:%scl_package pybugz} + +%{?python_sitelib_scl:%global python_sitelib %python_sitelib_scl} + +%global scl_enable() \ + scl enable %** - <<'_SCL_EOF' \ + set -x +%global scl_disable() _SCL_EOF + %global gitrev 3459d %global posttag git%{gitrev} %global snapshot %{version}-%{posttag} -Name: pybugz +Name: %{?scl_prefix}pybugz Summary: Command line interface for Bugzilla written in Python Version: 0.11 Release: 7.%{posttag}%{?dist} Group: Applications/Communications License: GPLv2 URL: https://github.com/williamh/pybugz -BuildArch: noarch -Requires: python3 -BuildRequires: python3-devel +Requires: python2 +Requires: python-six +BuildRequires: python2-devel +%{?scl:Requires:%scl_runtime} -Patch0: rh-default.patch %if ! 0%{?rhel} # no bash-completion for RHEL @@ -28,7 +37,13 @@ BuildRequires: bash-completion pkgconfig # There is possible to download upstream tarball generated by github, but it is # quite old now. For HOWTO obtain correct tarball see the "prepare-tarball.sh" # script (in dist-git). -Source0: %{name}-%{snapshot}.tar.gz +Source0: %{?scl:%{pkg_name}}%{!?scl:%{name}}-%{snapshot}.tar.gz + +Patch1: rh-default.patch +Patch2: pybugz-0.11-7.git3459d-python2.patch + +# Bug in yum, rhbz#1359084. +BuildArch: noarch %description Pybugz was conceived as a tool to speed up the work-flow for Gentoo Linux @@ -38,14 +53,19 @@ quickly. Developers alike can easily extract attachments and close bugs comfortably from the command line. %prep -%autosetup -p1 -n %{name}-%{snapshot} +%autosetup -p1 -n %{?scl:%pkg_name-%snapshot}%{?!scl:%name-%snapshot} + %build -%{__python3} setup.py build +%scl_enable %{scl} +%{__python2} setup.py build +%scl_disable %install -# default install process -%{__python3} setup.py install --root=%{buildroot} +%scl_enable %{scl} +%{__python} setup.py install --root=%{buildroot} --prefix=%{_prefix} +%scl_disable + %global bash_cmpl_dir %(pkg-config --variable=completionsdir bash-completion) %if 0%{?bash_completion} @@ -63,17 +83,20 @@ mkdir -p %{buildroot}%{_docdir} %files %{_bindir}/bugz -%{python3_sitelib}/bugz +%{python_sitelib}/bugz %if 0%{?bash_completion} %{bash_cmpl_dir}/bugz %endif -%{python3_sitelib}/%{name}-*.egg-info +%{python_sitelib}/%{?scl:%pkg_name}%{!?scl:%{name}}-*.egg-info %{_mandir}/man1/bugz.1.gz %{_datadir}/pybugz.d/ %{_mandir}/man5/* %doc README LICENSE %changelog +* Wed Jul 20 2016 Pavel Raiskup - 0.11-7.git3459d +- fun with scls + * Tue Jul 19 2016 Fedora Release Engineering - 0.11-7.git3459d - https://fedoraproject.org/wiki/Changes/Automatic_Provides_for_Python_RPM_Packages From 8df180493254b02603a1529011ea6b4a771601e5 Mon Sep 17 00:00:00 2001 From: Pavel Raiskup Date: Tue, 26 Jul 2016 19:29:26 +0200 Subject: [PATCH 2/2] fun with scl #2 - simplification - We expect %python_sitelib is hacked by %scl_package_override macro - we also rely on the fact that %scl_enable is defined %scl_package (or %scl_package_override) Version: 0.11-7.git3459d --- pybugz.spec | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/pybugz.spec b/pybugz.spec index 99df1e0..38dea19 100644 --- a/pybugz.spec +++ b/pybugz.spec @@ -1,12 +1,5 @@ %{?scl:%scl_package pybugz} -%{?python_sitelib_scl:%global python_sitelib %python_sitelib_scl} - -%global scl_enable() \ - scl enable %** - <<'_SCL_EOF' \ - set -x -%global scl_disable() _SCL_EOF - %global gitrev 3459d %global posttag git%{gitrev} %global snapshot %{version}-%{posttag} @@ -57,14 +50,14 @@ comfortably from the command line. %build -%scl_enable %{scl} +%{?scl_enable} %{__python2} setup.py build -%scl_disable +%{?scl_disable} %install -%scl_enable %{scl} +%{?scl_enable} %{__python} setup.py install --root=%{buildroot} --prefix=%{_prefix} -%scl_disable +%{?scl_disable} %global bash_cmpl_dir %(pkg-config --variable=completionsdir bash-completion)