From d51dd224e3f6ff1b83c1d353ba51be0ae5e1fbde Mon Sep 17 00:00:00 2001 From: Ondřej Pohořelský Date: Dec 10 2020 13:44:16 +0000 Subject: Drop Python 2 support Resolves: #1737931 --- diff --git a/0001-setup-hg3.patch b/0001-setup-hg3.patch deleted file mode 100644 index d15c098..0000000 --- a/0001-setup-hg3.patch +++ /dev/null @@ -1,38 +0,0 @@ -From 65b6aac48e167645a1aa75d6a724811fb7e5c775 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= -Date: Tue, 26 Nov 2019 11:10:12 +0100 -Subject: [PATCH] Create hg2/hg3 bin/scripts to keep Py2 & Py3 mercurial - co-installable - -This can be removed completely once the mercurial for Python 2 is removed. - -Co-Authored-By: Petr Stodulka ---- - setup.py | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/setup.py b/setup.py -index 932608b..8663e01 100644 ---- a/setup.py -+++ b/setup.py -@@ -196,7 +196,7 @@ def write_if_changed(path, content): - fh.write(content) - - --scripts = ['hg'] -+scripts = ['hg' + str(sys.version_info[0])] - if os.name == 'nt': - # We remove hg.bat if we are able to build hg.exe. - scripts.append('contrib/win32/hg.bat') -@@ -317,7 +317,7 @@ def findhg(): - # and disable localization for the same reasons. - hgenv['HGPLAIN'] = '1' - hgenv['LANGUAGE'] = 'C' -- hgcmd = ['hg'] -+ hgcmd = ['hg' + str(sys.version_info[0])] - # Run a simple "hg log" command just to see if using hg from the user's - # path works and can successfully interact with this repository. Windows - # gives precedence to hg.exe in the current directory, so fall back to the --- -2.23.0 - diff --git a/mercurial.spec b/mercurial.spec index 2f8889e..1755f74 100644 --- a/mercurial.spec +++ b/mercurial.spec @@ -1,7 +1,7 @@ Summary: Mercurial -- a distributed SCM Name: mercurial Version: 5.6.1 -Release: 4%{?dist} +Release: 5%{?dist} # Release: 1.rc1%%{?dist} @@ -12,37 +12,37 @@ License: GPLv2+ URL: https://mercurial-scm.org/ Source0: https://www.mercurial-scm.org/release/%{name}-%{upstreamversion}.tar.gz Source1: mercurial-site-start.el -Patch2: 0001-setup-hg3.patch -BuildRequires: python3-devel bash-completion -BuildRequires: emacs-nox emacs-el pkgconfig gettext python3-docutils +BuildRequires: bash-completion +BuildRequires: emacs-el +BuildRequires: emacs-nox BuildRequires: gcc +BuildRequires: gettext +BuildRequires: pkgconfig +BuildRequires: python3-devel +BuildRequires: python3-docutils +#Requires(pre): %%{_sbindir}/update-alternatives + +Requires: python3 +Requires: emacs-filesystem +Requires: %{name}-lang = %{version}-%{release} -# Priorities for the alternatives system -%global py3_priority 30 - -%description -Mercurial is a fast, lightweight source control management system designed -for efficient handling of very large distributed projects. - -Quick start: http://www.selenic.com/mercurial/wiki/index.cgi/QuickStart -Tutorial: http://www.selenic.com/mercurial/wiki/index.cgi/Tutorial -Extensions: http://www.selenic.com/mercurial/wiki/index.cgi/CategoryExtension - - -%package py3 -Summary: Mercurial -- a distributed SCM (Python 3 version) +# Provides and obsoletes related to previous releases of Fedora where we +# delivered mercurial for Py2 & Py3 in parallel. Can be reduced in F36+ Provides: hg3 = %{version}-%{release} Provides: hg = %{version}-%{release} Provides: %{name} = %{version}-%{release} -Provides: %{name}%{?_isa} = %{version}-%{release} -Requires: python3 emacs-filesystem -Requires: %{name}-lang = %{version}-%{release} -Obsoletes: emacs-mercurial <= 3.4.1, emacs-mercurial-el <= 3.4.1 +Provides: %{name}-py3 = %{version}-%{release} +Provides: %{name}-py3%{?_isa} = %{version}-%{release} + Obsoletes: %{name}-py2 < %{version}-%{release} -Requires(post): %{_sbindir}/update-alternatives -Requires(preun): %{_sbindir}/update-alternatives +Obsoletes: %{name}-py3 < %{version}-%{release} +Obsoletes: hg2 +Obsoletes: hg3 +Obsoletes: hg-ssh2 +Obsoletes: hg-ssh3 + -%description py3 +%description Mercurial is a fast, lightweight source control management system designed for efficient handling of very large distributed projects. @@ -57,8 +57,6 @@ This Mercurial runs on Python 3 and is obsoleting the Python 2 version. Summary: Hgk interface for mercurial Requires: hg = %{version}-%{release}, tk -Requires: hg3 = %{version}-%{release}, tk - %description hgk A Mercurial extension for displaying the change history graphically using Tcl/Tk. Displays branches and merges in an easily @@ -74,9 +72,6 @@ documentation. Summary: A fast client for Mercurial command server running on Unix. It saves time of slow Python startup. Requires: hg = %{version}-%{release} -# Let's default to Python 2, but allow some experiments -Suggests: hg3 - %description chg chg is a C wrapper for the hg command. Typically, when you type hg, a new Python process is created, Mercurial is loaded, and your requested command runs @@ -95,13 +90,10 @@ Locales for mercurial. %prep %setup -q -n %{name}-%{upstreamversion} - -%patch2 -p1 -b .create_hg3 +# NOTE: Use PYTHON envar instead of pathing Makefiles +# sed -ri 's|python\b|python2|' %{_builddir}/%{name}-%{version}/Makefile %{_builddir}/%{name}-%{version}/doc/Makefile %build -# copy hg to hg2/hg3 to be able to create /usr/bin/hg(2|3) script -cp -a hg hg3 -rm hg PYTHON=%{python3} make all # chg will invoke the 'hg' command - no direct Python dependency @@ -110,8 +102,6 @@ make popd %install -# NOTE: this is nasty, but if we want to have parallel Py2/Py3 mercurial.. -# ignoring now stuff related to *_completion, extensions %{python3} setup.py install -O1 --root %{buildroot} --prefix %{_prefix} --record=%{name}.files make install-doc DESTDIR=%{buildroot} MANDIR=%{_mandir} @@ -147,7 +137,7 @@ done popd pushd contrib/chg -make install DESTDIR=%{buildroot} PREFIX=%{_usr} MANDIR=%{_mandir}/man1 +%make_install DESTDIR=%{buildroot} PREFIX=%{_usr} MANDIR=%{_mandir}/man1 popd @@ -179,34 +169,10 @@ rm -rf %{buildroot}%{python3_sitearch}/mercurial/locale grep -v locale %{name}-base.files > %{name}-base-filtered.files +pathfix.py -pni "%{python3}" %{buildroot}%{_bindir}/hg-ssh -# Move hg-ssh aside -cp -p %{buildroot}%{_bindir}/hg-ssh %{buildroot}%{_bindir}/hg-ssh3 -rm %{buildroot}%{_bindir}/hg-ssh -pathfix.py -pni "%{python3}" %{buildroot}%{_bindir}/hg-ssh3 - -# Touch the base executables for alternatives -touch %{buildroot}%{_bindir}/hg -touch %{buildroot}%{_bindir}/hg-ssh - -%post py3 -for fname in %{_bindir}/{hg,hg-ssh}; do - if [ ! -L "$fname" ]; then - rm -f "$fname" - fi -done -%{_sbindir}/update-alternatives --install %{_bindir}/hg \ - hg %{_bindir}/hg3 %{py3_priority} \ - --slave %{_bindir}/hg-ssh hg-ssh %{_bindir}/hg-ssh3 || : - -%preun py3 -if [ $1 -eq 0 ]; then - %{_sbindir}/update-alternatives --remove \ - hg %{_bindir}/hg3 || : -fi - -%files py3 -f %{name}-base-filtered.files +%files -f %{name}-base-filtered.files %doc CONTRIBUTORS COPYING doc/README doc/hg*.txt doc/hg*.html *.cgi contrib/*.fcgi contrib/*.wsgi %doc %attr(644,root,root) %{_mandir}/man?/hg*.gz %doc %attr(644,root,root) contrib/*.svg @@ -222,10 +188,8 @@ fi %{python3_sitearch}/hgdemandimport/ %{_emacs_sitelispdir}/mercurial %{_emacs_sitestartdir}/*.el -%ghost %{_bindir}/hg -%ghost %{_bindir}/hg-ssh -%{_bindir}/hg3 -%{_bindir}/hg-ssh3 +%{_bindir}/hg +%{_bindir}/hg-ssh %config(noreplace) %{_sysconfdir}/mercurial/hgrc.d/certs.rc @@ -241,6 +205,7 @@ fi #%%check +# TODO: start to use the check section again # This will now fail everytime. Mercurial is not ported properly for Python3 # and current split of mercurial for Py2 and Py3 brings additional problems # for extensions then pure Python3 packaging. @@ -248,6 +213,10 @@ fi %changelog +* Thu Dec 10 2020 Ondrej Pohorelsky - 5.6.1-5 +- Drop Python 2 support +- Resolves: #1737931 + * Tue Dec 8 17:14:14 CET 2020 Mads Kiilerich - 5.6.1-4 - Change mercurial-hgk to use py3 - Use py3 for locales - py2 is going away