Let setup.py install hg as hg again

This commit is contained in:
Mads Kiilerich 2020-12-10 19:11:49 +01:00
parent 486c6538e1
commit ff2acd1b92
2 changed files with 1 additions and 44 deletions

View File

@ -1,38 +0,0 @@
From 65b6aac48e167645a1aa75d6a724811fb7e5c775 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= <miro@hroncok.cz>
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 <pstodulk@redhat.com>
---
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

View File

@ -12,7 +12,6 @@ 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: bash-completion
BuildRequires: emacs-el
BuildRequires: emacs-nox
@ -102,12 +101,7 @@ Locales for mercurial.
%prep
%setup -q -n %{name}-%{upstreamversion}
%patch2 -p1 -b .create_hg3
%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
@ -132,6 +126,7 @@ grep 'hgk.py*' < %{name}.files > %{name}-hgk.files
install -D -m 755 contrib/hgk %{buildroot}%{_libexecdir}/mercurial/hgk
install -m 755 contrib/hg-ssh %{buildroot}%{_bindir}
mv %{buildroot}%{_bindir}/hg %{buildroot}%{_bindir}/hg3
bash_completion_dir=%{buildroot}$(pkg-config --variable=completionsdir bash-completion)
mkdir -p $bash_completion_dir