%global srcname enchant # Work around a problem with libenchant versioning # (python-enchant-1.3.1 failed to work with enchant-1.4.2-2.fc10) %global enchant_dep enchant >= 1.5.0 %define doc_license %{nil} %define doc_license 1 %if 0%{?rhel}%{?fedora} %if 0%{?rhel} %if 0%{?rhel} < 7 %define doc_license 0 %endif %else %if 0%{?fedora} < 19 %define doc_license 0 %endif %endif %endif %define license_files LICENSE.txt %define python2_package python2 %if 0%{?rhel}%{?fedora} %if 0%{?rhel} %if 0%{?rhel} <= 7 %define python2_package python %endif %else %if 0%{?fedora} <= 25 %define python2_package python %endif %endif %endif %define python3_package python%{python3_pkgversion} %define with_python3 %{nil} %define with_python3 1 %if 0%{?rhel}%{?fedora} %if 0%{?rhel} %if 0%{?rhel} <= 5 %define with_python3 0 %endif %else %if 0%{?fedora} <= 12 %define with_python3 0 %endif %endif %endif %if 0%{?with_python3} %else %{!?__python2: %global __python2 /usr/bin/python2} %{!?python2_sitelib: %global python2_sitelib %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print (get_python_lib())")} %endif Name: %{srcname}-python Version: 1.6.5 Release: 15%{?dist} Summary: Python bindings for Enchant spellchecking library Group: Development/Languages License: LGPLv2+ URL: http://packages.python.org/pyenchant/ Source0: http://pypi.python.org/packages/source/p/pyenchant/pyenchant-%{version}.tar.gz BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) Patch0: python-enchant-1.6.5-fix-tests-without-X.patch Patch1: python-enchant-1.6.5-fix-docstring-test.patch # python-distribute got merged into python-setuptools Patch2: python-enchant-1.6.5-disable-distribute-setup.patch BuildArch: noarch BuildRequires: enchant-devel %description PyEnchant is a spellchecking library for Python, based on the Enchant library by Dom Lachowicz. %package -n %{python2_package}-enchant Summary: Python 2 bindings for Enchant spellchecking library Group: Development/Languages # Python 2 build requirements: BuildRequires: %{python2_package}-devel BuildRequires: %{python2_package}-setuptools >= 0:0.6a9 # For running tests BuildRequires: %{python2_package}-nose Requires: %{python2_package} Requires: %{enchant_dep} # Package was arch specific before Obsoletes: python-enchant < 1.6.5 Provides: PyEnchant #Provides: Py2Enchant %{?python_provide:%python_provide %{python2_package}-%{srcname}} %if "%{python2_package}" != "python2" #%{?python_provide:%python_provide python2-%{srcname}} Provides: python2-%{srcname} = %{?epoch:%{epoch}:}%{version}-%{release} Obsoletes: python2-%{srcname} < %{?epoch:%{epoch}:}%{version}-%{release} %endif %if "%{python2_package}" != "python" #%{?python_provide:%python_provide python-%{srcname}} Provides: python-%{srcname} = %{?epoch:%{epoch}:}%{version}-%{release} Obsoletes: python-%{srcname} < %{?epoch:%{epoch}:}%{version}-%{release} %endif %description -n %{python2_package}-enchant PyEnchant is a spellchecking library for Python 2, based on the Enchant library by Dom Lachowicz. %if 0%{?with_python3} %package -n %{python3_package}-enchant Summary: Python 3 bindings for Enchant spellchecking library Group: Development/Languages BuildRequires: %{python3_package}-devel BuildRequires: %{python3_package}-setuptools >= 0:0.6a9 # For running tests BuildRequires: %{python3_package}-nose Requires: %{python3_package} Requires: %{enchant_dep} #Provides: Py3Enchant %{?python_provide:%python_provide %{python3_package}-%{srcname}} %if "%{python3_package}" != "python3" #%{?python_provide:%python_provide python3-%{srcname}} Provides: python3-%{srcname} = %{?epoch:%{epoch}:}%{version}-%{release} Obsoletes: python3-%{srcname} < %{?epoch:%{epoch}:}%{version}-%{release} %endif %description -n %{python3_package}-enchant PyEnchant is a spellchecking library for Python 3, based on the Enchant library by Dom Lachowicz. %endif # with_python3 %prep %setup -qc -n "pyenchant-%{version}" rm -rf "python2" || : rm -rf "python3" || : mv "pyenchant-%{version}" "python2" pushd "python2" %patch0 -p1 -b .fix-tests-without-X %patch1 -p1 -b .fix-docstring-test %patch2 -p1 -b .disable-distribute-setup popd %if 0%{?with_python3} cp -a "python2" "python3" %endif find "python2" -name '*.py' | xargs sed -i '1s|^#!python|#!%{__python2}|' %if 0%{?with_python3} find "python3" -name '*.py' | xargs sed -i '1s|^#!python|#!%{__python3}|' %endif # with_python3 pushd "python2" cp README.txt TODO.txt .. %if 0%{?license_files:1} && "%{license_files}" != "" cp %{?license_files} .. %endif popd %build pushd "python2" CFLAGS="${RPM_OPT_FLAGS}" %{__python2} setup.py build popd %if 0%{?with_python3} pushd "python3" CFLAGS="${RPM_OPT_FLAGS}" %{__python3} setup.py build popd %endif # with_python3 %install rm -rf "${RPM_BUILD_ROOT}" %if 0%{?with_python3} pushd "python3" %{__python3} setup.py install -O1 --skip-build --root "${RPM_BUILD_ROOT}" --single-version-externally-managed rm -rf $RPM_BUILD_ROOT/%{python3_sitelib}/*.egg-info # Directories used in windows build rm -rf "${RPM_BUILD_ROOT}/%{python3_sitelib}/enchant/lib" rm -rf "${RPM_BUILD_ROOT}/%{python3_sitelib}/enchant/share" popd %endif # with_python3 pushd "python2" %{__python2} setup.py install -O1 --skip-build --root "${RPM_BUILD_ROOT}" --single-version-externally-managed rm -rf "${RPM_BUILD_ROOT}/%{python2_sitelib}"/*.egg-info # Directories used in windows build rm -rf "${RPM_BUILD_ROOT}/%{python2_sitelib}/enchant/lib" rm -rf "${RPM_BUILD_ROOT}/%{python2_sitelib}/enchant/share" popd %check pushd "${RPM_BUILD_ROOT}/%{python2_sitelib}" # There is no dictionary for language C, need to use en_US LANG=en_US.UTF-8 "/usr/bin/nosetests-%{python2_version}" || : popd %if 0%{?with_python3} # Tests are failing in python3 because of collision between # local and stdlib tokenize module pushd "${RPM_BUILD_ROOT}/%{python3_sitelib}" # There is no dictionary for language C, need to use en_US #LANG=en_US.UTF-8 "/usr/bin/nosetests-%{python3_version}" || : popd %endif %clean rm -rf "${RPM_BUILD_ROOT}" %files -n %{python2_package}-enchant %defattr(-,root,root,-) %doc README.txt TODO.txt %if 0%{?doc_license} %license %{license_files} %else %doc %{license_files} %endif %dir %{python2_sitelib}/enchant %dir %{python2_sitelib}/enchant/checker %dir %{python2_sitelib}/enchant/tokenize %{python2_sitelib}/enchant/*.py %{python2_sitelib}/enchant/*.py[co] %{python2_sitelib}/enchant/*/*.py %{python2_sitelib}/enchant/*/*.py[co] %if 0%{?with_python3} %files -n %{python3_package}-enchant %defattr(-,root,root,-) %doc README.txt TODO.txt %if 0%{?doc_license} %license %{license_files} %else %doc %{license_files} %endif %dir %{python3_sitelib}/enchant %dir %{python3_sitelib}/enchant/__pycache__ %dir %{python3_sitelib}/enchant/checker %dir %{python3_sitelib}/enchant/checker/__pycache__ %dir %{python3_sitelib}/enchant/tokenize %dir %{python3_sitelib}/enchant/tokenize/__pycache__ %{python3_sitelib}/enchant/*.py %{python3_sitelib}/enchant/__pycache__/*.py[co] %{python3_sitelib}/enchant/checker/*.py %{python3_sitelib}/enchant/checker/__pycache__/*.py[co] %{python3_sitelib}/enchant/tokenize/*.py %{python3_sitelib}/enchant/tokenize/__pycache__/*.py[co] %endif # with_python3 %changelog * Sat Nov 04 2017 Tomasz Tomasik - 1.6.5-15 - Add support for EL7 - Update requirements - Enable python3 pakage for EL7 - Rewrite prep, build and install sections - Use license macro - Rebuilt for EL7 * Sat Jun 07 2014 Fedora Release Engineering - 1.6.5-14 - Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild * Wed May 28 2014 Kalev Lember - 1.6.5-13 - Rebuilt for https://fedoraproject.org/wiki/Changes/Python_3.4 * Tue Aug 06 2013 Radek Novacek 1.6.5-12 - Disable distribute setup * Sun Aug 04 2013 Fedora Release Engineering - 1.6.5-11 - Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild * Thu Feb 14 2013 Fedora Release Engineering - 1.6.5-10 - Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild * Thu Nov 01 2012 Radek Novacek 1.6.5-9 - Enable tests in %check * Wed Oct 31 2012 Radek Novacek 1.6.5-8 - Fix upstream url and source url * Sat Aug 04 2012 David Malcolm - 1.6.5-7 - rebuild for https://fedoraproject.org/wiki/Features/Python_3.3 * Sat Jul 21 2012 Fedora Release Engineering - 1.6.5-6 - Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild * Sat Jan 14 2012 Fedora Release Engineering - 1.6.5-5 - Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild * Mon Dec 12 2011 Radek Novacek 1.6.5-4 - Release bump to ensure upgrade path from F16 * Mon Oct 10 2011 David Malcolm - 1.6.5-3 - add python3 subpackage * Fri Sep 23 2011 Radek Novacek 1.6.5-2 - Obsolete old arch-specific version * Fri Sep 23 2011 Radek Novacek 1.6.5-1 - Update to version 1.6.5 - Change architecture to noarch - Change python_sitearch to python_sitelib - Changelog in no longer in source tarball - Remove nonpacked files * Tue Feb 08 2011 Fedora Release Engineering - 1.3.1-8 - Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild * Thu Jul 22 2010 David Malcolm - 1.3.1-7 - Rebuilt for https://fedoraproject.org/wiki/Features/Python_2.7/MassRebuild * Mon Feb 1 2010 Stepan Kasal - 1.3.1-6 - add a require to work around a problem with libenchant versioning * Sun Jul 26 2009 Fedora Release Engineering - 1.3.1-5 - Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild * Thu Feb 26 2009 Fedora Release Engineering - 1.3.1-4 - Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild * Sat Nov 29 2008 Ignacio Vazquez-Abrams - 1.3.1-3 - Rebuild for Python 2.6 * Tue Feb 19 2008 Fedora Release Engineering - 1.3.1-2 - Autorebuild for GCC 4.3 * Tue Dec 11 2007 Roozbeh Pournader - 1.3.1-1 - Update to 1.3.1 - Change license tag to LGPLv2+ * Sat Jan 13 2007 Roozbeh Pournader - 1.3.0-1 - Update to 1.3.0 - Add ChangeLog and TODO.txt as documentation * Sat Dec 09 2006 Roozbeh Pournader - 1.2.0-2 - Rebuild for Python 2.5 * Tue Nov 7 2006 José Matos - 1.2.0-1 - New upstream release * Thu Oct 05 2006 Christian Iseli 1.1.5-5 - rebuilt for unwind info generation, broken in gcc-4.1.1-21 * Wed Sep 20 2006 José Matos - 1.1.5-4 - Rebuild for FC-6. - Unghost .pyo files. * Tue Feb 14 2006 Roozbeh Pournader - 1.1.5-3 - Rebuild for Fedora Extras 5 * Tue Feb 07 2006 Roozbeh Pournader - 1.1.5-2 - Rebuild * Sat Feb 04 2006 Roozbeh Pournader - 1.1.5-1 - Update to 1.1.5 * Wed Feb 01 2006 Roozbeh Pournader - 1.1.3-3 - Use %%{python_sitearch} instead of %%{python_sitelib} (for x86_64) * Wed Feb 01 2006 Roozbeh Pournader - 1.1.3-2 - Remove %%{enchant_dir} macro - Add %%dir for architecture-specific directory - Add "Provides:" for PyEnchant - Remove "Requires:" on enchant (Brian Pepple) * Mon Jan 09 2006 Roozbeh Pournader - 1.1.3-1 - Initial packaging