Patchwork D12270: setup: remove more Python 2 support code

login
register
mail settings
Submitter phabricator
Date March 2, 2022, 3:45 p.m.
Message ID <differential-rev-PHID-DREV-jkfuatfkkote7bu2nd3d-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/50609/
State New
Headers show

Comments

phabricator - March 2, 2022, 3:45 p.m.
durin42 created this revision.
durin42 added a reviewer: indygreg.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  I'll inline print() etc in future patches.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D12270

AFFECTED FILES
  setup.py

CHANGE DETAILS




To: durin42, indygreg, #hg-reviewers
Cc: mercurial-patches, mercurial-devel

Patch

diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -22,23 +22,12 @@ 
 import sys, platform
 import sysconfig
 
-if sys.version_info[0] >= 3:
-    printf = eval('print')
-    libdir_escape = 'unicode_escape'
-
-    def sysstr(s):
-        return s.decode('latin-1')
+printf = eval('print')
+libdir_escape = 'unicode_escape'
 
-else:
-    libdir_escape = 'string_escape'
 
-    def printf(*args, **kwargs):
-        f = kwargs.get('file', sys.stdout)
-        end = kwargs.get('end', '\n')
-        f.write(b' '.join(args) + end)
-
-    def sysstr(s):
-        return s
+def sysstr(s):
+    return s.decode('latin-1')
 
 
 import ssl