From 4e03c853d0f9347dad12caf4a096de5722b591f3 Mon Sep 17 00:00:00 2001
From: Tomas Cejka <cejkat@cesnet.cz>
Date: Fri, 14 Jul 2017 00:27:00 +0200
Subject: [PATCH] Add spec files to generate RPM packages

There are RPM packages for epel7 and several Fedora versions at copr
repository: https://copr.fedorainfracloud.org/coprs/g/CESNET/NEMEA/
---
 lib_python/lib/specs/python-idea-format.spec | 88 ++++++++++++++++++++
 lib_python/lib/specs/python-ipranges.spec    | 83 ++++++++++++++++++
 lib_python/lib/specs/python-typedcols.spec   | 83 ++++++++++++++++++
 3 files changed, 254 insertions(+)
 create mode 100644 lib_python/lib/specs/python-idea-format.spec
 create mode 100644 lib_python/lib/specs/python-ipranges.spec
 create mode 100644 lib_python/lib/specs/python-typedcols.spec

diff --git a/lib_python/lib/specs/python-idea-format.spec b/lib_python/lib/specs/python-idea-format.spec
new file mode 100644
index 0000000..71922e1
--- /dev/null
+++ b/lib_python/lib/specs/python-idea-format.spec
@@ -0,0 +1,88 @@
+%global pypi_name idea-format
+%global pypi_version 0.1.7
+
+%if 0%{?el6}
+%global python3_pkgversion 33
+%global py3_build CFLAGS="-O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions --param=ssp-buffer-size=4 -mtune=generic" python3 setup.py build
+%endif
+
+%if x%{?python3_pkgversion} == x
+%global python3_pkgversion 3
+%endif
+
+Name:           python-%{pypi_name}
+Version:        %{pypi_version}
+Release:        1%{?dist}
+Summary:        Python library for working with IDEA messages.
+
+License:        ISC
+URL:            https://homeproj.cesnet.cz/git/idea.git
+Source0:        https://files.pythonhosted.org/packages/source/i/%{pypi_name}/%{pypi_name}-%{version}.tar.gz
+BuildArch:      noarch
+ 
+Requires: python-ipranges
+Requires: python-typedcols
+
+BuildRequires:  python-devel
+BuildRequires:  python-setuptools
+BuildRequires:  python-nose
+
+BuildRequires:  python%{python3_pkgversion}-devel
+BuildRequires:  python%{python3_pkgversion}-setuptools
+BuildRequires:  python%{python3_pkgversion}-nose
+
+%description
+Python 2 library for working with IDEA messages.
+
+This README file is work in progress, for more information please visit home page at https://idea.cesnet.cz/en/index.
+
+%package -n     python2-%{pypi_name}
+Summary:        %{summary}
+%{?python_provide:%python_provide python2-%{pypi_name}}
+
+%description -n python2-%{pypi_name}
+Python 2 library for working with IDEA messages.
+
+This README file is work in progress, for more information please visit home page at https://idea.cesnet.cz/en/index.
+
+%package -n     python%{python3_pkgversion}-%{pypi_name}
+Summary:        %{summary}
+%{?python_provide:%python_provide python%{python3_pkgversion}-%{pypi_name}}
+Requires: python%{python3_pkgversion}-ipranges
+Requires: python%{python3_pkgversion}-typedcols
+
+
+%description -n python%{python3_pkgversion}-%{pypi_name}
+Python 3 library for working with IDEA messages.
+
+This README file is work in progress, for more information please visit home page at https://idea.cesnet.cz/en/index.
+
+
+%prep
+%setup -n %{pypi_name}-%{version}
+# Remove bundled egg-info
+rm -rf %{pypi_name}.egg-info
+
+%build
+%py2_build
+%py3_build
+
+%install
+# Must do the subpackages' install first because the scripts in /usr/bin are
+# overwritten with every setup.py install.
+%{__python3} setup.py install --skip-build --single-version-externally-managed --root %{buildroot}
+%{__python2} setup.py install --skip-build --single-version-externally-managed --root %{buildroot}
+
+
+%check
+%{__python2} setup.py test
+%{__python3} setup.py test
+
+%files -n python2-%{pypi_name}
+%doc README.rst
+%{python_sitelib}
+
+%files -n python%{python3_pkgversion}-%{pypi_name}
+%doc README.rst
+%{python3_sitelib}
+
diff --git a/lib_python/lib/specs/python-ipranges.spec b/lib_python/lib/specs/python-ipranges.spec
new file mode 100644
index 0000000..9af7d6d
--- /dev/null
+++ b/lib_python/lib/specs/python-ipranges.spec
@@ -0,0 +1,83 @@
+%global pypi_name ipranges
+%global pypi_version 0.1.7
+
+%if 0%{?el6}
+%global python3_pkgversion 33
+%global py3_build CFLAGS="-O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions --param=ssp-buffer-size=4 -mtune=generic" python3 setup.py build
+%endif
+
+%if x%{?python3_pkgversion} == x
+%global python3_pkgversion 3
+%endif
+
+Name:           python-%{pypi_name}
+Version:        %{pypi_version}
+Release:        1%{?dist}
+Summary:        Python library for working with IP addressess.
+
+License:        ISC
+URL:            https://homeproj.cesnet.cz/git/idea.git
+Source0:        https://files.pythonhosted.org/packages/source/i/%{pypi_name}/%{pypi_name}-%{version}.tar.gz
+BuildArch:      noarch
+ 
+BuildRequires:  python-devel
+BuildRequires:  python-setuptools
+BuildRequires:  python-nose
+
+BuildRequires:  python%{python3_pkgversion}-devel
+BuildRequires:  python%{python3_pkgversion}-setuptools
+BuildRequires:  python%{python3_pkgversion}-nose
+
+%description
+Python 2 library for working with IPv4 and IPv6 addressess in many notations (sible IP, CIDR, range).
+
+This README file is work in progress, for more information please visit home page at https://idea.cesnet.cz/en/index.
+
+%package -n     python2-%{pypi_name}
+Summary:        %{summary}
+%{?python_provide:%python_provide python2-%{pypi_name}}
+
+%description -n python2-%{pypi_name}
+Python 2 library for working with IPv4 and IPv6 addressess in many notations (sible IP, CIDR, range).
+
+This README file is work in progress, for more information please visit home page at https://idea.cesnet.cz/en/index.
+
+%package -n     python%{python3_pkgversion}-%{pypi_name}
+Summary:        %{summary}
+%{?python_provide:%python_provide python%{python3_pkgversion}-%{pypi_name}}
+
+
+%description -n python%{python3_pkgversion}-%{pypi_name}
+Python 3 library for working with IPv4 and IPv6 addressess in many notations (sible IP, CIDR, range).
+
+This README file is work in progress, for more information please visit home page at https://idea.cesnet.cz/en/index.
+
+
+%prep
+%setup -n %{pypi_name}-%{version}
+# Remove bundled egg-info
+rm -rf %{pypi_name}.egg-info
+
+%build
+%py2_build
+%py3_build
+
+%install
+# Must do the subpackages' install first because the scripts in /usr/bin are
+# overwritten with every setup.py install.
+%{__python3} setup.py install --skip-build --single-version-externally-managed --root %{buildroot}
+%{__python2} setup.py install --skip-build --single-version-externally-managed --root %{buildroot}
+
+
+%check
+%{__python2} setup.py test
+%{__python3} setup.py test
+
+%files -n python2-%{pypi_name}
+%doc README.rst
+%{python_sitelib}
+
+%files -n python%{python3_pkgversion}-%{pypi_name}
+%doc README.rst
+%{python3_sitelib}
+
diff --git a/lib_python/lib/specs/python-typedcols.spec b/lib_python/lib/specs/python-typedcols.spec
new file mode 100644
index 0000000..c521ae4
--- /dev/null
+++ b/lib_python/lib/specs/python-typedcols.spec
@@ -0,0 +1,83 @@
+%global pypi_name typedcols
+%global pypi_version 0.1.7
+
+%if 0%{?el6}
+%global python3_pkgversion 33
+%global py3_build CFLAGS="-O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions --param=ssp-buffer-size=4 -mtune=generic" python3 setup.py build
+%endif
+
+%if x%{?python3_pkgversion} == x
+%global python3_pkgversion 3
+%endif
+
+Name:           python-%{pypi_name}
+Version:        %{pypi_version}
+Release:        1%{?dist}
+Summary:        Python library providing typed collections.
+
+License:        ISC
+URL:            https://homeproj.cesnet.cz/git/idea.git
+Source0:        https://files.pythonhosted.org/packages/source/t/%{pypi_name}/%{pypi_name}-%{version}.tar.gz
+BuildArch:      noarch
+ 
+BuildRequires:  python-devel
+BuildRequires:  python-setuptools
+BuildRequires:  python-nose
+
+BuildRequires:  python%{python3_pkgversion}-devel
+BuildRequires:  python%{python3_pkgversion}-setuptools
+BuildRequires:  python%{python3_pkgversion}-nose
+
+%description
+Python 2 library providing typed collections.
+
+This README file is work in progress, for more information please visit home page at https://idea.cesnet.cz/en/index.
+
+%package -n     python2-%{pypi_name}
+Summary:        %{summary}
+%{?python_provide:%python_provide python2-%{pypi_name}}
+
+%description -n python2-%{pypi_name}
+Python 2 library providing typed collections.
+
+This README file is work in progress, for more information please visit home page at https://idea.cesnet.cz/en/index.
+
+%package -n     python%{python3_pkgversion}-%{pypi_name}
+Summary:        %{summary}
+%{?python_provide:%python_provide python%{python3_pkgversion}-%{pypi_name}}
+
+
+%description -n python%{python3_pkgversion}-%{pypi_name}
+Python 3 library providing typed collections.
+
+This README file is work in progress, for more information please visit home page at https://idea.cesnet.cz/en/index.
+
+
+%prep
+%setup -n %{pypi_name}-%{version}
+# Remove bundled egg-info
+rm -rf %{pypi_name}.egg-info
+
+%build
+%py2_build
+%py3_build
+
+%install
+# Must do the subpackages' install first because the scripts in /usr/bin are
+# overwritten with every setup.py install.
+%{__python3} setup.py install --skip-build --single-version-externally-managed --root %{buildroot}
+%{__python2} setup.py install --skip-build --single-version-externally-managed --root %{buildroot}
+
+
+%check
+%{__python2} setup.py test
+%{__python3} setup.py test
+
+%files -n python2-%{pypi_name}
+%doc README.rst
+%{python_sitelib}
+
+%files -n python%{python3_pkgversion}-%{pypi_name}
+%doc README.rst
+%{python3_sitelib}
+
-- 
GitLab