D12316: rust: enable Python 3 support unconditionally

2022-03-02 Thread SimonSapin
SimonSapin created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  Note: `cpython/python3-sys` is a default feature.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  Makefile
  rust/README.rst
  rust/hg-cpython/Cargo.toml
  setup.py

CHANGE DETAILS

diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -1380,15 +1380,9 @@
 
 cargocmd = ['cargo', 'rustc', '--release']
 
-feature_flags = ['python3']
-
-cargocmd.append('--no-default-features')
-
 rust_features = env.get("HG_RUST_FEATURES")
 if rust_features:
-feature_flags.append(rust_features)
-
-cargocmd.extend(('--features', " ".join(feature_flags)))
+cargocmd.extend(('--features', rust_features))
 
 cargocmd.append('--')
 if sys.platform == 'darwin':
diff --git a/rust/hg-cpython/Cargo.toml b/rust/hg-cpython/Cargo.toml
--- a/rust/hg-cpython/Cargo.toml
+++ b/rust/hg-cpython/Cargo.toml
@@ -8,18 +8,8 @@
 name='rusthg'
 crate-type = ["cdylib"]
 
-[features]
-default = ["python3"]
-
-# Features to build an extension module:
-python3 = ["cpython/python3-sys", "cpython/extension-module"]
-
-# Enable this feature to build a test executable linked to libpython:
-# e.g. cargo test --no-default-features --features python3-bin
-python3-bin = ["cpython/python3-sys"]
-
 [dependencies]
-cpython = { version = "0.7.0", default-features = false }
+cpython = { version = "0.7.0", features = ["extension-module"] }
 crossbeam-channel = "0.4"
 hg-core = { path = "../hg-core"}
 libc = "0.2"
diff --git a/rust/README.rst b/rust/README.rst
--- a/rust/README.rst
+++ b/rust/README.rst
@@ -40,8 +40,8 @@
 Special features
 
 
-You might want to check the `features` section in ``hg-cpython/Cargo.toml``.
-It may contain features that might be interesting to try out.
+In the future, compile-time opt-ins may be added
+to the `features` section in ``hg-cpython/Cargo.toml``.
 
 To use features from the Makefile, use the `HG_RUST_FEATURES` environment
 variable: for instance `HG_RUST_FEATURES="some-feature other-feature"`
diff --git a/Makefile b/Makefile
--- a/Makefile
+++ b/Makefile
@@ -151,12 +151,9 @@
 $(MAKE) -f $(HGROOT)/contrib/Makefile.python PYTHONVER=$* 
PREFIX=$(HGPYTHONS)/$* python )
cd tests && $(HGPYTHONS)/$*/bin/python run-tests.py $(TESTFLAGS)
 
-rust-tests: py_feature = $(shell $(PYTHON) -c \
- 'import sys; print(["python27-bin", "python3-bin"][sys.version_info[0] >= 
3])')
 rust-tests:
cd $(HGROOT)/rust/hg-cpython \
-   && $(CARGO) test --quiet --all \
-   --no-default-features --features "$(py_feature) 
$(HG_RUST_FEATURES)"
+   && $(CARGO) test --quiet --all --features "$(HG_RUST_FEATURES)"
 
 check-code:
hg manifest | xargs python contrib/check-code.py



To: SimonSapin, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: [PATCH 1 of 2] cext: backout e9ca736f5b52 "remove Python 2 file handling code"

2022-03-02 Thread Gregory Szorc
*facepalm*

Queued, thanks.

On Wed, Mar 2, 2022 at 7:42 PM Yuya Nishihara  wrote:

