From 0d6d63fa52d21b78dd79fb238a7be7494899db73 Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Tue, 28 Apr 2020 04:54:36 -0400 Subject: [PATCH] import libbytesize-1.4-3.el8 --- .gitignore | 1 + .libbytesize.metadata | 1 + SOURCES/libbytesize-potfile.patch | 203 +++++++++++++++++ SOURCES/libbytesize-tests.patch | 352 ++++++++++++++++++++++++++++++ SPECS/libbytesize.spec | 310 ++++++++++++++++++++++++++ 5 files changed, 867 insertions(+) create mode 100644 .gitignore create mode 100644 .libbytesize.metadata create mode 100644 SOURCES/libbytesize-potfile.patch create mode 100644 SOURCES/libbytesize-tests.patch create mode 100644 SPECS/libbytesize.spec diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..d1bf9b1 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +SOURCES/libbytesize-1.4.tar.gz diff --git a/.libbytesize.metadata b/.libbytesize.metadata new file mode 100644 index 0000000..a147076 --- /dev/null +++ b/.libbytesize.metadata @@ -0,0 +1 @@ +ef29982499abeeeeffc71cfa500eea15ab64ceb5 SOURCES/libbytesize-1.4.tar.gz diff --git a/SOURCES/libbytesize-potfile.patch b/SOURCES/libbytesize-potfile.patch new file mode 100644 index 0000000..10fcb61 --- /dev/null +++ b/SOURCES/libbytesize-potfile.patch @@ -0,0 +1,203 @@ +From ee80e25d87b00236bae9f4d37cd5232bcb995f17 Mon Sep 17 00:00:00 2001 +From: Vojtech Trefny +Date: Tue, 29 Oct 2019 10:09:13 +0100 +Subject: [PATCH] Add POT file to git and do not rebuild it during every build + +This fixes bug with multilib packages in Fedora/RHEL -- we don't +have a special package for translation files so we need to make +sure the files are exactly same for every architecture. With POT +file being generated during build the generated MO files are +different because they contain timestamp from the POT file. +POT file is now automatically updated during 'make bumpver'. +--- + Makefile.am | 1 + + po/Makefile.am | 12 ++--- + po/libbytesize.pot | 103 +++++++++++++++++++++++++++++++++++++++ + tests/canary_tests.sh.in | 9 +--- + 4 files changed, 111 insertions(+), 14 deletions(-) + create mode 100644 po/libbytesize.pot + +diff --git a/Makefile.am b/Makefile.am +index ce06f1f..185d754 100644 +--- a/Makefile.am ++++ b/Makefile.am +@@ -97,6 +97,7 @@ bumpver: + mv dist/libbytesize.spec.in.new dist/libbytesize.spec.in ; rm -f speclog ; \ + sed -ri "s/(AC_INIT\(\[$(PACKAGE_NAME)\], \[)[0-9]+\.[0-9]+(\],.*)/\1$$VERSION.$$NEWSUBVERSION\2/" configure.ac ; \ + sed -ri "s/Version:(\\s+)[-0-9.]+/Version:\\1$$VERSION.$$NEWSUBVERSION/" dist/libbytesize.spec.in ; ++ $(MAKE) -C po/ $(PACKAGE_NAME).pot-update + + archive: po-pull + $(MAKE) distcheck +diff --git a/po/Makefile.am b/po/Makefile.am +index 5c288ab..de4ad7d 100644 +--- a/po/Makefile.am ++++ b/po/Makefile.am +@@ -161,12 +161,12 @@ MSGMERGE_V_OPTIONS_1 = $(MSGMERGE_OPTIONS) --verbose + + # Actually do stuff: + # .po files get distributed but not installed +-dist_noinst_DATA = $(POFILES) ++dist_noinst_DATA = $(POFILES) $(POTFILE) + + # Build the .mo files but don't actually do anything with them. The real + # install part is in the install-data-local target below. Build the .pot file + # as well, even if there are no .mo files to build, so it can be tested. +-nodist_noinst_DATA = $(MOFILES) $(POTFILE) ++nodist_noinst_DATA = $(MOFILES) + + # How to build the .pot file. This needs to be regenerated if anything that + # goes into it has changed. +@@ -181,13 +181,13 @@ $(PACKAGE).pot-update: + @$(MAKE) $(POTFILE) + + # How to build the merged .mpo files from the .po files +-$(MERGED_POFILES): $(POFILES) $(POTFILE) ++$(MERGED_POFILES): $(POFILES) + + .po.mpo: +- $(GETTEXT_V_MERGE)$(MSGMERGE) $(MSGMERGE_V_OPTIONS) -o $@ $< $(POTFILE) ++ $(GETTEXT_V_MERGE)$(MSGMERGE) $(MSGMERGE_V_OPTIONS) -o $@ $< $(top_srcdir)/po/$(POTFILE) + + # How to build the .mo files from the .mpo files +-$(MOFILES): $(MERGED_POFILES) ++$(MOFILES): $(MERGED_POFILES) $(POTFILE) + + .mpo.mo: + $(GETTEXT_V_FORMAT)$(MSGFMT) $(MSGFMT_V_OPTIONS) -o $@ $< +@@ -210,4 +210,4 @@ uninstall-local: + rm -f $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(PACKAGE).mo ; \ + done + +-CLEANFILES = $(MERGED_POFILES) $(MOFILES) $(POTFILE) ++CLEANFILES = $(MERGED_POFILES) $(MOFILES) +diff --git a/po/libbytesize.pot b/po/libbytesize.pot +new file mode 100644 +index 0000000..5431896 +--- /dev/null ++++ b/po/libbytesize.pot +@@ -0,0 +1,103 @@ ++# SOME DESCRIPTIVE TITLE. ++# Copyright (C) YEAR Red Hat, Inc. ++# This file is distributed under the same license as the libbytesize package. ++# FIRST AUTHOR , YEAR. ++# ++#, fuzzy ++msgid "" ++msgstr "" ++"Project-Id-Version: libbytesize 2.1\n" ++"Report-Msgid-Bugs-To: anaconda-devel-list@redhat.com\n" ++"POT-Creation-Date: 2019-10-29 12:28+0100\n" ++"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" ++"Last-Translator: FULL NAME \n" ++"Language-Team: LANGUAGE \n" ++"Language: \n" ++"MIME-Version: 1.0\n" ++"Content-Type: text/plain; charset=CHARSET\n" ++"Content-Transfer-Encoding: 8bit\n" ++ ++#. TRANSLATORS: 'B' for bytes ++#: src/bs_size.c:52 src/bs_size.c:73 ++msgid "B" ++msgstr "" ++ ++#. TRANSLATORS: abbreviation for kibibyte, 2**10 bytes ++#: src/bs_size.c:54 ++msgid "KiB" ++msgstr "" ++ ++#. TRANSLATORS: abbreviation for mebibyte, 2**20 bytes ++#: src/bs_size.c:56 ++msgid "MiB" ++msgstr "" ++ ++#. TRANSLATORS: abbreviation for gibibyte, 2**30 bytes ++#: src/bs_size.c:58 ++msgid "GiB" ++msgstr "" ++ ++#. TRANSLATORS: abbreviation for tebibyte, 2**40 bytes ++#: src/bs_size.c:60 ++msgid "TiB" ++msgstr "" ++ ++#. TRANSLATORS: abbreviation for pebibyte, 2**50 bytes ++#: src/bs_size.c:62 ++msgid "PiB" ++msgstr "" ++ ++#. TRANSLATORS: abbreviation for exbibyte, 2**60 bytes ++#: src/bs_size.c:64 ++msgid "EiB" ++msgstr "" ++ ++#. TRANSLATORS: abbreviation for zebibyte, 2**70 bytes ++#: src/bs_size.c:66 ++msgid "ZiB" ++msgstr "" ++ ++#. TRANSLATORS: abbreviation for yobibyte, 2**80 bytes ++#: src/bs_size.c:68 ++msgid "YiB" ++msgstr "" ++ ++#. TRANSLATORS: abbreviation for kilobyte, 10**3 bytes ++#: src/bs_size.c:75 ++msgid "KB" ++msgstr "" ++ ++#. TRANSLATORS: abbreviation for megabyte, 10**6 bytes ++#: src/bs_size.c:77 ++msgid "MB" ++msgstr "" ++ ++#. TRANSLATORS: abbreviation for gigabyte, 10**9 bytes ++#: src/bs_size.c:79 ++msgid "GB" ++msgstr "" ++ ++#. TRANSLATORS: abbreviation for terabyte, 10**12 bytes ++#: src/bs_size.c:81 ++msgid "TB" ++msgstr "" ++ ++#. TRANSLATORS: abbreviation for petabyte, 10**15 bytes ++#: src/bs_size.c:83 ++msgid "PB" ++msgstr "" ++ ++#. TRANSLATORS: abbreviation for exabyte, 10**18 bytes ++#: src/bs_size.c:85 ++msgid "EB" ++msgstr "" ++ ++#. TRANSLATORS: abbreviation for zettabyte, 10**21 bytes ++#: src/bs_size.c:87 ++msgid "ZB" ++msgstr "" ++ ++#. TRANSLATORS: abbreviation for yottabyte, 10**24 bytes ++#: src/bs_size.c:89 ++msgid "YB" ++msgstr "" +diff --git a/tests/canary_tests.sh.in b/tests/canary_tests.sh.in +index 13357e8..d5a5815 100644 +--- a/tests/canary_tests.sh.in ++++ b/tests/canary_tests.sh.in +@@ -17,15 +17,8 @@ if [ -z "$top_srcdir" ]; then + top_srcdir="$(dirname "$0")/.." + fi + +-if [ -z "$top_builddir" ] ; then +- top_builddir="$(dirname "$0")/.." +-fi +- +-# Make sure libbytesize.pot is up to date +-make -C ${top_builddir}/po libbytesize.pot-update >/dev/null 2>&1 +- + PYTHONPATH="${PYTHONPATH}:${top_srcdir}/translation-canary" + export PYTHONPATH + + # Run the translatable tests on the POT file +-python3 -m translation_canary.translatable "${top_builddir}/po/libbytesize.pot" ++python3 -m translation_canary.translatable "${top_srcdir}/po/libbytesize.pot" diff --git a/SOURCES/libbytesize-tests.patch b/SOURCES/libbytesize-tests.patch new file mode 100644 index 0000000..c1f648f --- /dev/null +++ b/SOURCES/libbytesize-tests.patch @@ -0,0 +1,352 @@ +From cae191ae459e046dc317b7bc57941e3f1cec910d Mon Sep 17 00:00:00 2001 +From: Vojtech Trefny +Date: Fri, 10 Aug 2018 08:35:51 +0200 +Subject: [PATCH 1/4] Run all libbytesize tests from one script + +This also makes sure we run tests with all supported python versions. +--- + tests/Makefile.am | 2 +- + tests/libbytesize_unittest.sh.in | 2 ++ + tests/libbytesize_unittest.sh | 2 ++ + 3 files changed, 5 insertions(+), 1 deletion(-) + +diff --git a/tests/Makefile.am b/tests/Makefile.am +index 1f59f64..1e51834 100644 +--- a/tests/Makefile.am ++++ b/tests/Makefile.am +@@ -2,7 +2,7 @@ AM_TESTS_ENVIRONMENT = top_srcdir="$(top_srcdir)" top_builddir="$(top_builddir)" + + dist_noinst_SCRIPTS = libbytesize_unittest.sh libbytesize_unittest.py lbs_py_override_unittest.py locale_utils.py testenv.sh canary_tests.sh + +-TESTS = libbytesize_unittest.sh lbs_py_override_unittest.py canary_tests.sh ++TESTS = libbytesize_unittest.sh canary_tests.sh + + # Add the translation-canary source files to the tarball + EXTRA_DIST = $(top_srcdir)/translation-canary/translation_canary/*.py \ +diff --git a/tests/libbytesize_unittest.sh.in b/tests/libbytesize_unittest.sh.in +index 7896675..e5ca56d 100644 +--- a/tests/libbytesize_unittest.sh.in ++++ b/tests/libbytesize_unittest.sh.in +@@ -9,10 +9,12 @@ fi + + if [ @WITH_PYTHON2@ = 1 ]; then + python2 ${srcdir}/libbytesize_unittest.py || status=1 ++ python2 ${srcdir}/lbs_py_override_unittest.py || status=1 + fi + + if [ @WITH_PYTHON3@ = 1 ]; then + python3 ${srcdir}/libbytesize_unittest.py || status=1 ++ python3 ${srcdir}/lbs_py_override_unittest.py || status=1 + fi + + if [ @WITH_PYTHON2@ = 1 ]; then +diff --git a/tests/libbytesize_unittest.sh b/tests/libbytesize_unittest.sh +index 7896675..e5ca56d 100644 +--- a/tests/libbytesize_unittest.sh ++++ b/tests/libbytesize_unittest.sh +@@ -9,10 +9,12 @@ fi + + if [ 1 = 1 ]; then + python2 ${srcdir}/libbytesize_unittest.py || status=1 ++ python2 ${srcdir}/lbs_py_override_unittest.py || status=1 + fi + + if [ 1 = 1 ]; then + python3 ${srcdir}/libbytesize_unittest.py || status=1 ++ python3 ${srcdir}/lbs_py_override_unittest.py || status=1 + fi + + if [ 1 = 1 ]; then +-- +2.20.1 + + +From 2c376a25813bf6966ec9c6da5a558dd5f4edc423 Mon Sep 17 00:00:00 2001 +From: Vojtech Trefny +Date: Tue, 5 Mar 2019 14:20:14 +0100 +Subject: [PATCH 2/4] Add all "public" python API symbols to __init__.py + +So it can be imported as "from bytesize import xyz" instead of +"from bytesize.bytesize import xyz". +--- + src/python/__init__.py | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/src/python/__init__.py b/src/python/__init__.py +index 6ab80dc..57403d5 100644 +--- a/src/python/__init__.py ++++ b/src/python/__init__.py +@@ -1 +1,4 @@ + from .bytesize import Size ++from .bytesize import B, KiB, MiB, GiB, TiB, PiB, EiB, ZiB, YiB, KB, MB, GB, TB, PB, EB, ZB, YB ++from .bytesize import ROUND_UP, ROUND_DOWN, ROUND_HALF_UP ++from .bytesize import SizeError, InvalidSpecError, OverflowError, ZeroDivisionError +-- +2.20.1 + + +From f07701b397907cefd7e43063b76277cc991f5339 Mon Sep 17 00:00:00 2001 +From: Vojtech Trefny +Date: Tue, 5 Mar 2019 14:55:20 +0100 +Subject: [PATCH 3/4] Allow running tests using installed library + +We need to be able to import the SizeStruct object from installed +python-bytesize. +--- + tests/libbytesize_unittest.py | 10 ++++++++-- + 1 file changed, 8 insertions(+), 2 deletions(-) + +diff --git a/tests/libbytesize_unittest.py b/tests/libbytesize_unittest.py +index 5e63778..d7400be 100755 +--- a/tests/libbytesize_unittest.py ++++ b/tests/libbytesize_unittest.py +@@ -8,7 +8,14 @@ import ctypes + + from locale_utils import get_avail_locales, requires_locales + +-from bytesize import SizeStruct, KiB, GiB, ROUND_UP, ROUND_DOWN, ROUND_HALF_UP, OverflowError ++from bytesize import KiB, GiB, ROUND_UP, ROUND_DOWN, ROUND_HALF_UP, OverflowError ++ ++# SizeStruct is part of the 'private' API and needs to be imported differently ++# when running from locally build tree and when using installed library ++try: ++ from bytesize import SizeStruct ++except ImportError: ++ from bytesize.bytesize import SizeStruct + + DEFAULT_LOCALE = "en_US.utf8" + +@@ -759,4 +766,3 @@ if __name__=='__main__': + sys.argv = [sys.argv[0]] + unittest.main() + #endif +- +-- +2.20.1 + + +From 4d692ac4eb178121c4e91ab881645aef94d65ed4 Mon Sep 17 00:00:00 2001 +From: Vojtech Trefny +Date: Wed, 6 Mar 2019 09:27:41 +0100 +Subject: [PATCH 4/4] Remove Python 2 support + +Python 2 EOL is close and we are no longer shipping python2 +package in newest distributions, so it makes sense to remove +Python 2 support entirely. +--- + Makefile.am | 2 +- + configure.ac | 16 ---------------- + dist/libbytesize.spec.in | 31 +------------------------------ + src/python/Makefile.am | 9 +-------- + tests/lbs_py_override_unittest.py | 4 +--- + tests/libbytesize_unittest.py | 2 +- + tests/libbytesize_unittest.sh.in | 9 --------- + tests/libbytesize_unittest.sh | 9 --------- + 8 files changed, 5 insertions(+), 77 deletions(-) + +diff --git a/Makefile.am b/Makefile.am +index 93279f2..1ac10bd 100644 +--- a/Makefile.am ++++ b/Makefile.am +@@ -38,7 +38,7 @@ dist-hook: + done + + run-ipython: all +- LD_LIBRARY_PATH=${LIBDIRS} PYTHONPATH=$(PYTHONDIR) ipython ++ LD_LIBRARY_PATH=${LIBDIRS} PYTHONPATH=$(PYTHONDIR) ipython3 + + check-requires: + @echo "*** Checking if the dependencies required for testing and analysis are available ***" +diff --git a/configure.ac b/configure.ac +index 749d929..c2306dc 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -50,22 +50,6 @@ AC_CHECK_HEADERS([langinfo.h gmp.h mpfr.h stdint.h stdbool.h stdarg.h string.h s + [LIBBYTESIZE_SOFT_FAILURE([Header file $ac_header not found.])], + []) + +-AC_ARG_WITH([python2], +- AS_HELP_STRING([--with-python2], [support python2 @<:@default=check@:>@]), +- [], +- [with_python2=check]) +- +-AC_SUBST(WITH_PYTHON2, 0) +-if test "x$with_python2" != "xno"; then +- AC_PATH_PROG([python2], [python2], [no]) +- AS_IF([test "x$python2" == "xno"], +- [if test "x$with_python2" = "xyes"; then +- LIBBYTESIZE_SOFT_FAILURE([Python2 support requested, but python2 is not available]) +- fi], +- [AC_SUBST(WITH_PYTHON2, 1)]) +-fi +-AM_CONDITIONAL(WITH_PYTHON2, test "x$with_python2" != "xno" -a "x$python2" != "xno") +- + AC_ARG_WITH([python3], + AS_HELP_STRING([--with-python3], [support python3 @<:@default=check@:>@]), + [], +diff --git a/dist/libbytesize.spec.in b/dist/libbytesize.spec.in +index 3f306f9..9658a7c 100644 +--- a/dist/libbytesize.spec.in ++++ b/dist/libbytesize.spec.in +@@ -1,5 +1,4 @@ + %define realname bytesize +-%define with_python2 @WITH_PYTHON2@ + %define with_python3 @WITH_PYTHON3@ + %define with_gtk_doc @WITH_GTK_DOC@ + +@@ -8,13 +7,7 @@ + %define python3_opts --without-python3 + %endif + +-# python2 is not available on RHEL > 7 and not needed on Fedora > 28 +-%if 0%{?rhel} > 7 || 0%{?fedora} > 28 || %{with_python2} == 0 +-%define with_python2 0 +-%define python2_opts --without-python2 +-%endif +- +-%define configure_opts %{?python3_opts} %{?python2_opts} ++%define configure_opts %{?python3_opts} + + Name: libbytesize + Version: 1.4 +@@ -29,9 +22,6 @@ BuildRequires: gmp-devel + BuildRequires: mpfr-devel + BuildRequires: pcre-devel + BuildRequires: gettext-devel +-%if %{with_python2} +-BuildRequires: python2-devel +-%endif + %if %{with_python3} + BuildRequires: python3-devel + %endif +@@ -53,19 +43,6 @@ Requires: %{name}%{?_isa} = %{version}-%{release} + This package contains header files and pkg-config files needed for development + with the libbytesize library. + +-%if %{with_python2} +-%package -n python2-%{realname} +-Summary: Python 2 bindings for libbytesize +-%{?python_provide:%python_provide python2-%{realname}} +-%{?python_provide:%python_provide python2-libbytesize} +-Requires: %{name}%{?_isa} = %{version}-%{release} +-Requires: python2-six +- +-%description -n python2-%{realname} +-This package contains Python 2 bindings for libbytesize making the use of +-the library from Python 2 easier and more convenient. +-%endif +- + %if %{with_python3} + %package -n python3-%{realname} + Summary: Python 3 bindings for libbytesize +@@ -108,12 +85,6 @@ find %{buildroot} -type f -name "*.la" | xargs %{__rm} + %{_datadir}/gtk-doc/html/libbytesize + %endif + +-%if %{with_python2} +-%files -n python2-%{realname} +-%dir %{python2_sitearch}/bytesize +-%{python2_sitearch}/bytesize/* +-%endif +- + %if %{with_python3} + %files -n python3-%{realname} + %dir %{python3_sitearch}/bytesize +diff --git a/src/python/Makefile.am b/src/python/Makefile.am +index e0261a6..cb2b197 100644 +--- a/src/python/Makefile.am ++++ b/src/python/Makefile.am +@@ -1,14 +1,7 @@ +-if WITH_PYTHON2 +-pylibdir = $(shell python -c "import distutils.sysconfig; print(distutils.sysconfig.get_python_lib(1,0,prefix='${exec_prefix}'))") +- +-pybytesizedir = $(pylibdir)/bytesize +-dist_pybytesize_DATA = bytesize.py __init__.py +-endif +- + if WITH_PYTHON3 + py3libdir = $(shell python3 -c "import distutils.sysconfig; print(distutils.sysconfig.get_python_lib(1,0,prefix='${exec_prefix}'))") + py3bytesizedir = $(py3libdir)/bytesize +-nodist_py3bytesize_DATA = bytesize.py __init__.py ++dist_py3bytesize_DATA = bytesize.py __init__.py + endif + + MAINTAINERCLEANFILES = Makefile.in +diff --git a/tests/lbs_py_override_unittest.py b/tests/lbs_py_override_unittest.py +index c5f3cb2..9a219f2 100755 +--- a/tests/lbs_py_override_unittest.py ++++ b/tests/lbs_py_override_unittest.py +@@ -1,4 +1,4 @@ +-#!/usr/bin/env python ++#!/usr/bin/python3 + # -*- coding: utf-8 -*- + + import unittest +@@ -306,5 +306,3 @@ class SizeTestCase(unittest.TestCase): + if __name__=='__main__': + unittest.main() + #endif +- +- +diff --git a/tests/libbytesize_unittest.py b/tests/libbytesize_unittest.py +index d7400be..1c57d2a 100755 +--- a/tests/libbytesize_unittest.py ++++ b/tests/libbytesize_unittest.py +@@ -1,4 +1,4 @@ +-#!/usr/bin/env python2 ++#!/usr/bin/python3 + # -*- coding: utf-8 -*- + + import locale +diff --git a/tests/libbytesize_unittest.sh.in b/tests/libbytesize_unittest.sh.in +index e5ca56d..816bc28 100644 +--- a/tests/libbytesize_unittest.sh.in ++++ b/tests/libbytesize_unittest.sh.in +@@ -7,20 +7,11 @@ if [ -z "$srcdir" ]; then + srcdir="$(dirname "$0")" + fi + +-if [ @WITH_PYTHON2@ = 1 ]; then +- python2 ${srcdir}/libbytesize_unittest.py || status=1 +- python2 ${srcdir}/lbs_py_override_unittest.py || status=1 +-fi +- + if [ @WITH_PYTHON3@ = 1 ]; then + python3 ${srcdir}/libbytesize_unittest.py || status=1 + python3 ${srcdir}/lbs_py_override_unittest.py || status=1 + fi + +-if [ @WITH_PYTHON2@ = 1 ]; then +- python2 ${srcdir}/libbytesize_unittest.py fr_FR.UTF8 || status=1 +-fi +- + if [ @WITH_PYTHON3@ = 1 ]; then + python3 ${srcdir}/libbytesize_unittest.py fr_FR.UTF8 || status=1 + fi +diff --git a/tests/libbytesize_unittest.sh b/tests/libbytesize_unittest.sh +index e5ca56d..816bc28 100644 +--- a/tests/libbytesize_unittest.sh ++++ b/tests/libbytesize_unittest.sh +@@ -7,20 +7,11 @@ if [ -z "$srcdir" ]; then + srcdir="$(dirname "$0")" + fi + +-if [ 1 = 1 ]; then +- python2 ${srcdir}/libbytesize_unittest.py || status=1 +- python2 ${srcdir}/lbs_py_override_unittest.py || status=1 +-fi +- + if [ 1 = 1 ]; then + python3 ${srcdir}/libbytesize_unittest.py || status=1 + python3 ${srcdir}/lbs_py_override_unittest.py || status=1 + fi + +-if [ 1 = 1 ]; then +- python2 ${srcdir}/libbytesize_unittest.py fr_FR.UTF8 || status=1 +-fi +- + if [ 1 = 1 ]; then + python3 ${srcdir}/libbytesize_unittest.py fr_FR.UTF8 || status=1 + fi +-- +2.20.1 diff --git a/SPECS/libbytesize.spec b/SPECS/libbytesize.spec new file mode 100644 index 0000000..e0f739a --- /dev/null +++ b/SPECS/libbytesize.spec @@ -0,0 +1,310 @@ +%define realname bytesize +%define with_python3 1 +%define with_gtk_doc 1 + +%if (! 0%{?fedora} && 0%{?rhel} <= 7) || %{with_python3} == 0 +%define with_python3 0 +%define python3_opts --without-python3 +%endif + +%define configure_opts %{?python3_opts} + +Name: libbytesize +Version: 1.4 +Release: 3%{?dist} +Summary: A library for working with sizes in bytes +License: LGPLv2+ +URL: https://github.com/storaged-project/libbytesize +Source0: https://github.com/storaged-project/libbytesize/releases/download/%{version}-%{release}/%{name}-%{version}.tar.gz +Patch0: libbytesize-tests.patch +Patch1: libbytesize-potfile.patch + +BuildRequires: gcc +BuildRequires: autoconf +BuildRequires: automake +BuildRequires: libtool +BuildRequires: gmp-devel +BuildRequires: mpfr-devel +BuildRequires: pcre-devel +BuildRequires: gettext-devel +%if %{with_python3} +BuildRequires: python3-devel +%endif +%if %{with_gtk_doc} +BuildRequires: gtk-doc +%endif + +%description +The libbytesize is a C library that facilitates work with sizes in +bytes. Be it parsing the input from users or producing a nice human readable +representation of a size in bytes this library takes localization into +account. It also provides support for sizes bigger than MAXUINT64. + +%package devel +Summary: Development files for libbytesize +Requires: %{name}%{?_isa} = %{version}-%{release} + +%description devel +This package contains header files and pkg-config files needed for development +with the libbytesize library. + +%if %{with_python3} +%package -n python3-%{realname} +Summary: Python 3 bindings for libbytesize +Requires: %{name}%{?_isa} = %{version}-%{release} +Requires: python3-six + +%description -n python3-%{realname} +This package contains Python 3 bindings for libbytesize making the use of +the library from Python 3 easier and more convenient. +%endif + +%prep +%setup -q -n %{name}-%{version} +%patch0 -p1 +%patch1 -p1 + +%build +autoreconf -ivf +%configure %{?configure_opts} +%{__make} %{?_smp_mflags} + +%install +%{make_install} +find %{buildroot} -type f -name "*.la" | xargs %{__rm} +%find_lang %{name} + + +%ldconfig_scriptlets + + +%files -f %{name}.lang +%doc README.md +%{!?_licensedir:%global license %%doc} +%license LICENSE +%{_libdir}/libbytesize.so.* + +%files devel +%{_libdir}/libbytesize.so +%dir %{_includedir}/bytesize +%{_includedir}/bytesize/bs_size.h +%{_libdir}/pkgconfig/bytesize.pc +%if %{with_gtk_doc} +%{_datadir}/gtk-doc/html/libbytesize +%endif + +%if %{with_python3} +%files -n python3-%{realname} +%dir %{python3_sitearch}/bytesize +%{python3_sitearch}/bytesize/* +%{python3_sitearch}/bytesize/__pycache__/* +%endif + +%changelog +* Wed Oct 30 2019 Vojtech Trefny - 1.4-3 +- Add POT file to git and do not rebuild it during every build + +* Wed Mar 20 2019 Vojtech Trefny - 1.4-2 +- Run upstream tests suite in gating + +* Thu Aug 02 2018 Vojtech Trefny - 1.4-1 +- Squashed 'translation-canary/' changes from 840c2d6..fccbb1b (vtrefny) +- Make sure the test script fails if one of the test runs fail (vtrefny) +- Do not try to run python2 tests without python2 support (vtrefny) +- Fix licence header for "gettext.h" (vtrefny) +- Do not use rpm to check for Zanata client (vtrefny) +- Use new ldconfig_scriptlets macro in spec (vtrefny) + +* Thu Apr 19 2018 Vojtech Trefny - 1.3-1 +- Allow building libbytesize without Python 2 support (vtrefny) +- Sync spec with downstream (vtrefny) +- Add gcc to BuildRequires (vtrefny) +- Fix links for documentation and GH project (vtrefny) +- Add a HACKING.rst file (vpodzime) +- Do not segfault when trying to bs_size_free NULL (vtrefny) + +* Wed Feb 21 2018 Vojtech Trefny - 1.2-4 +- Add gcc to BuildRequires (vtrefny) + +* Wed Feb 07 2018 Fedora Release Engineering - 1.2-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild + +* Fri Jan 05 2018 Iryna Shcherbina - 1.2-2 +- Update Python 2 dependency declarations to new packaging standards + (See https://fedoraproject.org/wiki/FinalizingFedoraSwitchtoPython3) + +* Fri Sep 29 2017 Vratislav Podzimek - 1.2-1 +- Use only version as a tag of the last release (vpodzime) +- Do not require the glib-2.0 pkgconfig package (vpodzime) +- Do not lie about tag creation (vpodzime) + +* Thu Sep 28 2017 Troy Dawson - 1.1-2 +- Cleanup spec file conditionals + +* Thu Sep 21 2017 Vratislav Podzimek - 1.1-1 +- Add NEWS.rst file (vtrefny) +- Fix source and url in spec file (vtrefny) +- Use only one git tag for new releases (vtrefny) +- Actually translate the units when expected (vpodzime) +- Add two temporary test files to .gitignore (vpodzime) + +* Thu Sep 14 2017 Vratislav Podzimek - 1.0-1 +- Make more space for CI status image (vtrefny) +- Include limits.h to make sure ULONG_MAX is defined (vpodzime) +- Remove extra 'is' in two docstrings (vpodzime) +- Properly support 64bit operands (vpodzime) + +* Sat Aug 19 2017 Zbigniew Jędrzejewski-Szmek - 0.11-4 +- Python 2 binary package renamed to python2-libbytesize + See https://fedoraproject.org/wiki/FinalizingFedoraSwitchtoPython3 + +* Thu Aug 03 2017 Fedora Release Engineering - 0.11-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild + +* Wed Jul 26 2017 Fedora Release Engineering - 0.11-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild + +* Wed Jun 14 2017 Vratislav Podzimek - 0.11-1 +- Fix README file name (vtrefny) +- Add a build status image to the README.md (vpodzime) +- Remove "glibc-all-langpacks" from test dependencies (vtrefny) +- Check for requires in generated spec file, not in the template (vtrefny) +- Fix checking for available locales (vtrefny) +- Fix library name in acinclude.m4 (vtrefny) +- Do not try to run translation tests on CentOS/RHEL 7 (vtrefny) +- Skip tests if they require unavailable locales (vpodzime) + +* Wed Apr 19 2017 Vratislav Podzimek - 0.10-1 +- Fix installation without specifying --exec-prefix (martin) +- Sync the spec file with downstream (vpodzime) + +* Fri Feb 10 2017 Fedora Release Engineering - 0.9-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild + +* Wed Jan 11 2017 Vratislav Podzimek - 0.9-1 +- Allow the Size python class to be easily imported (vpodzime) +- Make sure pyexecdir is defined (vpodzime) +- Do not run Python 3 tests without python3 (vpodzime) +- Disable python3 on RHEL (vpodzime) +- Reflect the configuration in the spec file template (vpodzime) +- Make documentation generation conditional (vpodzime) +- Make python3 support conditional (vpodzime) +- Require lower version of libpcre (vpodzime) +- Sync the spec file with downstream (vpodzime) + +* Wed Dec 21 2016 Adam Williamson - 0.8-2 +- Rebuild for Python 3.6, again + +* Fri Dec 16 2016 Vratislav Podzimek - 0.8-1 +- Add a docstring to python bindings (vpodzime) +- Neutralize None as an operand for math operations (vpodzime) +- Add targets for checking and installing test requirements (vpodzime) +- Fix 'make local' (vtrefny) +- Make the python packages own their package directories (vpodzime) +- Don't compare translated and untranslated representations (vpodzime) +- replace_char_with_str: Fix the character count. (dshea) +- Ditch autopoint. (dshea) + +* Mon Dec 12 2016 Charalampos Stratakis - 0.7-4 +- Rebuild for Python 3.6 + +* Tue Sep 20 2016 Vratislav Podzimek - 0.7-3 +- Prevent ignored exceptions in __del__ from happening (vpodzime) + +* Tue Jul 19 2016 Fedora Release Engineering - 0.7-2 +- https://fedoraproject.org/wiki/Changes/Automatic_Provides_for_Python_RPM_Packages + +* Tue May 17 2016 Vratislav Podzimek - 0.7-1 +- Re-run autogen.sh and configure before updating the .pot file (vpodzime) +- Change where tests on translated strings are run. (dshea) +- Squashed 'translation-canary/' changes from d6c0708..840c2d6 (dshea) +- Make sure we get the tests result report in 'make ci' (vpodzime) +- Add a new generic error code/enum for failures (vpodzime) +- Do not ignore the return value from asprintf() (vpodzime) +- Beware of the radix char when converting to Decimal (#1325705) (vpodzime) + +* Fri May 6 2016 Vratislav Podzimek - 0.6-2 +- Beware of unsigned long int on 32bit arches (#1333149) (vpodzime) + +* Tue May 03 2016 Vratislav Podzimek - 0.6-1 +- Add support for the ROUND_HALF_UP rounding mode (vpodzime) +- Make sure we return the right radix char in human_readable() (vpodzime) +- Allocate enough memory for char->str replacements (vpodzime) + +* Tue Apr 26 2016 Vratislav Podzimek - 0.5-1 +- Create both libbytesize-$version and $version tags (vpodzime) +- Update the .pot file with the new version (vpodzime) +- Improve how we create changelog (vpodzime) +- Try harder when getting OverflowError in division (#1326897) (vpodzime) +- Neutralize the radix char before passing string to MPFR (#1326108) (vpodzime) +- Run tests with en_US and fr_FR locales (vpodzime) +- Run the tests with both python2 and python3 again (vpodzime) +- Do not run the same tests 3 times as part of the 'ci' target (vpodzime) +- Don't fail if just the best-effort cleanup fails (vpodzime) +- Throw away the new .pot file when just running tests (vpodzime) +- Make sure we return one of -1, 0, 1 from cmp functions (#1326113) (vpodzime) +- Use cmp_bytes(size, bytes) when comparing to 0 (vpodzime) +- Ignore all .po~ files (vpodzime) +- Add translator comments (dshea) +- Integrate translation-canary into the build. (dshea) +- Run the translation-canary tests from make check. (dshea) +- Squashed 'translation-canary/' content from commit d6c0708 (dshea) +- Make 'make check' work. (dshea) +- Remove files from po/ we don't need to track (vpodzime) +- Ignore the compiled translation files (vpodzime) +- Distribute and package the translations (vpodzime) +- Add the necessary pieces for getting translations (vpodzime) + +* Thu Apr 14 2016 Vratislav Podzimek - 0.4-3 +- Only require -lgmp and -lmpfr for static linking (vpodzime) + +* Fri Mar 11 2016 Vratislav Podzimek - 0.4-2 +- Do not try to delete the C struct twice (vpodzime) + +* Wed Mar 09 2016 Vratislav Podzimek - 0.4-1 +- Add the __init__.py file to provide a proper package (vpodzime) +- Merge pull request #7 from vpodzime/master-decimal_locale (vpodzime) +- Make sure we pass a locale-agnostic string to Decimal() (vpodzime) +- Adapt the package description to no longer using GI (vpodzime) +- Make Size instances hashable (vpodzime) +- Sync the spec file with downstream (vpodzime) + +* Wed Mar 9 2016 Vratislav Podzimek - 0.3-3 +- Make sure we pass a locale-agnostic string to Decimal() (vpodzime) + +* Mon Mar 7 2016 Vratislav Podzimek - 0.3-2 +- Make Size instances hashable (vpodzime) + +* Fri Feb 26 2016 Vratislav Podzimek - 0.3-1 +- Packaging changes related to getting rid of GLib/GObject (vpodzime) +- Adapt the python bindings and tests (vpodzime) +- Get rid of GObject and GLib (vpodzime) +- Define the __divmod__ method even for not dividing by Size (vpodzime) + +* Thu Feb 04 2016 Fedora Release Engineering - 0.2-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild + +* Tue Nov 10 2015 Fedora Release Engineering - 0.2-2 +- Rebuilt for https://fedoraproject.org/wiki/Changes/python3.5 + +* Fri Oct 23 2015 Vratislav Podzimek - 0.2-1 +- Distribute the tests for overrides (vpodzime) +- Fix the rpmlog target (vpodzime) +- Respect the signs when doing division (vpodzime) +- Add two more internal methods that may be required (vpodzime) +- Do not pass negative numbers as guint64 when comparing with negative ints (vpodzime) +- Round toward zero when converting bytes from float to int (vpodzime) +- Make sure we return Size if doing operations with big integers (vpodzime) +- Implement the __divmod__() method (vpodzime) +- Do not try to convert negative int to an unsigned int when multiplying (vpodzime) +- Fix and test the __deepcopy__ method (vpodzime) +- Implement the evaluation of Size instance as a bool value (vpodzime) +- Fix some issues in comparison functions and add tests (vpodzime) +- Add a function for getting string representation of a unit (vpodzime) +- Hook the overrides tests to the 'test' target (vpodzime) +- Merge pull request #4 from japokorn/master-tests_03_python_override (vpodzime) +- Added tests for Python override (japokorn) +- Make sure our tests don't get broken by installed overrides (vpodzime) + +* Wed Oct 07 2015 Vratislav Podzimek - 0.1-1 +- Initial release