> # HG changeset patch
> # User Yuya Nishihara 
> # Date 1646268190 -32400
> #  Thu Mar 03 09:43:10 2022 +0900
> # Node ID 499733de460faf0d8cee6ea5e22bd05cec2fc93c
> # Parent  7b068abe4aa2d1848cf91c2c203b68aa59feaaf7
> cext: backout e9ca736f5b52 "remove Python 2 file handling code"
>
> It's if"n"def.
>
> diff --git a/mercurial/cext/osutil.c b/mercurial/cext/osutil.c
> --- a/mercurial/cext/osutil.c
> +++ b/mercurial/cext/osutil.c
> @@ -1176,7 +1176,9 @@ static PyObject *posixfile(PyObject *sel
> char fpmode[4];
> int fppos = 0;
> int plus;
> +#ifndef IS_PY3K
> FILE *fp;
> +#endif
>
> if (!PyArg_ParseTupleAndKeywords(args, kwds, "et|yi:posixfile",
>  kwlist,
> @@ -1248,6 +1250,7 @@ static PyObject *posixfile(PyObject *sel
> PyErr_SetFromErrnoWithFilename(PyExc_IOError, name);
> goto bail;
> }
> +#ifndef IS_PY3K
> fp = _fdopen(fd, fpmode);
> if (fp == NULL) {
> _close(fd);
> @@ -1262,6 +1265,11 @@ static PyObject *posixfile(PyObject *sel
> }
>
> PyFile_SetBufSize(file_obj, bufsize);
> +#else
> +   file_obj = PyFile_FromFd(fd, name, mode, bufsize, NULL, NULL,
> NULL, 1);
> +   if (file_obj == NULL)
> +   goto bail;
> +#endif
>  bail:
> PyMem_Free(name);
> return file_obj;
>
> ___
> Mercurial-devel mailing list
> Mercurial-devel@mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
>
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D12315: setup: drop support for Python 3.5

2022-03-02 Thread indygreg (Gregory Szorc)
indygreg created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  We talked about this on the mailing list [1] and there seemed to be
  agreement that Python 3.5 is effectively dead and no longer worth
  supporting.
  
  So this commit changes our minimum version requirement to 3.6.2.
  
  [1] 
https://www.mercurial-scm.org/pipermail/mercurial-devel/2022-February/147885.html

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  setup.py

CHANGE DETAILS

diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -5,17 +5,11 @@
 # 'python setup.py --help' for more options
 import os
 
-# Mercurial will never work on Python 3 before 3.5 due to a lack
-# of % formatting on bytestrings, and can't work on 3.6.0 or 3.6.1
-# due to a bug in % formatting in bytestrings.
-# We cannot support Python 3.5.0, 3.5.1, 3.5.2 because of bug in
-# codecs.escape_encode() where it raises SystemError on empty bytestring
-# bug link: https://bugs.python.org/issue25270
+# Mercurial can't work on 3.6.0 or 3.6.1 due to a bug in % formatting
+# in bytestrings.
 supportedpy = ','.join(
 [
-'>=3.5.3',
-'!=3.6.0',
-'!=3.6.1',
+'>=3.6.2',
 ]
 )
 



To: indygreg, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 1 of 2] cext: backout e9ca736f5b52 "remove Python 2 file handling code"

2022-03-02 Thread Yuya Nishihara
# HG changeset patch
# User Yuya Nishihara 
# Date 1646268190 -32400
#  Thu Mar 03 09:43:10 2022 +0900
# Node ID 499733de460faf0d8cee6ea5e22bd05cec2fc93c
# Parent  7b068abe4aa2d1848cf91c2c203b68aa59feaaf7
cext: backout e9ca736f5b52 "remove Python 2 file handling code"

It's if"n"def.

diff --git a/mercurial/cext/osutil.c b/mercurial/cext/osutil.c
--- a/mercurial/cext/osutil.c
+++ b/mercurial/cext/osutil.c
@@ -1176,7 +1176,9 @@ static PyObject *posixfile(PyObject *sel
char fpmode[4];
int fppos = 0;
int plus;
+#ifndef IS_PY3K
FILE *fp;
+#endif
 
if (!PyArg_ParseTupleAndKeywords(args, kwds, "et|yi:posixfile",
 kwlist,
@@ -1248,6 +1250,7 @@ static PyObject *posixfile(PyObject *sel
PyErr_SetFromErrnoWithFilename(PyExc_IOError, name);
goto bail;
}
+#ifndef IS_PY3K
fp = _fdopen(fd, fpmode);
if (fp == NULL) {
_close(fd);
@@ -1262,6 +1265,11 @@ static PyObject *posixfile(PyObject *sel
}
 
PyFile_SetBufSize(file_obj, bufsize);
+#else
+   file_obj = PyFile_FromFd(fd, name, mode, bufsize, NULL, NULL, NULL, 1);
+   if (file_obj == NULL)
+   goto bail;
+#endif
 bail:
PyMem_Free(name);
return file_obj;

___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 2 of 2] cext: really remove Python 2 file handling code

2022-03-02 Thread Yuya Nishihara
# HG changeset patch
# User Yuya Nishihara 
# Date 1646268321 -32400
#  Thu Mar 03 09:45:21 2022 +0900
# Node ID 2ef3b7d30cc1df92f52bc5ef04b8e549db971095
# Parent  499733de460faf0d8cee6ea5e22bd05cec2fc93c
cext: really remove Python 2 file handling code

Disclaimer: This is _WIN32 code and I have no machine to test.

diff --git a/mercurial/cext/osutil.c b/mercurial/cext/osutil.c
--- a/mercurial/cext/osutil.c
+++ b/mercurial/cext/osutil.c
@@ -1176,9 +1176,6 @@ static PyObject *posixfile(PyObject *sel
char fpmode[4];
int fppos = 0;
int plus;
-#ifndef IS_PY3K
-   FILE *fp;
-#endif
 
if (!PyArg_ParseTupleAndKeywords(args, kwds, "et|yi:posixfile",
 kwlist,
@@ -1250,26 +1247,9 @@ static PyObject *posixfile(PyObject *sel
PyErr_SetFromErrnoWithFilename(PyExc_IOError, name);
goto bail;
}
-#ifndef IS_PY3K
-   fp = _fdopen(fd, fpmode);
-   if (fp == NULL) {
-   _close(fd);
-   PyErr_SetFromErrnoWithFilename(PyExc_IOError, name);
-   goto bail;
-   }
-
-   file_obj = PyFile_FromFile(fp, name, mode, fclose);
-   if (file_obj == NULL) {
-   fclose(fp);
-   goto bail;
-   }
-
-   PyFile_SetBufSize(file_obj, bufsize);
-#else
file_obj = PyFile_FromFd(fd, name, mode, bufsize, NULL, NULL, NULL, 1);
if (file_obj == NULL)
goto bail;
-#endif
 bail:
PyMem_Free(name);
return file_obj;

___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D12314: stringutil: remove Python 2 support code

2022-03-02 Thread indygreg (Gregory Szorc)
indygreg created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/utils/stringutil.py

CHANGE DETAILS

diff --git a/mercurial/utils/stringutil.py b/mercurial/utils/stringutil.py
--- a/mercurial/utils/stringutil.py
+++ b/mercurial/utils/stringutil.py
@@ -964,6 +964,4 @@
 def evalpythonliteral(s):
 """Evaluate a string containing a Python literal expression"""
 # We could backport our tokenizer hack to rewrite '' to u'' if we want
-if pycompat.ispy3:
-return ast.literal_eval(s.decode('latin1'))
-return ast.literal_eval(s)
+return ast.literal_eval(s.decode('latin1'))



To: indygreg, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D12313: procutil: delete Python 2 support code

2022-03-02 Thread indygreg (Gregory Szorc)
indygreg created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  This entailed deleting a function for Python 2 support and renaming the
  Python 3 function to match the exported symbol name.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/utils/procutil.py

CHANGE DETAILS

diff --git a/mercurial/utils/procutil.py b/mercurial/utils/procutil.py
--- a/mercurial/utils/procutil.py
+++ b/mercurial/utils/procutil.py
@@ -80,7 +80,7 @@
 
 
 def make_line_buffered(stream):
-if pycompat.ispy3 and not isinstance(stream, io.BufferedIOBase):
+if not isinstance(stream, io.BufferedIOBase):
 # On Python 3, buffered streams can be expected to subclass
 # BufferedIOBase. This is definitively the case for the streams
 # initialized by the interpreter. For unbuffered streams, we don't need
@@ -121,7 +121,6 @@
 
 
 def _make_write_all(stream):
-assert pycompat.ispy3
 if isinstance(stream, WriteAllWrapper):
 return stream
 if isinstance(stream, io.BufferedIOBase):
@@ -133,52 +132,32 @@
 return WriteAllWrapper(stream)
 
 
-if pycompat.ispy3:
-# Python 3 implements its own I/O streams. Unlike stdio of C library,
-# sys.stdin/stdout/stderr may be None if underlying fd is closed.
-
-# TODO: .buffer might not exist if std streams were replaced; we'll need
-# a silly wrapper to make a bytes stream backed by a unicode one.
+# Python 3 implements its own I/O streams. Unlike stdio of C library,
+# sys.stdin/stdout/stderr may be None if underlying fd is closed.
 
-if sys.stdin is None:
-stdin = BadFile()
-else:
-stdin = sys.stdin.buffer
-if sys.stdout is None:
-stdout = BadFile()
-else:
-stdout = _make_write_all(sys.stdout.buffer)
-if sys.stderr is None:
-stderr = BadFile()
-else:
-stderr = _make_write_all(sys.stderr.buffer)
+# TODO: .buffer might not exist if std streams were replaced; we'll need
+# a silly wrapper to make a bytes stream backed by a unicode one.
 
-if pycompat.iswindows:
-# Work around Windows bugs.
-stdout = platform.winstdout(stdout)  # pytype: disable=module-attr
-stderr = platform.winstdout(stderr)  # pytype: disable=module-attr
-if isatty(stdout):
-# The standard library doesn't offer line-buffered binary streams.
-stdout = make_line_buffered(stdout)
+if sys.stdin is None:
+stdin = BadFile()
+else:
+stdin = sys.stdin.buffer
+if sys.stdout is None:
+stdout = BadFile()
 else:
-# Python 2 uses the I/O streams provided by the C library.
-stdin = sys.stdin
-stdout = sys.stdout
-stderr = sys.stderr
-if pycompat.iswindows:
-# Work around Windows bugs.
-stdout = platform.winstdout(stdout)  # pytype: disable=module-attr
-stderr = platform.winstdout(stderr)  # pytype: disable=module-attr
-if isatty(stdout):
-if pycompat.iswindows:
-# The Windows C runtime library doesn't support line buffering.
-stdout = make_line_buffered(stdout)
-else:
-# glibc determines buffering on first write to stdout - if we
-# replace a TTY destined stdout with a pipe destined stdout (e.g.
-# pager), we want line buffering.
-stdout = os.fdopen(stdout.fileno(), 'wb', 1)
+stdout = _make_write_all(sys.stdout.buffer)
+if sys.stderr is None:
+stderr = BadFile()
+else:
+stderr = _make_write_all(sys.stderr.buffer)
 
+if pycompat.iswindows:
+# Work around Windows bugs.
+stdout = platform.winstdout(stdout)  # pytype: disable=module-attr
+stderr = platform.winstdout(stderr)  # pytype: disable=module-attr
+if isatty(stdout):
+# The standard library doesn't offer line-buffered binary streams.
+stdout = make_line_buffered(stdout)
 
 findexe = platform.findexe
 _gethgcmd = platform.gethgcmd
@@ -703,7 +682,7 @@
 
 else:
 
-def runbgcommandpy3(
+def runbgcommand(
 cmd,
 env,
 shell=False,
@@ -786,128 +765,3 @@
 returncode = p.wait
 if record_wait is not None:
 record_wait(returncode)
-
-def runbgcommandpy2(
-cmd,
-env,
-shell=False,
-stdout=None,
-stderr=None,
-ensurestart=True,
-record_wait=None,
-stdin_bytes=None,
-):
-"""Spawn a command without waiting for it to finish.
-
-
-When `record_wait` is not None, the spawned process will not be fully
-detached and the `record_wait` argument will be called with a the
-`Subprocess.wait` function for the spawned process.  This is mostly
-useful for developers that need to make sure the spawned process
-finished before a certain point. (eg: writing test)"""
-if pycompat.isdarwin:
-# avoid crash in 

D12312: revlogutils: unconditionally pass version to random seed

2022-03-02 Thread indygreg (Gregory Szorc)
indygreg created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/revlogutils/docket.py

CHANGE DETAILS

diff --git a/mercurial/revlogutils/docket.py b/mercurial/revlogutils/docket.py
--- a/mercurial/revlogutils/docket.py
+++ b/mercurial/revlogutils/docket.py
@@ -25,7 +25,6 @@
 encoding,
 error,
 node,
-pycompat,
 util,
 )
 
@@ -65,10 +64,7 @@
 low_part = (int_seed & low_mask) << 28
 int_seed = high_part + low_part + i
 r = random.Random()
-if pycompat.ispy3:
-r.seed(int_seed, version=1)
-else:
-r.seed(int_seed)
+r.seed(int_seed, version=1)
 # once we drop python 3.8 support we can simply use r.randbytes
 raw = r.getrandbits(id_size * 4)
 assert id_size == 8



To: indygreg, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D12311: revlogutils: remove Python 2 variant for iter_seed

2022-03-02 Thread indygreg (Gregory Szorc)
indygreg created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/revlogutils/docket.py

CHANGE DETAILS

diff --git a/mercurial/revlogutils/docket.py b/mercurial/revlogutils/docket.py
--- a/mercurial/revlogutils/docket.py
+++ b/mercurial/revlogutils/docket.py
@@ -56,12 +56,7 @@
 if inst.errno != errno.ENOENT:
 raise
 seed = b'04'  # chosen by a fair dice roll. garanteed to be random
-if pycompat.ispy3:
-iter_seed = iter(seed)
-else:
-# pytype: disable=wrong-arg-types
-iter_seed = (ord(c) for c in seed)
-# pytype: enable=wrong-arg-types
+iter_seed = iter(seed)
 # some basic circular sum hashing on 64 bits
 int_seed = 0
 low_mask = int('1' * 35, 2)



To: indygreg, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D12310: charencode: remove Python 2 support code

2022-03-02 Thread indygreg (Gregory Szorc)
indygreg created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/pure/charencode.py

CHANGE DETAILS

diff --git a/mercurial/pure/charencode.py b/mercurial/pure/charencode.py
--- a/mercurial/pure/charencode.py
+++ b/mercurial/pure/charencode.py
@@ -67,10 +67,7 @@
 raise ValueError
 
 
-if pycompat.ispy3:
-_utf8strict = r'surrogatepass'
-else:
-_utf8strict = r'strict'
+_utf8strict = r'surrogatepass'
 
 
 def jsonescapeu8fallback(u8chars, paranoid):



To: indygreg, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D12309: hgweb: remove Python 2 support code

2022-03-02 Thread indygreg (Gregory Szorc)
indygreg created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/hgweb/server.py

CHANGE DETAILS

diff --git a/mercurial/hgweb/server.py b/mercurial/hgweb/server.py
--- a/mercurial/hgweb/server.py
+++ b/mercurial/hgweb/server.py
@@ -185,18 +185,11 @@
 env['REMOTE_ADDR'] = self.client_address[0]
 env['QUERY_STRING'] = query or ''
 
-if pycompat.ispy3:
-if self.headers.get_content_type() is None:
-env['CONTENT_TYPE'] = self.headers.get_default_type()
-else:
-env['CONTENT_TYPE'] = self.headers.get_content_type()
-length = self.headers.get('content-length')
+if self.headers.get_content_type() is None:
+env['CONTENT_TYPE'] = self.headers.get_default_type()
 else:
-if self.headers.typeheader is None:
-env['CONTENT_TYPE'] = self.headers.type
-else:
-env['CONTENT_TYPE'] = self.headers.typeheader
-length = self.headers.getheader('content-length')
+env['CONTENT_TYPE'] = self.headers.get_content_type()
+length = self.headers.get('content-length')
 if length:
 env['CONTENT_LENGTH'] = length
 for header in [



To: indygreg, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D12300: util: remove superfluous ispy3 test

2022-03-02 Thread indygreg (Gregory Szorc)
indygreg created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/util.py

CHANGE DETAILS

diff --git a/mercurial/util.py b/mercurial/util.py
--- a/mercurial/util.py
+++ b/mercurial/util.py
@@ -188,7 +188,7 @@
 warnings.filterwarnings('default', '', DeprecationWarning, 'mercurial')
 warnings.filterwarnings('default', '', DeprecationWarning, 'hgext')
 warnings.filterwarnings('default', '', DeprecationWarning, 'hgext3rd')
-if _dowarn and pycompat.ispy3:
+if _dowarn:
 # silence warning emitted by passing user string to re.sub()
 warnings.filterwarnings(
 'ignore', 'bad escape', DeprecationWarning, 'mercurial'



To: indygreg, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D12307: hgweb: simplify uenv assignment

2022-03-02 Thread indygreg (Gregory Szorc)
indygreg created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  We don't need the Python 3 conditional. We can call items() directly
  since we're on Python 3 now.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/hgweb/hgwebdir_mod.py

CHANGE DETAILS

diff --git a/mercurial/hgweb/hgwebdir_mod.py b/mercurial/hgweb/hgwebdir_mod.py
--- a/mercurial/hgweb/hgwebdir_mod.py
+++ b/mercurial/hgweb/hgwebdir_mod.py
@@ -460,12 +460,9 @@
 if real:
 # Re-parse the WSGI environment to take into account our
 # repository path component.
-uenv = req.rawenv
-if pycompat.ispy3:
-uenv = {
-k.decode('latin1'): v
-for k, v in pycompat.iteritems(uenv)
-}
+uenv = {
+k.decode('latin1'): v for k, v in req.rawenv.items()
+}
 req = requestmod.parserequestfromenv(
 uenv,
 reponame=virtualrepo,



To: indygreg, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D12308: hgweb: remove Python 3 conditional

2022-03-02 Thread indygreg (Gregory Szorc)
indygreg created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  We probably have a better tobytes() implementation somewhere in pycompat.
  But I don't want to bloat scope of this commit.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/hgweb/request.py

CHANGE DETAILS

diff --git a/mercurial/hgweb/request.py b/mercurial/hgweb/request.py
--- a/mercurial/hgweb/request.py
+++ b/mercurial/hgweb/request.py
@@ -164,20 +164,18 @@
 # (bytes on Python 2 and str on Python 3). The code points for the Unicode
 # strings on Python 3 must be between \0-\000FF. We deal with bytes
 # in Mercurial, so mass convert string keys and values to bytes.
-if pycompat.ispy3:
+def tobytes(s):
+if not isinstance(s, str):
+return s
+if pycompat.iswindows:
+# This is what mercurial.encoding does for os.environ on
+# Windows.
+return encoding.strtolocal(s)
+else:
+# This is what is documented to be used for os.environ on Unix.
+return pycompat.fsencode(s)
 
-def tobytes(s):
-if not isinstance(s, str):
-return s
-if pycompat.iswindows:
-# This is what mercurial.encoding does for os.environ on
-# Windows.
-return encoding.strtolocal(s)
-else:
-# This is what is documented to be used for os.environ on Unix.
-return pycompat.fsencode(s)
-
-env = {tobytes(k): tobytes(v) for k, v in pycompat.iteritems(env)}
+env = {tobytes(k): tobytes(v) for k, v in pycompat.iteritems(env)}
 
 # Some hosting solutions are emulating hgwebdir, and dispatching directly
 # to an hgweb instance using this environment variable.  This was always



To: indygreg, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D12306: chgserver: remove Python 2 support code

2022-03-02 Thread indygreg (Gregory Szorc)
indygreg created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  The logic here is more complicated than most Python 2/3 support code.
  But the rewritten logic should be identical.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/chgserver.py

CHANGE DETAILS

diff --git a/mercurial/chgserver.py b/mercurial/chgserver.py
--- a/mercurial/chgserver.py
+++ b/mercurial/chgserver.py
@@ -439,16 +439,13 @@
 ui = self.ui
 for (ch, fp, fd), (cn, fn, mode) in zip(self._oldios, _iochannels):
 newfp = getattr(ui, fn)
-# On Python 2, newfp and fp may be separate file objects associated
-# with the same fd, so we must close newfp while it's associated
-# with the client. Otherwise the new associated fd would be closed
-# when newfp gets deleted. On Python 3, newfp is just a wrapper
-# around fp even if newfp is not fp, so deleting newfp is safe.
-if not (pycompat.ispy3 or newfp is fp):
+# On Python 3, newfp is just a wrapper around fp even if newfp is
+# not fp, so deleting newfp is safe.
+if newfp is not fp:
 newfp.close()
 # restore original fd: fp is open again
 try:
-if (pycompat.ispy3 or newfp is fp) and 'w' in mode:
+if newfp is fp and 'w' in mode:
 # Discard buffered data which couldn't be flushed because
 # of EPIPE. The data should belong to the current session
 # and should never persist.



To: indygreg, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D12305: chgserver: remove Python 2 branch

2022-03-02 Thread indygreg (Gregory Szorc)
indygreg created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/chgserver.py

CHANGE DETAILS

diff --git a/mercurial/chgserver.py b/mercurial/chgserver.py
--- a/mercurial/chgserver.py
+++ b/mercurial/chgserver.py
@@ -408,22 +408,13 @@
 # be unbuffered no matter if it is a tty or not.
 if fn == b'ferr':
 newfp = fp
-elif pycompat.ispy3:
+else:
 # On Python 3, the standard library doesn't offer line-buffered
 # binary streams, so wrap/unwrap it.
 if fp.isatty():
 newfp = procutil.make_line_buffered(fp)
 else:
 newfp = procutil.unwrap_line_buffered(fp)
-else:
-# Python 2 uses the I/O streams provided by the C library, so
-# make it line-buffered explicitly. Otherwise the default would
-# be decided on first write(), where fout could be a pager.
-if fp.isatty():
-bufsize = 1  # line buffered
-else:
-bufsize = -1  # system default
-newfp = os.fdopen(fp.fileno(), mode, bufsize)
 if newfp is not fp:
 setattr(ui, fn, newfp)
 setattr(self, cn, newfp)



To: indygreg, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D12303: wireprotoframing: remove Python 2 support code

2022-03-02 Thread indygreg (Gregory Szorc)
indygreg created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/wireprotoframing.py

CHANGE DETAILS

diff --git a/mercurial/wireprotoframing.py b/mercurial/wireprotoframing.py
--- a/mercurial/wireprotoframing.py
+++ b/mercurial/wireprotoframing.py
@@ -761,11 +761,6 @@
 self._decompressor = zlib.decompressobj()
 
 def decode(self, data):
-# Python 2's zlib module doesn't use the buffer protocol and can't
-# handle all bytes-like types.
-if not pycompat.ispy3 and isinstance(data, bytearray):
-data = bytes(data)
-
 return self._decompressor.decompress(data)
 
 



To: indygreg, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D12304: worker: remove Python 2 support code

2022-03-02 Thread indygreg (Gregory Szorc)
indygreg created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/worker.py

CHANGE DETAILS

diff --git a/mercurial/worker.py b/mercurial/worker.py
--- a/mercurial/worker.py
+++ b/mercurial/worker.py
@@ -64,50 +64,39 @@
 return min(max(countcpus(), 4), 32)
 
 
-if pycompat.ispy3:
+def ismainthread():
+return threading.current_thread() == threading.main_thread()
 
-def ismainthread():
-return threading.current_thread() == threading.main_thread()
-
-class _blockingreader(object):
-def __init__(self, wrapped):
-self._wrapped = wrapped
 
-# Do NOT implement readinto() by making it delegate to
-# _wrapped.readinto(), since that is unbuffered. The unpickler is fine
-# with just read() and readline(), so we don't need to implement it.
+class _blockingreader(object):
+def __init__(self, wrapped):
+self._wrapped = wrapped
 
-def readline(self):
-return self._wrapped.readline()
+# Do NOT implement readinto() by making it delegate to
+# _wrapped.readinto(), since that is unbuffered. The unpickler is fine
+# with just read() and readline(), so we don't need to implement it.
 
-# issue multiple reads until size is fulfilled
-def read(self, size=-1):
-if size < 0:
-return self._wrapped.readall()
+def readline(self):
+return self._wrapped.readline()
 
-buf = bytearray(size)
-view = memoryview(buf)
-pos = 0
+# issue multiple reads until size is fulfilled
+def read(self, size=-1):
+if size < 0:
+return self._wrapped.readall()
 
-while pos < size:
-ret = self._wrapped.readinto(view[pos:])
-if not ret:
-break
-pos += ret
+buf = bytearray(size)
+view = memoryview(buf)
+pos = 0
 
-del view
-del buf[pos:]
-return bytes(buf)
-
-else:
+while pos < size:
+ret = self._wrapped.readinto(view[pos:])
+if not ret:
+break
+pos += ret
 
-def ismainthread():
-# pytype: disable=module-attr
-return isinstance(threading.current_thread(), threading._MainThread)
-# pytype: enable=module-attr
-
-def _blockingreader(wrapped):
-return wrapped
+del view
+del buf[pos:]
+return bytes(buf)
 
 
 if pycompat.isposix or pycompat.iswindows:



To: indygreg, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D12302: windows: remove write throttling support

2022-03-02 Thread indygreg (Gregory Szorc)
indygreg created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  This mode would only be active on Python 2, which is no longer supported.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/windows.py

CHANGE DETAILS

diff --git a/mercurial/windows.py b/mercurial/windows.py
--- a/mercurial/windows.py
+++ b/mercurial/windows.py
@@ -225,7 +225,6 @@
 
 def __init__(self, fp):
 self.fp = fp
-self.throttle = not pycompat.ispy3 and _isatty(fp)
 
 def __getattr__(self, key):
 return getattr(self.fp, key)
@@ -238,17 +237,7 @@
 
 def write(self, s):
 try:
-if not self.throttle:
-return self.fp.write(s)
-# This is workaround for "Not enough space" error on
-# writing large size of data to console.
-limit = 16000
-l = len(s)
-start = 0
-while start < l:
-end = start + limit
-self.fp.write(s[start:end])
-start = end
+return self.fp.write(s)
 except IOError as inst:
 if inst.errno != 0 and not win32.lasterrorwaspipeerror(inst):
 raise



To: indygreg, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D12301: windows: remove conditional for Python 3

2022-03-02 Thread indygreg (Gregory Szorc)
indygreg created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/windows.py

CHANGE DETAILS

diff --git a/mercurial/windows.py b/mercurial/windows.py
--- a/mercurial/windows.py
+++ b/mercurial/windows.py
@@ -162,8 +162,7 @@
 
 # PyFile_FromFd() ignores the name, and seems to report fp.name as the
 # underlying file descriptor.
-if pycompat.ispy3:
-fp = fdproxy(name, fp)
+fp = fdproxy(name, fp)
 
 # The position when opening in append mode is implementation defined, 
so
 # make it consistent with other platforms, which position at EOF.



To: indygreg, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D12298: keepalive: remove Python 2 support code

2022-03-02 Thread indygreg (Gregory Szorc)
indygreg created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/keepalive.py

CHANGE DETAILS

diff --git a/mercurial/keepalive.py b/mercurial/keepalive.py
--- a/mercurial/keepalive.py
+++ b/mercurial/keepalive.py
@@ -398,12 +398,8 @@
 # modification from socket.py
 
 def __init__(self, sock, debuglevel=0, strict=0, method=None):
-extrakw = {}
-if not pycompat.ispy3:
-extrakw['strict'] = True
-extrakw['buffering'] = True
 httplib.HTTPResponse.__init__(
-self, sock, debuglevel=debuglevel, method=method, **extrakw
+self, sock, debuglevel=debuglevel, method=method
 )
 self.fileno = sock.fileno
 self.code = None



To: indygreg, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D12297: extensions: remove superfluous pycompat.ispy3 check

2022-03-02 Thread indygreg (Gregory Szorc)
indygreg created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  This is always True now.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/extensions.py

CHANGE DETAILS

diff --git a/mercurial/extensions.py b/mercurial/extensions.py
--- a/mercurial/extensions.py
+++ b/mercurial/extensions.py
@@ -875,7 +875,7 @@
 a = node.args[0]
 if isinstance(a, ast.Str):
 name = pycompat.sysbytes(a.s)
-elif pycompat.ispy3 and isinstance(a, ast.Bytes):
+elif isinstance(a, ast.Bytes):
 name = a.s
 else:
 continue



To: indygreg, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D12294: dispatch: remove Python 2 function variants

2022-03-02 Thread indygreg (Gregory Szorc)
indygreg created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/dispatch.py

CHANGE DETAILS

diff --git a/mercurial/dispatch.py b/mercurial/dispatch.py
--- a/mercurial/dispatch.py
+++ b/mercurial/dispatch.py
@@ -149,92 +149,76 @@
 sys.exit(status & 255)
 
 
-if pycompat.ispy3:
-
-def initstdio():
-# stdio streams on Python 3 are io.TextIOWrapper instances proxying 
another
-# buffer. These streams will normalize \n to \r\n by default. 
Mercurial's
-# preferred mechanism for writing output (ui.write()) uses 
io.BufferedWriter
-# instances, which write to the underlying stdio file descriptor in 
binary
-# mode. ui.write() uses \n for line endings and no line ending 
normalization
-# is attempted through this interface. This "just works," even if the 
system
-# preferred line ending is not \n.
-#
-# But some parts of Mercurial (e.g. hooks) can still send data to 
sys.stdout
-# and sys.stderr. They will inherit the line ending normalization 
settings,
-# potentially causing e.g. \r\n to be emitted. Since emitting \n should
-# "just work," here we change the sys.* streams to disable line ending
-# normalization, ensuring compatibility with our ui type.
+def initstdio():
+# stdio streams on Python 3 are io.TextIOWrapper instances proxying another
+# buffer. These streams will normalize \n to \r\n by default. Mercurial's
+# preferred mechanism for writing output (ui.write()) uses 
io.BufferedWriter
+# instances, which write to the underlying stdio file descriptor in binary
+# mode. ui.write() uses \n for line endings and no line ending 
normalization
+# is attempted through this interface. This "just works," even if the 
system
+# preferred line ending is not \n.
+#
+# But some parts of Mercurial (e.g. hooks) can still send data to 
sys.stdout
+# and sys.stderr. They will inherit the line ending normalization settings,
+# potentially causing e.g. \r\n to be emitted. Since emitting \n should
+# "just work," here we change the sys.* streams to disable line ending
+# normalization, ensuring compatibility with our ui type.
 
-if sys.stdout is not None:
-# write_through is new in Python 3.7.
-kwargs = {
-"newline": "\n",
-"line_buffering": sys.stdout.line_buffering,
-}
-if util.safehasattr(sys.stdout, "write_through"):
-# pytype: disable=attribute-error
-kwargs["write_through"] = sys.stdout.write_through
-# pytype: enable=attribute-error
-sys.stdout = io.TextIOWrapper(
-sys.stdout.buffer,
-sys.stdout.encoding,
-sys.stdout.errors,
-**kwargs
-)
+if sys.stdout is not None:
+# write_through is new in Python 3.7.
+kwargs = {
+"newline": "\n",
+"line_buffering": sys.stdout.line_buffering,
+}
+if util.safehasattr(sys.stdout, "write_through"):
+# pytype: disable=attribute-error
+kwargs["write_through"] = sys.stdout.write_through
+# pytype: enable=attribute-error
+sys.stdout = io.TextIOWrapper(
+sys.stdout.buffer, sys.stdout.encoding, sys.stdout.errors, **kwargs
+)
 
-if sys.stderr is not None:
-kwargs = {
-"newline": "\n",
-"line_buffering": sys.stderr.line_buffering,
-}
-if util.safehasattr(sys.stderr, "write_through"):
-# pytype: disable=attribute-error
-kwargs["write_through"] = sys.stderr.write_through
-# pytype: enable=attribute-error
-sys.stderr = io.TextIOWrapper(
-sys.stderr.buffer,
-sys.stderr.encoding,
-sys.stderr.errors,
-**kwargs
-)
+if sys.stderr is not None:
+kwargs = {
+"newline": "\n",
+"line_buffering": sys.stderr.line_buffering,
+}
+if util.safehasattr(sys.stderr, "write_through"):
+# pytype: disable=attribute-error
+kwargs["write_through"] = sys.stderr.write_through
+# pytype: enable=attribute-error
+sys.stderr = io.TextIOWrapper(
+sys.stderr.buffer, sys.stderr.encoding, sys.stderr.errors, **kwargs
+)
 
-if sys.stdin is not None:
-# No write_through on read-only stream.
-sys.stdin = io.TextIOWrapper(
-sys.stdin.buffer,
-sys.stdin.encoding,
-sys.stdin.errors,
-# None is universal newlines mode.
-  

D12299: urllibcompat: remove Python 2 support code

2022-03-02 Thread indygreg (Gregory Szorc)
indygreg created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  We had to move the `import` statements to appease the import checker.
  
  This whole module could probably be deleted as its point in life is to
  pave over Python 2/3 differences. But that's for a different commit.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/urllibcompat.py

CHANGE DETAILS

diff --git a/mercurial/urllibcompat.py b/mercurial/urllibcompat.py
--- a/mercurial/urllibcompat.py
+++ b/mercurial/urllibcompat.py
@@ -5,6 +5,12 @@
 # This software may be used and distributed according to the terms of the
 # GNU General Public License version 2 or any later version.
 
+import http.server
+import urllib.error
+import urllib.parse
+import urllib.request
+import urllib.response
+
 from .pycompat import getattr
 from . import pycompat
 
@@ -39,198 +45,109 @@
 urlreq = _pycompatstub()
 urlerr = _pycompatstub()
 
-if pycompat.ispy3:
-import urllib.parse
-
-urlreq._registeraliases(
-urllib.parse,
-(
-b"splitattr",
-b"splitpasswd",
-b"splitport",
-b"splituser",
-b"urlparse",
-b"urlunparse",
-),
-)
-urlreq._registeralias(urllib.parse, b"parse_qs", b"parseqs")
-urlreq._registeralias(urllib.parse, b"parse_qsl", b"parseqsl")
-urlreq._registeralias(urllib.parse, b"unquote_to_bytes", b"unquote")
-import urllib.request
-
-urlreq._registeraliases(
-urllib.request,
-(
-b"AbstractHTTPHandler",
-b"BaseHandler",
-b"build_opener",
-b"FileHandler",
-b"FTPHandler",
-b"ftpwrapper",
-b"HTTPHandler",
-b"HTTPSHandler",
-b"install_opener",
-b"pathname2url",
-b"HTTPBasicAuthHandler",
-b"HTTPDigestAuthHandler",
-b"HTTPPasswordMgrWithDefaultRealm",
-b"ProxyHandler",
-b"Request",
-b"url2pathname",
-b"urlopen",
-),
-)
-import urllib.response
+urlreq._registeraliases(
+urllib.parse,
+(
+b"splitattr",
+b"splitpasswd",
+b"splitport",
+b"splituser",
+b"urlparse",
+b"urlunparse",
+),
+)
+urlreq._registeralias(urllib.parse, b"parse_qs", b"parseqs")
+urlreq._registeralias(urllib.parse, b"parse_qsl", b"parseqsl")
+urlreq._registeralias(urllib.parse, b"unquote_to_bytes", b"unquote")
 
-urlreq._registeraliases(
-urllib.response,
-(
-b"addclosehook",
-b"addinfourl",
-),
-)
-import urllib.error
-
-urlerr._registeraliases(
-urllib.error,
-(
-b"HTTPError",
-b"URLError",
-),
-)
-import http.server
+urlreq._registeraliases(
+urllib.request,
+(
+b"AbstractHTTPHandler",
+b"BaseHandler",
+b"build_opener",
+b"FileHandler",
+b"FTPHandler",
+b"ftpwrapper",
+b"HTTPHandler",
+b"HTTPSHandler",
+b"install_opener",
+b"pathname2url",
+b"HTTPBasicAuthHandler",
+b"HTTPDigestAuthHandler",
+b"HTTPPasswordMgrWithDefaultRealm",
+b"ProxyHandler",
+b"Request",
+b"url2pathname",
+b"urlopen",
+),
+)
 
-httpserver._registeraliases(
-http.server,
-(
-b"HTTPServer",
-b"BaseHTTPRequestHandler",
-b"SimpleHTTPRequestHandler",
-b"CGIHTTPRequestHandler",
-),
-)
 
-# urllib.parse.quote() accepts both str and bytes, decodes bytes
-# (if necessary), and returns str. This is wonky. We provide a custom
-# implementation that only accepts bytes and emits bytes.
-def quote(s, safe='/'):
-# bytestr has an __iter__ that emits characters. quote_from_bytes()
-# does an iteration and expects ints. We coerce to bytes to appease it.
-if isinstance(s, pycompat.bytestr):
-s = bytes(s)
-s = urllib.parse.quote_from_bytes(s, safe=safe)
-return s.encode('ascii', 'strict')
-
-# urllib.parse.urlencode() returns str. We use this function to make
-# sure we return bytes.
-def urlencode(query, doseq=False):
-s = urllib.parse.urlencode(query, doseq=doseq)
-return s.encode('ascii')
-
-urlreq.quote = quote
-urlreq.urlencode = urlencode
-
-def getfullurl(req):
-return req.full_url
-
-def gethost(req):
-return req.host
+urlreq._registeraliases(
+urllib.response,
+(
+b"addclosehook",
+b"addinfourl",
+),
+)
 
-def getselector(req):
-return req.selector
-
-def getdata(req):
-return req.data
-
-def hasdata(req):
-return req.data is not None

D12296: archival: remove check for Python 2

2022-03-02 Thread indygreg (Gregory Szorc)
indygreg created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/archival.py

CHANGE DETAILS

diff --git a/mercurial/archival.py b/mercurial/archival.py
--- a/mercurial/archival.py
+++ b/mercurial/archival.py
@@ -305,9 +305,6 @@
 subrepos tells whether to include subrepos.
 """
 
-if kind == b'txz' and not pycompat.ispy3:
-raise error.Abort(_(b'xz compression is only available in Python 3'))
-
 if kind == b'files':
 if prefix:
 raise error.Abort(_(b'cannot give prefix when archiving to files'))



To: indygreg, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D12295: encoding: remove Python 2 support code

2022-03-02 Thread indygreg (Gregory Szorc)
indygreg created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/encoding.py

CHANGE DETAILS

diff --git a/mercurial/encoding.py b/mercurial/encoding.py
--- a/mercurial/encoding.py
+++ b/mercurial/encoding.py
@@ -46,8 +46,7 @@
 
 _sysstr = pycompat.sysstr
 
-if pycompat.ispy3:
-unichr = chr
+unichr = chr
 
 # These unicode characters are ignored by HFS+ (Apple Technote 1150,
 # "Unicode Subtleties"), so we need to ignore them in some places for
@@ -78,10 +77,8 @@
 
 # encoding.environ is provided read-only, which may not be used to modify
 # the process environment
-_nativeenviron = not pycompat.ispy3 or os.supports_bytes_environ
-if not pycompat.ispy3:
-environ = os.environ  # re-exports
-elif _nativeenviron:
+_nativeenviron = os.supports_bytes_environ
+if _nativeenviron:
 environ = os.environb  # re-exports
 else:
 # preferred encoding isn't known yet; use utf-8 to avoid unicode error
@@ -98,7 +95,7 @@
 # cp65001 is a Windows variant of utf-8, which isn't supported on Python 2.
 # No idea if it should be rewritten to the canonical name 'utf-8' on Python 3.
 # https://bugs.python.org/issue13216
-if pycompat.iswindows and not pycompat.ispy3:
+if pycompat.iswindows:
 _encodingrewrites[b'cp65001'] = b'utf-8'
 
 try:
@@ -270,21 +267,9 @@
 # converter functions between native str and byte string. use these if the
 # character encoding is not aware (e.g. exception message) or is known to
 # be locale dependent (e.g. date formatting.)
-if pycompat.ispy3:
-strtolocal = unitolocal
-strfromlocal = unifromlocal
-strmethod = unimethod
-else:
-
-def strtolocal(s):
-# type: (str) -> bytes
-return s  # pytype: disable=bad-return-type
-
-def strfromlocal(s):
-# type: (bytes) -> str
-return s  # pytype: disable=bad-return-type
-
-strmethod = pycompat.identity
+strtolocal = unitolocal
+strfromlocal = unifromlocal
+strmethod = unimethod
 
 
 def lower(s):
@@ -344,7 +329,7 @@
 if not _nativeenviron:
 # now encoding and helper functions are available, recreate the environ
 # dict to be exported to other modules
-if pycompat.iswindows and pycompat.ispy3:
+if pycompat.iswindows:
 
 class WindowsEnviron(dict):
 """`os.environ` normalizes environment variables to uppercase on 
windows"""
@@ -360,36 +345,33 @@
 
 DRIVE_RE = re.compile(b'^[a-z]:')
 
-if pycompat.ispy3:
-# os.getcwd() on Python 3 returns string, but it has os.getcwdb() which
-# returns bytes.
-if pycompat.iswindows:
-# Python 3 on Windows issues a DeprecationWarning about using the bytes
-# API when os.getcwdb() is called.
-#
-# Additionally, py3.8+ uppercases the drive letter when calling
-# os.path.realpath(), which is used on ``repo.root``.  Since those
-# strings are compared in various places as simple strings, also call
-# realpath here.  See https://bugs.python.org/issue40368
-#
-# However this is not reliable, so lets explicitly make this drive
-# letter upper case.
-#
-# note: we should consider dropping realpath here since it seems to
-# change the semantic of `getcwd`.
+# os.getcwd() on Python 3 returns string, but it has os.getcwdb() which
+# returns bytes.
+if pycompat.iswindows:
+# Python 3 on Windows issues a DeprecationWarning about using the bytes
+# API when os.getcwdb() is called.
+#
+# Additionally, py3.8+ uppercases the drive letter when calling
+# os.path.realpath(), which is used on ``repo.root``.  Since those
+# strings are compared in various places as simple strings, also call
+# realpath here.  See https://bugs.python.org/issue40368
+#
+# However this is not reliable, so lets explicitly make this drive
+# letter upper case.
+#
+# note: we should consider dropping realpath here since it seems to
+# change the semantic of `getcwd`.
 
-def getcwd():
-cwd = os.getcwd()  # re-exports
-cwd = os.path.realpath(cwd)
-cwd = strtolocal(cwd)
-if DRIVE_RE.match(cwd):
-cwd = cwd[0:1].upper() + cwd[1:]
-return cwd
+def getcwd():
+cwd = os.getcwd()  # re-exports
+cwd = os.path.realpath(cwd)
+cwd = strtolocal(cwd)
+if DRIVE_RE.match(cwd):
+cwd = cwd[0:1].upper() + cwd[1:]
+return cwd
 
-else:
-getcwd = os.getcwdb  # re-exports
 else:
-getcwd = os.getcwd  # re-exports
+getcwd = os.getcwdb  # re-exports
 
 # How to treat ambiguous-width characters. Set to 'wide' to treat as wide.
 _wide = _sysstr(
@@ -600,10 +582,7 @@
 
 # We need to decode/encode U+DCxx codes transparently since invalid UTF-8
 # bytes are mapped to that range.
-if 

D12291: formatter: remove conditional assert

2022-03-02 Thread indygreg (Gregory Szorc)
indygreg created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  We always run on Python 3 now.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/formatter.py

CHANGE DETAILS

diff --git a/mercurial/formatter.py b/mercurial/formatter.py
--- a/mercurial/formatter.py
+++ b/mercurial/formatter.py
@@ -558,8 +558,7 @@
 
 
 def literal_templatespec(tmpl):
-if pycompat.ispy3:
-assert not isinstance(tmpl, str), b'tmpl must not be a str'
+assert not isinstance(tmpl, str), b'tmpl must not be a str'
 return templatespec(b'', tmpl, None)
 
 



To: indygreg, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D12292: error: unconditionally define __str__

2022-03-02 Thread indygreg (Gregory Szorc)
indygreg created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  We always run on Python 3 now.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/error.py

CHANGE DETAILS

diff --git a/mercurial/error.py b/mercurial/error.py
--- a/mercurial/error.py
+++ b/mercurial/error.py
@@ -68,14 +68,12 @@
 def __bytes__(self):
 return self.message
 
-if pycompat.ispy3:
-
-def __str__(self):
-# type: () -> str
-# the output would be unreadable if the message was translated,
-# but do not replace it with encoding.strfromlocal(), which
-# may raise another exception.
-return pycompat.sysstr(self.__bytes__())
+def __str__(self):
+# type: () -> str
+# the output would be unreadable if the message was translated,
+# but do not replace it with encoding.strfromlocal(), which
+# may raise another exception.
+return pycompat.sysstr(self.__bytes__())
 
 def format(self):
 # type: () -> bytes



To: indygreg, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D12293: config: remove conditional asserts

2022-03-02 Thread indygreg (Gregory Szorc)
indygreg created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  We always run on Python 3 now.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/config.py

CHANGE DETAILS

diff --git a/mercurial/config.py b/mercurial/config.py
--- a/mercurial/config.py
+++ b/mercurial/config.py
@@ -114,16 +114,15 @@
 return [(k, v[0]) for (k, v) in items]
 
 def set(self, section, item, value, source=b""):
-if pycompat.ispy3:
-assert not isinstance(
-section, str
-), b'config section may not be unicode strings on Python 3'
-assert not isinstance(
-item, str
-), b'config item may not be unicode strings on Python 3'
-assert not isinstance(
-value, str
-), b'config values may not be unicode strings on Python 3'
+assert not isinstance(
+section, str
+), b'config section may not be unicode strings on Python 3'
+assert not isinstance(
+item, str
+), b'config item may not be unicode strings on Python 3'
+assert not isinstance(
+value, str
+), b'config values may not be unicode strings on Python 3'
 if section not in self:
 self._data[section] = util.cowsortdict()
 else:



To: indygreg, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D12287: match: delete Python 2 conditional code

2022-03-02 Thread indygreg (Gregory Szorc)
indygreg created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/match.py

CHANGE DETAILS

diff --git a/mercurial/match.py b/mercurial/match.py
--- a/mercurial/match.py
+++ b/mercurial/match.py
@@ -583,10 +583,7 @@
 if b'' in prefix_set:
 return True
 
-if pycompat.ispy3:
-sl = ord(b'/')
-else:
-sl = '/'
+sl = ord(b'/')
 
 # We already checked that path isn't in prefix_set exactly, so
 # `path[len(pf)] should never raise IndexError.



To: indygreg, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D12290: httppeer: inline simplified _reqdata()

2022-03-02 Thread indygreg (Gregory Szorc)
indygreg created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  The function can be reduced to an attribute lookup on Python 3. So
  inline it.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/httppeer.py

CHANGE DETAILS

diff --git a/mercurial/httppeer.py b/mercurial/httppeer.py
--- a/mercurial/httppeer.py
+++ b/mercurial/httppeer.py
@@ -231,15 +231,6 @@
 return req, cu, qs
 
 
-def _reqdata(req):
-"""Get request data, if any. If no data, returns None."""
-if pycompat.ispy3:
-return req.data
-if not req.has_data():
-return None
-return req.get_data()
-
-
 def sendrequest(ui, opener, req):
 """Send a prepared HTTP request.
 
@@ -274,7 +265,7 @@
 % b'  %d bytes of commands arguments in headers'
 % hgargssize
 )
-data = _reqdata(req)
+data = req.data
 if data is not None:
 length = getattr(data, 'length', None)
 if length is None:



To: indygreg, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D12289: url: remove passing of strict

2022-03-02 Thread indygreg (Gregory Szorc)
indygreg created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  This was needed to support Python 2.7.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/url.py

CHANGE DETAILS

diff --git a/mercurial/url.py b/mercurial/url.py
--- a/mercurial/url.py
+++ b/mercurial/url.py
@@ -246,13 +246,9 @@
 
 # majority of the following code is duplicated from
 # httplib.HTTPConnection as there are no adequate places to
-# override functions to provide the needed functionality
-# strict was removed in Python 3.4.
-kwargs = {}
-if not pycompat.ispy3:
-kwargs[b'strict'] = self.strict
+# override functions to provide the needed functionality.
 
-res = self.response_class(self.sock, method=self._method, **kwargs)
+res = self.response_class(self.sock, method=self._method)
 
 while True:
 version, status, reason = res._read_status()



To: indygreg, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D12288: posix: delete Python 2 support code

2022-03-02 Thread indygreg (Gregory Szorc)
indygreg created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/posix.py

CHANGE DETAILS

diff --git a/mercurial/posix.py b/mercurial/posix.py
--- a/mercurial/posix.py
+++ b/mercurial/posix.py
@@ -59,20 +59,9 @@
 umask = os.umask(0)
 os.umask(umask)
 
-if not pycompat.ispy3:
-
-def posixfile(name, mode='r', buffering=-1):
-fp = open(name, mode=mode, buffering=buffering)
-# The position when opening in append mode is implementation defined, 
so
-# make it consistent by always seeking to the end.
-if 'a' in mode:
-fp.seek(0, os.SEEK_END)
-return fp
-
-else:
-# The underlying file object seeks as required in Python 3:
-# https://github.com/python/cpython/blob/v3.7.3/Modules/_io/fileio.c#L474
-posixfile = open
+# The underlying file object seeks as required in Python 3:
+# https://github.com/python/cpython/blob/v3.7.3/Modules/_io/fileio.c#L474
+posixfile = open
 
 
 def split(p):



To: indygreg, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D12286: mail: delete conditional code for Python 2

2022-03-02 Thread indygreg (Gregory Szorc)
indygreg created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/mail.py

CHANGE DETAILS

diff --git a/mercurial/mail.py b/mercurial/mail.py
--- a/mercurial/mail.py
+++ b/mercurial/mail.py
@@ -467,42 +467,28 @@
 return mimetextqp(s, 'plain', cs)
 
 
-if pycompat.ispy3:
-
-Generator = email.generator.BytesGenerator
+Generator = email.generator.BytesGenerator
 
-def parse(fp):
-# type: (Any) -> email.message.Message
-ep = email.parser.Parser()
-# disable the "universal newlines" mode, which isn't binary safe.
-# I have no idea if ascii/surrogateescape is correct, but that's
-# what the standard Python email parser does.
-fp = io.TextIOWrapper(
-fp, encoding='ascii', errors='surrogateescape', newline=chr(10)
-)
-try:
-return ep.parse(fp)
-finally:
-fp.detach()
 
-def parsebytes(data):
-# type: (bytes) -> email.message.Message
-ep = email.parser.BytesParser()
-return ep.parsebytes(data)
-
-else:
-
-Generator = email.generator.Generator
+def parse(fp):
+# type: (Any) -> email.message.Message
+ep = email.parser.Parser()
+# disable the "universal newlines" mode, which isn't binary safe.
+# I have no idea if ascii/surrogateescape is correct, but that's
+# what the standard Python email parser does.
+fp = io.TextIOWrapper(
+fp, encoding='ascii', errors='surrogateescape', newline=chr(10)
+)
+try:
+return ep.parse(fp)
+finally:
+fp.detach()
 
-def parse(fp):
-# type: (Any) -> email.message.Message
-ep = email.parser.Parser()
-return ep.parse(fp)
 
-def parsebytes(data):
-# type: (str) -> email.message.Message
-ep = email.parser.Parser()
-return ep.parsestr(data)
+def parsebytes(data):
+# type: (bytes) -> email.message.Message
+ep = email.parser.BytesParser()
+return ep.parsebytes(data)
 
 
 def headdecode(s):



To: indygreg, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D12284: check-code: allow importing Python 3 modules

2022-03-02 Thread indygreg (Gregory Szorc)
indygreg created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  Now that we no longer support Python 2, we should be able to import and
  use the Python 3 only modules in our code. So remove a lint banning this.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  contrib/check-code.py

CHANGE DETAILS

diff --git a/contrib/check-code.py b/contrib/check-code.py
--- a/contrib/check-code.py
+++ b/contrib/check-code.py
@@ -430,24 +430,6 @@
 "module-level @cachefunc is risky, please avoid",
 ),
 (
-r'^import Queue',
-"don't use Queue, use pycompat.queue.Queue + "
-"pycompat.queue.Empty",
-),
-(
-r'^import cStringIO',
-"don't use cStringIO.StringIO, use util.stringio",
-),
-(r'^import urllib', "don't use urllib, use util.urlreq/util.urlerr"),
-(
-r'^import SocketServer',
-"don't use SockerServer, use util.socketserver",
-),
-(r'^import urlparse', "don't use urlparse, use util.urlreq"),
-(r'^import xmlrpclib', "don't use xmlrpclib, use util.xmlrpclib"),
-(r'^import httplib', "don't use httplib, use util.httplib"),
-(r'^import BaseHTTPServer', "use util.httpserver instead"),
-(
 r'^(from|import) mercurial\.(cext|pure|cffi)',
 "use mercurial.policy.importmod instead",
 ),



To: indygreg, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D12285: archival: remove GzipFileWithTime

2022-03-02 Thread indygreg (Gregory Szorc)
indygreg created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  This was required for Python 2 support, which we no longer need to support.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/archival.py

CHANGE DETAILS

diff --git a/mercurial/archival.py b/mercurial/archival.py
--- a/mercurial/archival.py
+++ b/mercurial/archival.py
@@ -136,39 +136,6 @@
 """write archive to tar file or stream.  can write uncompressed,
 or compress with gzip or bzip2."""
 
-if pycompat.ispy3:
-GzipFileWithTime = gzip.GzipFile  # camelcase-required
-else:
-
-class GzipFileWithTime(gzip.GzipFile):
-def __init__(self, *args, **kw):
-timestamp = None
-if 'mtime' in kw:
-timestamp = kw.pop('mtime')
-if timestamp is None:
-self.timestamp = time.time()
-else:
-self.timestamp = timestamp
-gzip.GzipFile.__init__(self, *args, **kw)
-
-def _write_gzip_header(self):
-self.fileobj.write(b'\037\213')  # magic header
-self.fileobj.write(b'\010')  # compression method
-fname = self.name
-if fname and fname.endswith(b'.gz'):
-fname = fname[:-3]
-flags = 0
-if fname:
-flags = gzip.FNAME  # pytype: disable=module-attr
-self.fileobj.write(pycompat.bytechr(flags))
-gzip.write32u(  # pytype: disable=module-attr
-self.fileobj, int(self.timestamp)
-)
-self.fileobj.write(b'\002')
-self.fileobj.write(b'\377')
-if fname:
-self.fileobj.write(fname + b'\000')
-
 def __init__(self, dest, mtime, kind=b''):
 self.mtime = mtime
 self.fileobj = None
@@ -178,7 +145,7 @@
 mode = mode[0:1]
 if not fileobj:
 fileobj = open(name, mode + b'b')
-gzfileobj = self.GzipFileWithTime(
+gzfileobj = gzip.GzipFile(
 name,
 pycompat.sysstr(mode + b'b'),
 zlib.Z_BEST_COMPRESSION,



To: indygreg, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: Python 3.x version support / dropping 3.5 and 3.6

2022-03-02 Thread Gregory Szorc
On Wed, Mar 2, 2022 at 11:09 AM Augie Fackler  wrote:

>
>
> On Mar 1, 2022, at 2:53 PM, Raphaël Gomès 
> wrote:
>
>
> On 2/27/22 22:19, Gregory Szorc wrote:
>
> 6.1 will be the last release to support Python 2.7. That means 6.2 will be
> Python 3 only.
>
> Currently our Python 3 support is for 3.5-3.10.
>
> Python 3.5 dropped out of support in September 2020 and Python 3.6 in
> December 2021 (https://endoflife.date/python).
>
> Do we have any interest in dropping support for 3.5 or 3.6 in the 6.2
> release?
>
> Features of interest in 3.6:
>
> * Variable type annotations. (Annotating on <3.6 requires special syntax
> in comments)
> * Stabilization of async (unsure how much we'll adopt async though)
> * PEP 519 path protocol. This might enable us to clean up path handling
> throughout the codebase by adopting richly typed path objects with nice
> path-like primitives.
> * Enhancements to typing module to make it more useful.
>
> Features of interest in 3.7:
>
> * Postponed evaluation of type annotations (this is likely huge for
> managing startup time)
> * importlib.resources (allows us to clean up non-module file loading)
> * @dataclass and data classes
>
> I think the only in-support major distro still supporting 3.5 is Debian 9
> Stretch, which goes out of support on 2022-06-30.
>
> 3.6 is more complicated. CentOS/RHEL 7 and Ubuntu 18.04 ship Python 3.6.
> Although the former is already out of support. Ubuntu 18.04 is still in
> main support until 2023-04-03 and has security support for another few
> years.
>
> My pulse on the larger Python ecosystem is that 3.5 is mostly dead and 3.6
> is starting to wilt but not quite dead. Tons of projects dropped 3.5 in the
> past year.
>
> **So I'd like to propose dropping support for Python 3.5 in 6.2.** That
> would mean 6.1 is our last release with both Python 2.7 and 3.5 support.
>
> Agreed, I think this is cautious enough.
>
> I don't think I can in good faith recommend dropping 3.6 support at this
> time since it is still in wide use. But I do like the allure of the above
> highlighted features in 3.7 and think they could lead to a higher quality
> Mercurial and cleaner code base. If anyone else wants to make the case for
> dropping 3.6 despite its apparent use in supported distros, I'd love to
> hear it.
>
> +1
>
>
> Throwing an idea out there: we stop testing against 3.6 and don’t sweat
> breakages now that it’s EOL upstream, but accept patches from people that
> care (eg distro packagers) to keep it alive for some amount of time after
> the Python version goes EOL.
>

I suspect we'll have to keep minimal test coverage running because once
people start adding non-comment type annotations to the code base, it is
going to be difficult to police ourselves and prevent variable annotations.
(Although I suspect this specific issue can be prevented with a linter
scanning for variable annotations in the parsed token stream.) More
broadly, history has demonstrated that there's a long tail of random Python
version compatibility issues and if we drop testing, things will inevitably
break.

So I strongly believe we should have testing coverage for all supported
Python versions.

Another issue that may start biting us with 3.6 is distutils. This
transition is going to be a mess. 3.10 is already issuing a
DeprecationWarning about its future removal from the stdlib. It appears
setuptools is vendoring distutils to provide API backwards compatibility.
I'm not sure what the minimum Python is for setuptools, but pip has already
dropped 3.6 as of 22.0. And pip and setuptools are still working out
interplay issues related to distutils. I have a very strong feeling that
you'll really need to run a modern setuptools and pip to accommodate the
disutils migration. And if we're supporting 3.6 this may not be possible.
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


mercurial@48822: 14 new changesets

2022-03-02 Thread Mercurial Commits
14 new changesets in mercurial:

https://www.mercurial-scm.org/repo/hg/rev/1d5fd9def5ac
changeset:   48809:1d5fd9def5ac
user:Arseniy Alekseyev 
date:Mon Feb 21 19:51:23 2022 +
summary: rhg: simplify the handling of share-safe config mismatch

https://www.mercurial-scm.org/repo/hg/rev/ed03fffaac30
changeset:   48810:ed03fffaac30
user:Gregory Szorc 
date:Sun Feb 20 15:40:39 2022 -0700
summary: cext: remove Python 2 module initializer functions

https://www.mercurial-scm.org/repo/hg/rev/92c430e7e37a
changeset:   48811:92c430e7e37a
user:Gregory Szorc 
date:Sun Feb 20 15:42:47 2022 -0700
summary: cext: drop preprocessor PyInt aliases

https://www.mercurial-scm.org/repo/hg/rev/9b0f173445d1
changeset:   48812:9b0f173445d1
user:Gregory Szorc 
date:Sun Feb 20 15:43:30 2022 -0700
summary: cext: unconditionally use PyLong_FromLong()

https://www.mercurial-scm.org/repo/hg/rev/be3af7eb2bbb
changeset:   48813:be3af7eb2bbb
user:Gregory Szorc 
date:Sun Feb 20 15:44:39 2022 -0700
summary: cext: remove some conditional preprocessor defines

https://www.mercurial-scm.org/repo/hg/rev/41bd7e8fc82e
changeset:   48814:41bd7e8fc82e
user:Gregory Szorc 
date:Sun Feb 20 15:45:16 2022 -0700
summary: cext: remove Python 2 variant of listdir_slot()

https://www.mercurial-scm.org/repo/hg/rev/e9ca736f5b52
changeset:   48815:e9ca736f5b52
user:Gregory Szorc 
date:Sun Feb 20 15:45:51 2022 -0700
summary: cext: remove Python 2 file handling code

https://www.mercurial-scm.org/repo/hg/rev/824b2082550e
changeset:   48816:824b2082550e
user:Gregory Szorc 
date:Sun Feb 20 15:47:13 2022 -0700
summary: cext: remove Python 2 support

https://www.mercurial-scm.org/repo/hg/rev/c1ad4364a5b5
changeset:   48817:c1ad4364a5b5
user:Gregory Szorc 
date:Sun Feb 20 15:48:35 2022 -0700
summary: cext: use PyLong symbols

https://www.mercurial-scm.org/repo/hg/rev/13d705c98914
changeset:   48818:13d705c98914
user:Gregory Szorc 
date:Sun Feb 20 15:50:46 2022 -0700
summary: cext: use PyLong symbols

https://www.mercurial-scm.org/repo/hg/rev/bf6cdda979ed
changeset:   48819:bf6cdda979ed
user:Gregory Szorc 
date:Sun Feb 20 16:13:23 2022 -0700
summary: cext: unconditionalize PYLONG_VALUE()

https://www.mercurial-scm.org/repo/hg/rev/acf9f778e048
changeset:   48820:acf9f778e048
user:Gregory Szorc 
date:Sun Feb 20 16:13:57 2022 -0700
summary: cext: unconditionalize PySlice_GetIndicesEx()

https://www.mercurial-scm.org/repo/hg/rev/b0dd39b91e7a
changeset:   48821:b0dd39b91e7a
user:Gregory Szorc 
date:Sun Feb 20 16:09:02 2022 -0700
summary: cext: remove PY23()

https://www.mercurial-scm.org/repo/hg/rev/3aa1b7ded52c
changeset:   48822:3aa1b7ded52c
bookmark:@
tag: tip
user:Gregory Szorc 
date:Sun Feb 20 16:11:21 2022 -0700
summary: cext: remove inline rewriting of argv

-- 
Repository URL: https://www.mercurial-scm.org/repo/hg
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: pycompat.py strategy

2022-03-02 Thread Pierre-Yves David


On 2/21/22 19:47, Gregory Szorc wrote:
I'm ~100 patches deep into purging Python 2 from the main repo. (I 
think I'll hold off submitting them until 6.1 is out the door.)


Much of the Python 2 deletion work is trivial. But one question that 
isn't trivial is what to do with pycompat.py.


Some options:

a) Attempt to delete as much as pycompat.py as possible (leaving only 
the pieces needed to abstract over differences in Python 3.5-3.x).
b) Leave the ~complete API provided by pycompat.py and delete pycompat 
usage within the repo as much as possible.
c) Leave the ~complete API provided by pycompat.py and still use 
pycompat heavily within the repo.


In my series, I'm going with "b" because after deletion of Python 2, 
many of the abstractions in Python 2 no longer make much sense and 
their presence doesn't accomplish much except confuse people through 
extra indirection. Things like pycompat.iteritems() (which is just a 
proxy to .items()) don't serve any purpose any more and IMO shouldn't 
be used.


Other parts of pycompat are harder to delete. e.g. strkwargs() and 
byteskwargs() are used pretty heavily and form an API contract. So I 
anticipate we'll be living with them for a while.


As much as I would like to delete APIs from pycompat.py entirely, I 
think we should keep them around so extensions have a stable API to 
manage the Python 2 -> 3 and <=6.1 to >6.1 migrations. However, I 
think we should establish a schedule for marking them as deprecated 
and deleting them. This schedule should be independent of their usage 
within the repo, as the two decisions are separate.


Thoughts?



Keeping the pycompat module around for some versions is probably the 
simplest from as extension point of view. So (b) seems like the best 
option to me.



--
Pierre-Yves David

___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


mercurial-devel | Failed pipeline for branch/default | 76516284

2022-03-02 Thread Heptapod


Pipeline #45875 has failed!

Project: mercurial-devel ( https://foss.heptapod.net/mercurial/mercurial-devel )
Branch: branch/default ( 
https://foss.heptapod.net/mercurial/mercurial-devel/-/commits/branch/default )

Commit: 76516284 ( 
https://foss.heptapod.net/mercurial/mercurial-devel/-/commit/76516284ba7325962346b8840bd77871ecb8b3d5
 )
Commit Message: rust: jettison Python 2 support

Differential R...
Commit Author: Augie Fackler

Pipeline #45875 ( 
https://foss.heptapod.net/mercurial/mercurial-devel/-/pipelines/45875 ) 
triggered by Administrator ( https://foss.heptapod.net/root )
had 1 failed job.

Job #456423 ( 
https://foss.heptapod.net/mercurial/mercurial-devel/-/jobs/456423/raw )

Stage: tests
Name: checks-py3

-- 
You're receiving this email because of your account on foss.heptapod.net.



___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: Python 3.x version support / dropping 3.5 and 3.6

2022-03-02 Thread Augie Fackler


> On Mar 1, 2022, at 2:53 PM, Raphaël Gomès  wrote:
> 
> 
> On 2/27/22 22:19, Gregory Szorc wrote:
>> 6.1 will be the last release to support Python 2.7. That means 6.2 will be 
>> Python 3 only.
>> 
>> Currently our Python 3 support is for 3.5-3.10.
>> 
>> Python 3.5 dropped out of support in September 2020 and Python 3.6 in 
>> December 2021 (https://endoflife.date/python).
>> 
>> Do we have any interest in dropping support for 3.5 or 3.6 in the 6.2 
>> release?
>> 
>> Features of interest in 3.6:
>> 
>> * Variable type annotations. (Annotating on <3.6 requires special syntax in 
>> comments)
>> * Stabilization of async (unsure how much we'll adopt async though)
>> * PEP 519 path protocol. This might enable us to clean up path handling 
>> throughout the codebase by adopting richly typed path objects with nice 
>> path-like primitives.
>> * Enhancements to typing module to make it more useful.
>> 
>> Features of interest in 3.7:
>> 
>> * Postponed evaluation of type annotations (this is likely huge for managing 
>> startup time)
>> * importlib.resources (allows us to clean up non-module file loading)
>> * @dataclass and data classes
>> 
>> I think the only in-support major distro still supporting 3.5 is Debian 9 
>> Stretch, which goes out of support on 2022-06-30.
>> 
>> 3.6 is more complicated. CentOS/RHEL 7 and Ubuntu 18.04 ship Python 3.6. 
>> Although the former is already out of support. Ubuntu 18.04 is still in main 
>> support until 2023-04-03 and has security support for another few years.
>> 
>> My pulse on the larger Python ecosystem is that 3.5 is mostly dead and 3.6 
>> is starting to wilt but not quite dead. Tons of projects dropped 3.5 in the 
>> past year.
>> 
>> **So I'd like to propose dropping support for Python 3.5 in 6.2.** That 
>> would mean 6.1 is our last release with both Python 2.7 and 3.5 support.
>> 
> Agreed, I think this is cautious enough.
>> I don't think I can in good faith recommend dropping 3.6 support at this 
>> time since it is still in wide use. But I do like the allure of the above 
>> highlighted features in 3.7 and think they could lead to a higher quality 
>> Mercurial and cleaner code base. If anyone else wants to make the case for 
>> dropping 3.6 despite its apparent use in supported distros, I'd love to hear 
>> it.
>> 
> +1

Throwing an idea out there: we stop testing against 3.6 and don’t sweat 
breakages now that it’s EOL upstream, but accept patches from people that care 
(eg distro packagers) to keep it alive for some amount of time after the Python 
version goes EOL.

Thoughts?

>> 
>> ___
>> Mercurial-devel mailing list
>> Mercurial-devel@mercurial-scm.org 
>> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel 
>> 
> ___
> Mercurial-devel mailing list
> Mercurial-devel@mercurial-scm.org 
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel 
> 
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D12279: cleanup: directly use concurrent.futures instead of via pycompat

2022-03-02 Thread durin42 (Augie Fackler)
durin42 created this revision.
durin42 added a reviewer: indygreg.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  Python 2 is gone.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/httppeer.py
  mercurial/localrepo.py
  mercurial/pycompat.py
  mercurial/wireprotov1peer.py

CHANGE DETAILS

diff --git a/mercurial/wireprotov1peer.py b/mercurial/wireprotov1peer.py
--- a/mercurial/wireprotov1peer.py
+++ b/mercurial/wireprotov1peer.py
@@ -10,6 +10,7 @@
 import sys
 import weakref
 
+from concurrent import futures
 from .i18n import _
 from .node import bin
 from .pycompat import (
@@ -88,7 +89,7 @@
 return b';'.join(cmds)
 
 
-class unsentfuture(pycompat.futures.Future):
+class unsentfuture(futures.Future):
 """A Future variation to represent an unsent command.
 
 Because we buffer commands and don't submit them immediately, calling
@@ -99,7 +100,7 @@
 
 def result(self, timeout=None):
 if self.done():
-return pycompat.futures.Future.result(self, timeout)
+return futures.Future.result(self, timeout)
 
 self._peerexecutor.sendcommands()
 
@@ -154,7 +155,7 @@
 # a batchable one and refuse to service it.
 
 def addcall():
-f = pycompat.futures.Future()
+f = futures.Future()
 self._futures.add(f)
 self._calls.append((command, args, fn, f))
 return f
@@ -194,7 +195,7 @@
 # cycle between us and futures.
 for f in self._futures:
 if isinstance(f, unsentfuture):
-f.__class__ = pycompat.futures.Future
+f.__class__ = futures.Future
 f._peerexecutor = None
 
 calls = self._calls
@@ -258,7 +259,7 @@
 # hard and it is easy to encounter race conditions, deadlocks, etc.
 # concurrent.futures already solves these problems and its thread pool
 # executor has minimal overhead. So we use it.
-self._responseexecutor = pycompat.futures.ThreadPoolExecutor(1)
+self._responseexecutor = futures.ThreadPoolExecutor(1)
 self._responsef = self._responseexecutor.submit(
 self._readbatchresponse, states, wireresults
 )
diff --git a/mercurial/pycompat.py b/mercurial/pycompat.py
--- a/mercurial/pycompat.py
+++ b/mercurial/pycompat.py
@@ -35,8 +35,6 @@
 import SocketServer as socketserver
 import xmlrpclib
 
-from .thirdparty.concurrent import futures
-
 def future_set_exception_info(f, exc_info):
 f.set_exception_info(*exc_info)
 
@@ -45,7 +43,6 @@
 
 else:
 import builtins
-import concurrent.futures as futures
 import http.cookiejar as cookielib
 import http.client as httplib
 import pickle
diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -16,6 +16,7 @@
 import time
 import weakref
 
+from concurrent import futures
 from .i18n import _
 from .node import (
 bin,
@@ -278,7 +279,7 @@
 # method on the peer and return a resolved future.
 fn = getattr(self._peer, pycompat.sysstr(command))
 
-f = pycompat.futures.Future()
+f = futures.Future()
 
 try:
 result = fn(**pycompat.strkwargs(args))
diff --git a/mercurial/httppeer.py b/mercurial/httppeer.py
--- a/mercurial/httppeer.py
+++ b/mercurial/httppeer.py
@@ -14,6 +14,7 @@
 import socket
 import struct
 
+from concurrent import futures
 from .i18n import _
 from .pycompat import getattr
 from . import (
@@ -538,12 +539,12 @@
 raise exception
 
 
-class queuedcommandfuture(pycompat.futures.Future):
+class queuedcommandfuture(futures.Future):
 """Wraps result() on command futures to trigger submission on call."""
 
 def result(self, timeout=None):
 if self.done():
-return pycompat.futures.Future.result(self, timeout)
+return futures.Future.result(self, timeout)
 
 self._peerexecutor.sendcommands()
 



To: durin42, indygreg, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D12283: rust: jettison Python 2 support

2022-03-02 Thread durin42 (Augie Fackler)
durin42 created this revision.
durin42 added a reviewer: indygreg.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  rust/Cargo.lock
  rust/hg-cpython/Cargo.toml
  rust/hg-cpython/src/lib.rs

CHANGE DETAILS

diff --git a/rust/hg-cpython/src/lib.rs b/rust/hg-cpython/src/lib.rs
--- a/rust/hg-cpython/src/lib.rs
+++ b/rust/hg-cpython/src/lib.rs
@@ -62,7 +62,7 @@
 Ok(())
 });
 
-#[cfg(not(any(feature = "python27-bin", feature = "python3-bin")))]
+#[cfg(not(feature = "python3-bin"))]
 #[test]
 #[ignore]
 fn libpython_must_be_linked_to_run_tests() {
diff --git a/rust/hg-cpython/Cargo.toml b/rust/hg-cpython/Cargo.toml
--- a/rust/hg-cpython/Cargo.toml
+++ b/rust/hg-cpython/Cargo.toml
@@ -12,12 +12,10 @@
 default = ["python3"]
 
 # Features to build an extension module:
-python27 = ["cpython/python27-sys", "cpython/extension-module-2-7"]
 python3 = ["cpython/python3-sys", "cpython/extension-module"]
 
-# Enable one of these features to build a test executable linked to libpython:
-# e.g. cargo test --no-default-features --features python27-bin
-python27-bin = ["cpython/python27-sys"]
+# Enable this feature to build a test executable linked to libpython:
+# e.g. cargo test --no-default-features --features python3-bin
 python3-bin = ["cpython/python3-sys"]
 
 [dependencies]
@@ -29,4 +27,3 @@
 env_logger = "0.7.1"
 stable_deref_trait = "1.2.0"
 vcsgraph = "0.2.0"
-
diff --git a/rust/Cargo.lock b/rust/Cargo.lock
--- a/rust/Cargo.lock
+++ b/rust/Cargo.lock
@@ -166,7 +166,6 @@
  "libc",
  "num-traits",
  "paste",
- "python27-sys",
  "python3-sys",
 ]
 
@@ -671,16 +670,6 @@
 ]
 
 [[package]]
-name = "python27-sys"
-version = "0.7.0"
-source = "registry+https://github.com/rust-lang/crates.io-index;
-checksum = "94670354e264300dde81a5864cbb6bfc9d56ac3dcf3a278c32cb52f816f4dfd1"
-dependencies = [
- "libc",
- "regex",
-]
-
-[[package]]
 name = "python3-sys"
 version = "0.7.0"
 source = "registry+https://github.com/rust-lang/crates.io-index;



To: durin42, indygreg, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D12282: setup: always decode xcode version

2022-03-02 Thread durin42 (Augie Fackler)
durin42 created this revision.
durin42 added a reviewer: indygreg.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  Not decoding was a Python 2 thing.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  setup.py

CHANGE DETAILS

diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -1663,9 +1663,7 @@
 if sys.platform == 'darwin' and os.path.exists('/usr/bin/xcodebuild'):
 version = runcmd(['/usr/bin/xcodebuild', '-version'], {})[1].splitlines()
 if version:
-version = version[0]
-if sys.version_info[0] == 3:
-version = version.decode('utf-8')
+version = version[0].decode('utf-8')
 xcode4 = version.startswith('Xcode') and StrictVersion(
 version.split()[1]
 ) >= StrictVersion('4.0')



To: durin42, indygreg, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D12281: setup: remove Rust support for Python 2

2022-03-02 Thread durin42 (Augie Fackler)
durin42 created this revision.
durin42 added a reviewer: indygreg.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  setup.py

CHANGE DETAILS

diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -1380,13 +1380,9 @@
 
 cargocmd = ['cargo', 'rustc', '--release']
 
-feature_flags = []
+feature_flags = ['python3']
 
 cargocmd.append('--no-default-features')
-if sys.version_info[0] == 2:
-feature_flags.append('python27')
-elif sys.version_info[0] == 3:
-feature_flags.append('python3')
 
 rust_features = env.get("HG_RUST_FEATURES")
 if rust_features:



To: durin42, indygreg, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D12280: cleanup: stop bundling concurrent.futures on Python 2

2022-03-02 Thread durin42 (Augie Fackler)
durin42 created this revision.
durin42 added a reviewer: indygreg.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  We no longer support Python 2.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/thirdparty/concurrent/LICENSE
  mercurial/thirdparty/concurrent/__init__.py
  mercurial/thirdparty/concurrent/futures/__init__.py
  mercurial/thirdparty/concurrent/futures/_base.py
  mercurial/thirdparty/concurrent/futures/process.py
  mercurial/thirdparty/concurrent/futures/thread.py
  setup.py

CHANGE DETAILS

diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -1249,14 +1249,6 @@
 ):
 packages.append('mercurial.templates.%s' % name)
 
-if sys.version_info[0] == 2:
-packages.extend(
-[
-'mercurial.thirdparty.concurrent',
-'mercurial.thirdparty.concurrent.futures',
-]
-)
-
 if 'HG_PY2EXE_EXTRA_INSTALL_PACKAGES' in os.environ:
 # py2exe can't cope with namespace packages very well, so we have to
 # install any hgext3rd.* extensions that we want in the final py2exe
diff --git a/mercurial/thirdparty/concurrent/futures/thread.py 
b/mercurial/thirdparty/concurrent/futures/thread.py
deleted file mode 100644
--- a/mercurial/thirdparty/concurrent/futures/thread.py
+++ /dev/null
@@ -1,162 +0,0 @@
-# Copyright 2009 Brian Quinlan. All Rights Reserved.
-# Licensed to PSF under a Contributor Agreement.
-
-"""Implements ThreadPoolExecutor."""
-
-from __future__ import absolute_import
-
-import atexit
-from . import _base
-import itertools
-import Queue as queue
-import threading
-import weakref
-import sys
-
-try:
-from multiprocessing import cpu_count
-except ImportError:
-# some platforms don't have multiprocessing
-def cpu_count():
-return None
-
-__author__ = 'Brian Quinlan (br...@sweetapp.com)'
-
-# Workers are created as daemon threads. This is done to allow the interpreter
-# to exit when there are still idle threads in a ThreadPoolExecutor's thread
-# pool (i.e. shutdown() was not called). However, allowing workers to die with
-# the interpreter has two undesirable properties:
-#   - The workers would still be running during interpretor shutdown,
-# meaning that they would fail in unpredictable ways.
-#   - The workers could be killed while evaluating a work item, which could
-# be bad if the callable being evaluated has external side-effects e.g.
-# writing to a file.
-#
-# To work around this problem, an exit handler is installed which tells the
-# workers to exit when their work queues are empty and then waits until the
-# threads finish.
-
-_threads_queues = weakref.WeakKeyDictionary()
-_shutdown = False
-
-def _python_exit():
-global _shutdown
-_shutdown = True
-items = list(_threads_queues.items()) if _threads_queues else ()
-for t, q in items:
-q.put(None)
-for t, q in items:
-t.join(sys.maxint)
-
-atexit.register(_python_exit)
-
-class _WorkItem(object):
-def __init__(self, future, fn, args, kwargs):
-self.future = future
-self.fn = fn
-self.args = args
-self.kwargs = kwargs
-
-def run(self):
-if not self.future.set_running_or_notify_cancel():
-return
-
-try:
-result = self.fn(*self.args, **self.kwargs)
-except:
-e, tb = sys.exc_info()[1:]
-self.future.set_exception_info(e, tb)
-else:
-self.future.set_result(result)
-
-def _worker(executor_reference, work_queue):
-try:
-while True:
-work_item = work_queue.get(block=True)
-if work_item is not None:
-work_item.run()
-# Delete references to object. See issue16284
-del work_item
-continue
-executor = executor_reference()
-# Exit if:
-#   - The interpreter is shutting down OR
-#   - The executor that owns the worker has been collected OR
-#   - The executor that owns the worker has been shutdown.
-if _shutdown or executor is None or executor._shutdown:
-# Notice other workers
-work_queue.put(None)
-return
-del executor
-except:
-_base.LOGGER.critical('Exception in worker', exc_info=True)
-
-
-class ThreadPoolExecutor(_base.Executor):
-
-# Used to assign unique thread names when thread_name_prefix is not 
supplied.
-_counter = itertools.count().next
-
-def __init__(self, max_workers=None, thread_name_prefix=''):
-"""Initializes a new ThreadPoolExecutor instance.
-
-Args:
-max_workers: The maximum number of threads that can be used to
-execute the given calls.
-thread_name_prefix: An optional name prefix to give our threads.
-"""
-if 

D12277: setup: remove pygit2 Python 2 logic

2022-03-02 Thread durin42 (Augie Fackler)
durin42 created this revision.
durin42 added a reviewer: indygreg.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  setup.py

CHANGE DETAILS

diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -1243,13 +1243,6 @@
 'hgdemandimport',
 ]
 
-# The pygit2 dependency dropped py2 support with the 1.0 release in Dec 2019.
-# Prior releases do not build at all on Windows, because Visual Studio 2008
-# doesn't understand C 11.  Older Linux releases are buggy.
-if sys.version_info[0] == 2:
-packages.remove('hgext.git')
-
-
 for name in os.listdir(os.path.join('mercurial', 'templates')):
 if name != '__pycache__' and os.path.isdir(
 os.path.join('mercurial', 'templates', name)



To: durin42, indygreg, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D12278: imports: allow importing futures from concurrent

2022-03-02 Thread durin42 (Augie Fackler)
durin42 created this revision.
durin42 added a reviewer: indygreg.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  contrib/import-checker.py

CHANGE DETAILS

diff --git a/contrib/import-checker.py b/contrib/import-checker.py
--- a/contrib/import-checker.py
+++ b/contrib/import-checker.py
@@ -24,6 +24,7 @@
 allowsymbolimports = (
 '__future__',
 'breezy',
+'concurrent',
 'hgclient',
 'mercurial',
 'mercurial.hgweb.common',



To: durin42, indygreg, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D12276: setup: inline now-constant list

2022-03-02 Thread durin42 (Augie Fackler)
durin42 created this revision.
durin42 added a reviewer: indygreg.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  This varied when we supported Python 2.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  setup.py

CHANGE DETAILS

diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -773,14 +773,10 @@
 f.write(b'/* this file is autogenerated by setup.py */\n')
 f.write(b'#define HGPYTHONLIB "%s"\n' % pythonlib)
 
-macros = None
-if sys.version_info[0] >= 3:
-macros = [('_UNICODE', None), ('UNICODE', None)]
-
 objects = self.compiler.compile(
 ['mercurial/exewrapper.c'],
 output_dir=self.build_temp,
-macros=macros,
+macros=[('_UNICODE', None), ('UNICODE', None)],
 )
 self.compiler.link_executable(
 objects, self.hgtarget, libraries=[], output_dir=self.build_temp



To: durin42, indygreg, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D12275: setup: unconditionally do this python 3 step

2022-03-02 Thread durin42 (Augie Fackler)
durin42 created this revision.
durin42 added a reviewer: indygreg.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  setup.py

CHANGE DETAILS

diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -747,19 +747,18 @@
 
 # Also overwrite python3.dll so that hgext.git is usable.
 # TODO: also handle the MSYS flavor
-if sys.version_info[0] >= 3:
-python_x = os.path.join(
-os.path.dirname(fsdecode(buf.value)),
-"python3.dll",
+python_x = os.path.join(
+os.path.dirname(fsdecode(buf.value)),
+"python3.dll",
+)
+
+if os.path.exists(python_x):
+dest = os.path.join(
+os.path.dirname(self.hgtarget),
+os.path.basename(python_x),
 )
 
-if os.path.exists(python_x):
-dest = os.path.join(
-os.path.dirname(self.hgtarget),
-os.path.basename(python_x),
-)
-
-shutil.copy(python_x, dest)
+shutil.copy(python_x, dest)
 
 if not pythonlib:
 log.warn(



To: durin42, indygreg, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D12274: setup: remove Python 2 support code for determining dylib suffix

2022-03-02 Thread durin42 (Augie Fackler)
durin42 created this revision.
durin42 added a reviewer: indygreg.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  setup.py

CHANGE DETAILS

diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -51,11 +51,7 @@
 print(error, file=sys.stderr)
 sys.exit(1)
 
-if sys.version_info[0] >= 3:
-DYLIB_SUFFIX = sysconfig.get_config_vars()['EXT_SUFFIX']
-else:
-# deprecated in Python 3
-DYLIB_SUFFIX = sysconfig.get_config_vars()['SO']
+DYLIB_SUFFIX = sysconfig.get_config_vars()['EXT_SUFFIX']
 
 # Solaris Python packaging brain damage
 try:



To: durin42, indygreg, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D12273: setup: inline os.fsdecode now that we're done with Python 2

2022-03-02 Thread durin42 (Augie Fackler)
durin42 created this revision.
durin42 added a reviewer: indygreg.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  setup.py

CHANGE DETAILS

diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -741,12 +741,9 @@
 
 # Copy the pythonXY.dll next to the binary so that it runs
 # without tampering with PATH.
-fsdecode = lambda x: x
-if sys.version_info[0] >= 3:
-fsdecode = os.fsdecode
 dest = os.path.join(
 os.path.dirname(self.hgtarget),
-fsdecode(dllbasename),
+os.fsdecode(dllbasename),
 )
 
 if not os.path.exists(dest):



To: durin42, indygreg, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D12272: setup: inline encoding constant that is only used once

2022-03-02 Thread durin42 (Augie Fackler)
durin42 created this revision.
durin42 added a reviewer: indygreg.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  This was variable back when we supported Python 2.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  setup.py

CHANGE DETAILS

diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -22,8 +22,6 @@
 import sys, platform
 import sysconfig
 
-libdir_escape = 'unicode_escape'
-
 
 def sysstr(s):
 return s.decode('latin-1')
@@ -1116,7 +1114,7 @@
 )
 continue
 
-data = data.replace(b'@LIBDIR@', libdir.encode(libdir_escape))
+data = data.replace(b'@LIBDIR@', libdir.encode('unicode_escape'))
 with open(outfile, 'wb') as fp:
 fp.write(data)
 



To: durin42, indygreg, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D12271: setup: remove printf trampoline

2022-03-02 Thread durin42 (Augie Fackler)
durin42 created this revision.
durin42 added a reviewer: indygreg.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  setup.py

CHANGE DETAILS

diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -22,7 +22,6 @@
 import sys, platform
 import sysconfig
 
-printf = eval('print')
 libdir_escape = 'unicode_escape'
 
 
@@ -51,7 +50,7 @@
 version enabling these features (likely this requires the OpenSSL version to
 be at least 1.0.1).
 """
-printf(error, file=sys.stderr)
+print(error, file=sys.stderr)
 sys.exit(1)
 
 if sys.version_info[0] >= 3:
@@ -236,8 +235,8 @@
 returncode, out, err = runcmd(cmd, self.env)
 err = filterhgerr(err)
 if err or returncode != 0:
-printf("stderr from '%s':" % (' '.join(cmd)), file=sys.stderr)
-printf(err, file=sys.stderr)
+print("stderr from '%s':" % (' '.join(cmd)), file=sys.stderr)
+print(err, file=sys.stderr)
 return b''
 return out
 
@@ -470,7 +469,7 @@
 if hgrustext != 'cpython' and hgrustext is not None:
 if hgrustext:
 msg = 'unknown HGWITHRUSTEXT value: %s' % hgrustext
-printf(msg, file=sys.stderr)
+print(msg, file=sys.stderr)
 hgrustext = None
 self.rust = hgrustext is not None
 self.no_rust = not self.rust



To: durin42, indygreg, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D12270: setup: remove more Python 2 support code

2022-03-02 Thread durin42 (Augie Fackler)
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

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



To: durin42, indygreg, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D12269: setup: remove ssl check that only matters on 2.7

2022-03-02 Thread durin42 (Augie Fackler)
durin42 created this revision.
durin42 added a reviewer: indygreg.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  setup.py

CHANGE DETAILS

diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -43,19 +43,6 @@
 
 import ssl
 
-try:
-ssl.SSLContext
-except AttributeError:
-error = """
-The `ssl` module does not have the `SSLContext` class. This indicates an old
-Python version which does not support modern security features (which were
-added to Python 2.7 as part of "PEP 466"). Please make sure you have installed
-at least Python 2.7.9 or a Python version with backports of these security
-features.
-"""
-printf(error, file=sys.stderr)
-sys.exit(1)
-
 # ssl.HAS_TLSv1* are preferred to check support but they were added in Python
 # 3.7. Prior to CPython commit 6e8cda91d92da72800d891b2fc2073ecbc134d98
 # (backported to the 3.7 branch), ssl.PROTOCOL_TLSv1_1 / ssl.PROTOCOL_TLSv1_2



To: durin42, indygreg, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D12268: setup: remove block that tries to help Python 2.6 users

2022-03-02 Thread durin42 (Augie Fackler)
durin42 created this revision.
durin42 added a reviewer: indygreg.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  It's time to move on folks.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  setup.py

CHANGE DETAILS

diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -41,39 +41,6 @@
 return s
 
 
-# Attempt to guide users to a modern pip - this means that 2.6 users
-# should have a chance of getting a 4.2 release, and when we ratchet
-# the version requirement forward again hopefully everyone will get
-# something that works for them.
-if sys.version_info < (2, 7, 4, 'final'):
-pip_message = (
-'This may be due to an out of date pip. '
-'Make sure you have pip >= 9.0.1.'
-)
-try:
-import pip
-
-pip_version = tuple([int(x) for x in pip.__version__.split('.')[:3]])
-if pip_version < (9, 0, 1):
-pip_message = (
-'Your pip version is out of date, please install '
-'pip >= 9.0.1. pip {} detected.'.format(pip.__version__)
-)
-else:
-# pip is new enough - it must be something else
-pip_message = ''
-except Exception:
-pass
-error = """
-Mercurial does not support Python older than 2.7.4.
-Python {py} detected.
-{pip}
-""".format(
-py=sys.version_info, pip=pip_message
-)
-printf(error, file=sys.stderr)
-sys.exit(1)
-
 import ssl
 
 try:



To: durin42, indygreg, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D12266: setup: drop statement of support for Python before 3.5.3

2022-03-02 Thread durin42 (Augie Fackler)
durin42 created this revision.
durin42 added a reviewer: indygreg.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  setup.py

CHANGE DETAILS

diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -13,15 +13,7 @@
 # bug link: https://bugs.python.org/issue25270
 supportedpy = ','.join(
 [
-'>=2.7.4',
-'!=3.0.*',
-'!=3.1.*',
-'!=3.2.*',
-'!=3.3.*',
-'!=3.4.*',
-'!=3.5.0',
-'!=3.5.1',
-'!=3.5.2',
+'>=3.5.3',
 '!=3.6.0',
 '!=3.6.1',
 ]
@@ -37,7 +29,6 @@
 def sysstr(s):
 return s.decode('latin-1')
 
-
 else:
 libdir_escape = 'string_escape'
 



To: durin42, indygreg, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D12265: packaging: remove py2exe / Python 2.7 support

2022-03-02 Thread indygreg (Gregory Szorc)
indygreg created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  This commit started by deleting references to py2exe (which is only used
  on Python 2). After pulling the thread, quite a lot of code was orphaned
  and was deleted.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  contrib/packaging/hgpackaging/cli.py
  contrib/packaging/hgpackaging/downloads.py
  contrib/packaging/hgpackaging/inno.py
  contrib/packaging/hgpackaging/py2exe.py
  contrib/packaging/hgpackaging/util.py
  contrib/packaging/hgpackaging/wix.py
  contrib/packaging/requirements-windows-py2.txt
  tests/test-check-code.t

CHANGE DETAILS

diff --git a/tests/test-check-code.t b/tests/test-check-code.t
--- a/tests/test-check-code.t
+++ b/tests/test-check-code.t
@@ -27,7 +27,6 @@
   Skipping contrib/packaging/hgpackaging/cli.py it has no-che?k-code (glob)
   Skipping contrib/packaging/hgpackaging/downloads.py it has no-che?k-code 
(glob)
   Skipping contrib/packaging/hgpackaging/inno.py it has no-che?k-code (glob)
-  Skipping contrib/packaging/hgpackaging/py2exe.py it has no-che?k-code (glob)
   Skipping contrib/packaging/hgpackaging/pyoxidizer.py it has no-che?k-code 
(glob)
   Skipping contrib/packaging/hgpackaging/util.py it has no-che?k-code (glob)
   Skipping contrib/packaging/hgpackaging/wix.py it has no-che?k-code (glob)
diff --git a/contrib/packaging/requirements-windows-py2.txt 
b/contrib/packaging/requirements-windows-py2.txt
deleted file mode 100644
--- a/contrib/packaging/requirements-windows-py2.txt
+++ /dev/null
@@ -1,59 +0,0 @@
-#
-# This file is autogenerated by pip-compile
-# To update, run:
-#
-#pip-compile --generate-hashes 
--output-file=contrib/packaging/requirements-windows-py2.txt 
contrib/packaging/requirements-windows.txt.in
-#
-certifi==2021.5.30 \
-
--hash=sha256:2bbf76fd432960138b3ef6dda3dde0544f27cbf8546c458e60baf371917ba9ee \
-
--hash=sha256:50b1e4f8446b06f41be7dd6338db18e0990601dce795c2b1686458aa7e8fa7d8 \
-# via dulwich
-configparser==4.0.2 \
-
--hash=sha256:254c1d9c79f60c45dfde850850883d5aaa7f19a23f13561243a050d5a7c3fe4c \
-
--hash=sha256:c7d282687a5308319bf3d2e7706e575c635b0a470342641c93bea0ea3b5331df \
-# via entrypoints
-docutils==0.16 \
-
--hash=sha256:0c5b78adfbf7762415433f5515cd5c9e762339e23369dbe8000d84a4bf4ab3af \
-
--hash=sha256:c2de3a60e9e7d07be26b7f2b00ca0309c207e06c100f9cc2a94931fc75a478fc \
-# via -r contrib/packaging/requirements-windows.txt.in
-dulwich==0.19.16 ; python_version <= "2.7" \
-
--hash=sha256:10699277c6268d0c16febe141a5b1c1a6e9744f3144c2d2de1706f4b1adafe63 \
-
--hash=sha256:267160904e9a1cb6c248c5efc53597a35d038ecc6f60bdc4546b3053bed11982 \
-
--hash=sha256:4e3aba5e4844e7c700721c1fc696987ea820ee3528a03604dc4e74eff4196826 \
-
--hash=sha256:60bb2c2c92f5025c1b53a556304008f0f624c98ae36f22d870e056b2d4236c11 \
-
--hash=sha256:dddae02d372fc3b5cfb0046d0f62246ef281fa0c088df7601ab5916607add94b \
-
--hash=sha256:f00d132082b8fcc2eb0d722abc773d4aeb5558c1475d7edd1f0f571146c29db9 \
-
--hash=sha256:f74561c448bfb6f04c07de731c1181ae4280017f759b0bb04fa5770aa84ca850 \
-# via -r contrib/packaging/requirements-windows.txt.in
-entrypoints==0.3 \
-
--hash=sha256:589f874b313739ad35be6e0cd7efde2a4e9b6fea91edcc34e58ecbb8dbe56d19 \
-
--hash=sha256:c70dd71abe5a8c85e55e12c19bd91ccfeec11a6e99044204511f9ed547d48451 \
-# via keyring
-keyring==18.0.1 \
-
--hash=sha256:67d6cc0132bd77922725fae9f18366bb314fd8f95ff4d323a4df41890a96a838 \
-
--hash=sha256:7b29ebfcf8678c4da531b2478a912eea01e80007e5ddca9ee0c7038cb3489ec6 \
-# via -r contrib/packaging/requirements-windows.txt.in
-pygments==2.5.2 \
-
--hash=sha256:2a3fe295e54a20164a9df49c75fa58526d3be48e14aceba6d6b1e8ac0bfd6f1b \
-
--hash=sha256:98c8aa5a9f778fcd1026a17361ddaf7330d1b7c62ae97c3bb0ae73e0b9b6b0fe \
-# via -r contrib/packaging/requirements-windows.txt.in
-pywin32-ctypes==0.2.0 \
-
--hash=sha256:24ffc3b341d457d48e8922352130cf2644024a4ff09762a2261fd34c36ee5942 \
-
--hash=sha256:9dc2d991b3479cc2df15930958b674a48a227d5361d413827a4cfd0b5876fc98 \
-# via -r contrib/packaging/requirements-windows.txt.in, keyring
-urllib3==1.25.11 \
-
--hash=sha256:8d7eaa5a82a1cac232164990f04874c594c9453ec55eef02eab885aa02fc17a2 \
-
--hash=sha256:f5321fbe4bf3fefa0efd0bfe7fb14e90909eb62a48ccda331726b4319897dd5e \
-# via dulwich
-windows-curses==2.1.0 \
-
--hash=sha256:261fde5680d1ce4ce116908996b9a3cfb0ffb03ea68d42240f62b56a9fa6af2c \
-
--hash=sha256:66034dc9a705d87308cc9ea90836f4ee60008a1d5e2c1d34ace627f60268158b \
-
--hash=sha256:669caad3ae16faf2d201d7ab3b8af418a2fd074d8a39d60ca26f3acb34b6afe5 \
-
--hash=sha256:73bd3eebccfda55330783f165151de115bfa238d1332f0b2e224b550d6187840 \
-
--hash=sha256:89a6d973f88cfe49b41ea80164dcbec209d296e0cec34a02002578b0bf464a64 \
-

D12267: packaging: remove requirements constraints to support Python 2

2022-03-02 Thread indygreg (Gregory Szorc)
indygreg created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  We just deleted support for Python 2 from the packaging code. We no longer
  need these package constraints in the requirements file to support Python 2.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  contrib/packaging/requirements-windows.txt.in

CHANGE DETAILS

diff --git a/contrib/packaging/requirements-windows.txt.in 
b/contrib/packaging/requirements-windows.txt.in
--- a/contrib/packaging/requirements-windows.txt.in
+++ b/contrib/packaging/requirements-windows.txt.in
@@ -1,13 +1,11 @@
 docutils
-# Pinned to an old version because 0.20 drops Python 3 compatibility.
-dulwich < 0.20 ; python_version <= '2.7'
-dulwich ; python_version >= '3'
+dulwich
 
 # Needed by the release note tooling
 fuzzywuzzy
 
 keyring
-pygit2 ; python_version >= '3'
+pygit2
 pygments
 
 # Needed by the phabricator tests



To: indygreg, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D12262: automation: drop support for Python 2.7 in Linux environment

2022-03-02 Thread indygreg (Gregory Szorc)
indygreg created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  We stop installing Python 2.7 via pyenv. We stop installing the system
  Python 2 packages. We delete support for running tests on Python 2.7.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  contrib/automation/hgautomation/aws.py
  contrib/automation/hgautomation/cli.py
  contrib/automation/hgautomation/linux.py
  contrib/automation/linux-requirements-py2.txt

CHANGE DETAILS

diff --git a/contrib/automation/linux-requirements-py2.txt 
b/contrib/automation/linux-requirements-py2.txt
deleted file mode 100644
--- a/contrib/automation/linux-requirements-py2.txt
+++ /dev/null
@@ -1,129 +0,0 @@
-#
-# This file is autogenerated by pip-compile
-# To update, run:
-#
-#pip-compile --generate-hashes 
--output-file=contrib/automation/linux-requirements-py2.txt 
contrib/automation/linux-requirements.txt.in
-#
-astroid==1.6.6 \
-
--hash=sha256:87de48a92e29cedf7210ffa853d11441e7ad94cb47bacd91b023499b51cbc756 \
-
--hash=sha256:d25869fc7f44f1d9fb7d24fd7ea0639656f5355fc3089cd1f3d18c6ec6b124c7 \
-# via pylint
-backports.functools-lru-cache==1.6.1 \
-
--hash=sha256:0bada4c2f8a43d533e4ecb7a12214d9420e66eb206d54bf2d682581ca4b80848 \
-
--hash=sha256:8fde5f188da2d593bd5bc0be98d9abc46c95bb8a9dde93429570192ee6cc2d4a \
-# via astroid, isort, pylint
-bzr==2.7.0 ; python_version <= "2.7" and platform_python_implementation == 
"CPython" \
-
--hash=sha256:c9f6bbe0a50201dadc5fddadd94ba50174193c6cf6e39e16f6dd0ad98a1df338 \
-# via -r contrib/automation/linux-requirements.txt.in
-configparser==4.0.2 \
-
--hash=sha256:254c1d9c79f60c45dfde850850883d5aaa7f19a23f13561243a050d5a7c3fe4c \
-
--hash=sha256:c7d282687a5308319bf3d2e7706e575c635b0a470342641c93bea0ea3b5331df \
-# via pylint
-contextlib2==0.6.0.post1 \
-
--hash=sha256:01f490098c18b19d2bd5bb5dc445b2054d2fa97f09a4280ba2c5f3c394c8162e \
-
--hash=sha256:3355078a159fbb44ee60ea80abd0d87b80b78c248643b49aa6d94673b413609b \
-# via vcrpy
-docutils==0.16 \
-
--hash=sha256:0c5b78adfbf7762415433f5515cd5c9e762339e23369dbe8000d84a4bf4ab3af \
-
--hash=sha256:c2de3a60e9e7d07be26b7f2b00ca0309c207e06c100f9cc2a94931fc75a478fc \
-# via -r contrib/automation/linux-requirements.txt.in
-enum34==1.1.10 \
-
--hash=sha256:a98a201d6de3f2ab3db284e70a33b0f896fbf35f8086594e8c9e74b909058d53 \
-
--hash=sha256:c3858660960c984d6ab0ebad691265180da2b43f07e061c0f8dca9ef3cffd328 \
-
--hash=sha256:cce6a7477ed816bd2542d03d53db9f0db935dd013b70f336a95c73979289f248 \
-# via astroid
-funcsigs==1.0.2 \
-
--hash=sha256:330cc27ccbf7f1e992e69fef78261dc7c6569012cf397db8d3de0234e6c937ca \
-
--hash=sha256:a7bb0f2cf3a3fd1ab2732cb49eba4252c2af4240442415b4abce3b87022a8f50 \
-# via mock
-futures==3.3.0 \
-
--hash=sha256:49b3f5b064b6e3afc3316421a3f25f66c137ae88f068abbf72830170033c5e16 \
-
--hash=sha256:7e033af76a5e35f58e56da7a91e687706faf4e7bdfb2cbc3f2cca6b9bcda9794 \
-# via isort
-fuzzywuzzy==0.18.0 \
-
--hash=sha256:45016e92264780e58972dca1b3d939ac864b78437422beecebb3095f8efd00e8 \
-
--hash=sha256:928244b28db720d1e0ee7587acf660ea49d7e4c632569cad4f1cd7e68a5f0993 \
-# via -r contrib/automation/linux-requirements.txt.in
-isort==4.3.21 \
-
--hash=sha256:54da7e92468955c4fceacd0c86bd0ec997b0e1ee80d97f67c35a78b719dccab1 \
-
--hash=sha256:6e811fcb295968434526407adb8796944f1988c5b65e8139058f2014cbe100fd \
-# via pylint
-lazy-object-proxy==1.5.1 \
-
--hash=sha256:00b78a97a79d0dfefa584d44dd1aba9668d3de7ec82335ba0ff51d53ef107143 \
-
--hash=sha256:042b54fd71c2092e6d10e5e66fa60f65c5954f8145e809f5d9f394c9b13d32ee \
-
--hash=sha256:11f87dc06eb5f376cc6d5f0c19a1b4dca202035622777c4ce8e5b72c87b035d6 \
-
--hash=sha256:19ae6f6511a02008ef3554e158c41bb2a8e5c8455935b98d6da076d9f152fd7c \
-
--hash=sha256:22c1935c6f8e3d6ea2e169eb03928adbdb8a2251d2890f8689368d65e70aa176 \
-
--hash=sha256:30ef2068f4f94660144515380ef04b93d15add2214eab8be4cd46ebc900d681c \
-
--hash=sha256:33da47ba3a581860ddd3d38c950a5fe950ca389f7123edd0d6ab0bc473499fe7 \
-
--hash=sha256:3e8698dc384857413580012f4ca322d89e63ef20fc3d4635a5b606d6d4b61f6a \
-
--hash=sha256:4fdd7113fc5143c72dacf415079eec42fcbe69cc9d3d291b4ca742e3a9455807 \
-
--hash=sha256:63b6d9a5077d54db271fcc6772440f7380ec3fa559d0e2497dbfae2f47c2c814 \
-
--hash=sha256:8133b63b05f12751cddd8e3e7f02ba39dc7cfa7d2ba99d80d7436f0ba26d6b75 \
-
--hash=sha256:89b8e5780e49753e2b4cd5aab45d3df092ddcbba3de2c4d4492a029588fe1758 \
-
--hash=sha256:8d82e27cbbea6edb8821751806f39f5dcfd7b46a5e23d27b98d6d8c8ec751df8 \
-
--hash=sha256:92cedd6e26712505adb1c17fab64651a498cc0102a80ba562ff4a2451088f57a \
-
--hash=sha256:9723364577b79ad9958a68851fe2acb94da6fd25170c595516a8289e6a129043 \
-
--hash=sha256:c484020ad26973a14a7cb1e1d2e0bfe97cf6803273ae9bd154e0213cc74bad49 

D12264: automation: delete code related to Python 2.7 support

2022-03-02 Thread indygreg (Gregory Szorc)
indygreg created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  The building of Inno and WiX installers took a python_version argument
  that allowed us to specify "2" or "3" for the major Python version. Since
  we no longer support Python 2, we can delete this argument and everything
  feeding into it.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  contrib/automation/hgautomation/cli.py
  contrib/automation/hgautomation/windows.py

CHANGE DETAILS

diff --git a/contrib/automation/hgautomation/windows.py 
b/contrib/automation/hgautomation/windows.py
--- a/contrib/automation/hgautomation/windows.py
+++ b/contrib/automation/hgautomation/windows.py
@@ -264,7 +264,6 @@
 
 def build_inno_installer(
 winrm_client,
-python_version: int,
 arch: str,
 dest_path: pathlib.Path,
 version=None,
@@ -274,10 +273,7 @@
 Using a WinRM client, remote commands are executed to build
 a Mercurial Inno Setup installer.
 """
-print(
-'building Inno Setup installer for Python %d %s'
-% (python_version, arch)
-)
+print('building Inno Setup installer for %s' % arch)
 
 # TODO fix this limitation in packaging code
 if not version:
@@ -319,7 +315,6 @@
 
 def build_wix_installer(
 winrm_client,
-python_version: int,
 arch: str,
 dest_path: pathlib.Path,
 version=None,
@@ -328,7 +323,7 @@
 
 Using a WinRM client, remote commands are executed to build a WiX 
installer.
 """
-print('Building WiX installer for Python %d %s' % (python_version, arch))
+print('Building WiX installer for %s' % arch)
 
 # TODO fix this limitation in packaging code
 if not version:
diff --git a/contrib/automation/hgautomation/cli.py 
b/contrib/automation/hgautomation/cli.py
--- a/contrib/automation/hgautomation/cli.py
+++ b/contrib/automation/hgautomation/cli.py
@@ -65,7 +65,6 @@
 def build_inno(
 hga: HGAutomation,
 aws_region,
-python_version,
 arch,
 revision,
 version,
@@ -80,21 +79,18 @@
 
 windows.synchronize_hg(SOURCE_ROOT, revision, instance)
 
-for py_version in python_version:
-for a in arch:
-windows.build_inno_installer(
-instance.winrm_client,
-py_version,
-a,
-DIST_PATH,
-version=version,
-)
+for a in arch:
+windows.build_inno_installer(
+instance.winrm_client,
+a,
+DIST_PATH,
+version=version,
+)
 
 
 def build_wix(
 hga: HGAutomation,
 aws_region,
-python_version,
 arch,
 revision,
 version,
@@ -109,15 +105,13 @@
 
 windows.synchronize_hg(SOURCE_ROOT, revision, instance)
 
-for py_version in python_version:
-for a in arch:
-windows.build_wix_installer(
-instance.winrm_client,
-py_version,
-a,
-DIST_PATH,
-version=version,
-)
+for a in arch:
+windows.build_wix_installer(
+instance.winrm_client,
+a,
+DIST_PATH,
+version=version,
+)
 
 
 def build_windows_wheel(
@@ -168,15 +162,14 @@
 dest_path=DIST_PATH,
 )
 
-for py_version in (2, 3):
-for arch in ('x86', 'x64'):
-windows.purge_hg(winrm_client)
-windows.build_inno_installer(
-winrm_client, py_version, arch, DIST_PATH, version=version
-)
-windows.build_wix_installer(
-winrm_client, py_version, arch, DIST_PATH, version=version
-)
+for arch in ('x86', 'x64'):
+windows.purge_hg(winrm_client)
+windows.build_inno_installer(
+winrm_client, arch, DIST_PATH, version=version
+)
+windows.build_wix_installer(
+winrm_client, arch, DIST_PATH, version=version
+)
 
 
 def terminate_ec2_instances(hga: HGAutomation, aws_region):
@@ -340,14 +333,6 @@
 help='Build Inno Setup installer(s)',
 )
 sp.add_argument(
-'--python-version',
-help='Which version of Python to target',
-choices={3},
-type=int,
-nargs='*',
-default=[3],
-)
-sp.add_argument(
 '--arch',
 help='Architecture to build for',
 choices={'x86', 'x64'},
@@ -402,14 +387,6 @@
 
 sp = subparsers.add_parser('build-wix', help='Build WiX installer(s)')
 sp.add_argument(
-'--python-version',
-help='Which version of Python to target',
-choices={3},
-

D12263: automation: drop support for Python 2.7 in Windows environment

2022-03-02 Thread indygreg (Gregory Szorc)
indygreg created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  We stop installing Python 2.7 in the Windows environment.
  
  We remove support for building Python 2.7 wheels and installers.
  
  There is still some Python 2.7 support cleanup to perform in automation.
  But this removes the biggest remaining chunk of references to 2.7.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  contrib/automation/hgautomation/cli.py
  contrib/automation/hgautomation/windows.py

CHANGE DETAILS

diff --git a/contrib/automation/hgautomation/windows.py 
b/contrib/automation/hgautomation/windows.py
--- a/contrib/automation/hgautomation/windows.py
+++ b/contrib/automation/hgautomation/windows.py
@@ -19,30 +19,6 @@
 from .winrm import run_powershell
 
 
-# PowerShell commands to activate a Visual Studio 2008 environment.
-# This is essentially a port of vcvarsall.bat to PowerShell.
-ACTIVATE_VC9_AMD64 = r'''
-Write-Output "activating Visual Studio 2008 environment for AMD64"
-$root = "$env:LOCALAPPDATA\Programs\Common\Microsoft\Visual C++ for Python\9.0"
-$Env:VCINSTALLDIR = "${root}\VC\"
-$Env:WindowsSdkDir = "${root}\WinSDK\"
-$Env:PATH = 
"${root}\VC\Bin\amd64;${root}\WinSDK\Bin\x64;${root}\WinSDK\Bin;$Env:PATH"
-$Env:INCLUDE = "${root}\VC\Include;${root}\WinSDK\Include;$Env:PATH"
-$Env:LIB = "${root}\VC\Lib\amd64;${root}\WinSDK\Lib\x64;$Env:LIB"
-$Env:LIBPATH = "${root}\VC\Lib\amd64;${root}\WinSDK\Lib\x64;$Env:LIBPATH"
-'''.lstrip()
-
-ACTIVATE_VC9_X86 = r'''
-Write-Output "activating Visual Studio 2008 environment for x86"
-$root = "$env:LOCALAPPDATA\Programs\Common\Microsoft\Visual C++ for Python\9.0"
-$Env:VCINSTALLDIR = "${root}\VC\"
-$Env:WindowsSdkDir = "${root}\WinSDK\"
-$Env:PATH = "${root}\VC\Bin;${root}\WinSDK\Bin;$Env:PATH"
-$Env:INCLUDE = "${root}\VC\Include;${root}\WinSDK\Include;$Env:INCLUDE"
-$Env:LIB = "${root}\VC\Lib;${root}\WinSDK\Lib;$Env:LIB"
-$Env:LIBPATH = "${root}\VC\lib;${root}\WinSDK\Lib;$Env:LIBPATH"
-'''.lstrip()
-
 HG_PURGE = r'''
 $Env:PATH = "C:\hgdev\venv-bootstrap\Scripts;$Env:PATH"
 Set-Location C:\hgdev\src
@@ -78,14 +54,6 @@
 }}
 '''
 
-BUILD_INNO_PYTHON2 = r'''
-Set-Location C:\hgdev\src
-$python = "C:\hgdev\python27-{arch}\python.exe"
-C:\hgdev\python37-x64\python.exe contrib\packaging\packaging.py inno --python 
$python {extra_args}
-if ($LASTEXITCODE -ne 0) {{
-throw "process exited non-0: $LASTEXITCODE"
-}}
-'''.lstrip()
 
 BUILD_WHEEL = r'''
 Set-Location C:\hgdev\src
@@ -105,14 +73,6 @@
 }}
 '''
 
-BUILD_WIX_PYTHON2 = r'''
-Set-Location C:\hgdev\src
-$python = "C:\hgdev\python27-{arch}\python.exe"
-C:\hgdev\python37-x64\python.exe contrib\packaging\packaging.py wix --python 
$python {extra_args}
-if ($LASTEXITCODE -ne 0) {{
-throw "process exited non-0: $LASTEXITCODE"
-}}
-'''
 
 RUN_TESTS = r'''
 C:\hgdev\MinGW\msys\1.0\bin\sh.exe --login -c "cd /c/hgdev/src/tests && 
/c/hgdev/{python_path}/python.exe run-tests.py {test_flags}"
@@ -121,8 +81,7 @@
 }}
 '''
 
-WHEEL_FILENAME_PYTHON27_X86 = 'mercurial-{version}-cp27-cp27m-win32.whl'
-WHEEL_FILENAME_PYTHON27_X64 = 'mercurial-{version}-cp27-cp27m-win_amd64.whl'
+
 WHEEL_FILENAME_PYTHON37_X86 = 'mercurial-{version}-cp37-cp37m-win32.whl'
 WHEEL_FILENAME_PYTHON37_X64 = 'mercurial-{version}-cp37-cp37m-win_amd64.whl'
 WHEEL_FILENAME_PYTHON38_X86 = 'mercurial-{version}-cp38-cp38-win32.whl'
@@ -132,13 +91,9 @@
 WHEEL_FILENAME_PYTHON310_X86 = 'mercurial-{version}-cp310-cp310-win32.whl'
 WHEEL_FILENAME_PYTHON310_X64 = 'mercurial-{version}-cp310-cp310-win_amd64.whl'
 
-EXE_FILENAME_PYTHON2_X86 = 'Mercurial-{version}-x86-python2.exe'
-EXE_FILENAME_PYTHON2_X64 = 'Mercurial-{version}-x64-python2.exe'
 EXE_FILENAME_PYTHON3_X86 = 'Mercurial-{version}-x86.exe'
 EXE_FILENAME_PYTHON3_X64 = 'Mercurial-{version}-x64.exe'
 
-MSI_FILENAME_PYTHON2_X86 = 'mercurial-{version}-x86-python2.msi'
-MSI_FILENAME_PYTHON2_X64 = 'mercurial-{version}-x64-python2.msi'
 MSI_FILENAME_PYTHON3_X86 = 'mercurial-{version}-x86.msi'
 MSI_FILENAME_PYTHON3_X64 = 'mercurial-{version}-x64.msi'
 
@@ -147,14 +102,6 @@
 X86_USER_AGENT_PATTERN = '.*Windows.*'
 X64_USER_AGENT_PATTERN = '.*Windows.*(WOW|x)64.*'
 
-EXE_PYTHON2_X86_DESCRIPTION = (
-'Mercurial {version} Inno Setup installer - x86 Windows (Python 2) '
-'- does not require admin rights'
-)
-EXE_PYTHON2_X64_DESCRIPTION = (
-'Mercurial {version} Inno Setup installer - x64 Windows (Python 2) '
-'- does not require admin rights'
-)
 # TODO remove Python version once Python 2 is dropped.
 EXE_PYTHON3_X86_DESCRIPTION = (
 'Mercurial {version} Inno Setup installer - x86 Windows (Python 3) '
@@ -164,14 +111,6 @@
 'Mercurial {version} Inno Setup installer - x64 Windows (Python 3) '
 '- does not require admin rights'
 )
-MSI_PYTHON2_X86_DESCRIPTION = (
-'Mercurial {version} MSI installer - x86 Windows (Python 2) '
-'- requires admin rights'
-)

D12260: automation: run hg with python3

2022-03-02 Thread indygreg (Gregory Szorc)
indygreg created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  Python 2.7 support will go away soon. Let's use Python 3 as part of
  the automation.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  contrib/automation/hgautomation/linux.py
  contrib/automation/hgautomation/windows.py

CHANGE DETAILS

diff --git a/contrib/automation/hgautomation/windows.py 
b/contrib/automation/hgautomation/windows.py
--- a/contrib/automation/hgautomation/windows.py
+++ b/contrib/automation/hgautomation/windows.py
@@ -261,7 +261,7 @@
 hg_bin = hg_repo / 'hg'
 
 res = subprocess.run(
-['python2.7', str(hg_bin), 'log', '-r', revision, '-T', '{node}'],
+['python3', str(hg_bin), 'log', '-r', revision, '-T', '{node}'],
 cwd=str(hg_repo),
 env=env,
 check=True,
@@ -271,7 +271,7 @@
 full_revision = res.stdout.decode('ascii')
 
 args = [
-'python2.7',
+'python3',
 hg_bin,
 '--config',
 'ui.ssh=ssh -F %s' % ssh_config,
diff --git a/contrib/automation/hgautomation/linux.py 
b/contrib/automation/hgautomation/linux.py
--- a/contrib/automation/hgautomation/linux.py
+++ b/contrib/automation/hgautomation/linux.py
@@ -532,7 +532,7 @@
 hg_bin = source_path / 'hg'
 
 res = subprocess.run(
-['python2.7', str(hg_bin), 'log', '-r', revision, '-T', '{node}'],
+['python3', str(hg_bin), 'log', '-r', revision, '-T', '{node}'],
 cwd=str(source_path),
 env=env,
 check=True,
@@ -542,7 +542,7 @@
 full_revision = res.stdout.decode('ascii')
 
 args = [
-'python2.7',
+'python3',
 str(hg_bin),
 '--config',
 'ui.ssh=ssh -F %s' % ssh_config,



To: indygreg, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D12261: automation: make system3 the default for run-tests-linux

2022-03-02 Thread indygreg (Gregory Szorc)
indygreg created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  We'll soon drop support for Python 2.7. Let's use Python 3 by
  default.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  contrib/automation/hgautomation/cli.py

CHANGE DETAILS

diff --git a/contrib/automation/hgautomation/cli.py 
b/contrib/automation/hgautomation/cli.py
--- a/contrib/automation/hgautomation/cli.py
+++ b/contrib/automation/hgautomation/cli.py
@@ -480,7 +480,7 @@
 'pypy3.5',
 'pypy3.6',
 },
-default='system2',
+default='system3',
 )
 sp.add_argument(
 'test_flags',



To: indygreg, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D12259: tests: move Python 3.5 check higher in file

2022-03-02 Thread indygreg (Gregory Szorc)
indygreg created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  Per code review comment on the changeset that introduced the Python 3.5+
  checks.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  tests/run-tests.py

CHANGE DETAILS

diff --git a/tests/run-tests.py b/tests/run-tests.py
--- a/tests/run-tests.py
+++ b/tests/run-tests.py
@@ -72,6 +72,13 @@
 import uuid
 import xml.dom.minidom as minidom
 
+if sys.version_info < (3, 5, 0):
+print(
+'%s is only supported on Python 3.5+, not %s'
+% (sys.argv[0], '.'.join(str(v) for v in sys.version_info[:3]))
+)
+sys.exit(70)  # EX_SOFTWARE from `man 3 sysexit`
+
 WINDOWS = os.name == r'nt'
 shellquote = shlex.quote
 
@@ -143,12 +150,6 @@
 
 origenviron = os.environ.copy()
 
-if sys.version_info < (3, 5, 0):
-print(
-'%s is only supported on Python 3.5+, not %s'
-% (sys.argv[0], '.'.join(str(v) for v in sys.version_info[:3]))
-)
-sys.exit(70)  # EX_SOFTWARE from `man 3 sysexit`
 
 xrange = range  # we use xrange in one place, and we'd rather not use range
 



To: indygreg, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D7046: phabricator: add the uploadchunks function

2022-03-02 Thread RoryCrona (Rory Crona )
Herald added a subscriber: mercurial-patches.
RoryCrona added a comment.


  As said in this article using the airdorid 4.0 is very easy and smooth. The 
https://www.resumehelpservices.com/resumespice-com-review/ blog developers has 
done very good job in this latest version by bringing new features into it and 
making it user friendly app which can run on any user interface and operating 
system which is very good thing for the users.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7046/new/

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

To: Kwan, #hg-reviewers, indygreg
Cc: mercurial-patches, RoryCrona, indygreg, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


mercurial-devel | Failed pipeline for branch/default | 651ce36d

2022-03-02 Thread Heptapod


Pipeline #45862 has failed!

Project: mercurial-devel ( https://foss.heptapod.net/mercurial/mercurial-devel )
Branch: branch/default ( 
https://foss.heptapod.net/mercurial/mercurial-devel/-/commits/branch/default )

Commit: 651ce36d ( 
https://foss.heptapod.net/mercurial/mercurial-devel/-/commit/651ce36df3414cc5f052a42217b2d170fcffd915
 )
Commit Message: rhg: simplify the handling of share-safe config...
Commit Author: Arseniy Alekseyev ( https://foss.heptapod.net/aalekseyev )

Pipeline #45862 ( 
https://foss.heptapod.net/mercurial/mercurial-devel/-/pipelines/45862 ) 
triggered by Administrator ( https://foss.heptapod.net/root )
had 1 failed job.

Job #456322 ( 
https://foss.heptapod.net/mercurial/mercurial-devel/-/jobs/456322/raw )

Stage: tests
Name: test-py3-chg

-- 
You're receiving this email because of your account on foss.heptapod.net.



___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel